datasets_theory
Main class for generating datasets of theoretical trajectories. For details on this class, please check this tutorial.
datasets_theory
datasets_theory ()
This class generates, saves and loads datasets of theoretical trajectories simulated from various diffusion models (available at andi_datasets.models_theory).
create_dataset
create_dataset (T, N_models, exponents, models, dimension=1, save_trajectories=False, load_trajectories=False, path='datasets/', N_save=1000, T_save=1000)
Creates a dataset of trajectories via the theoretical models defined in .models_theory
. Check our tutorials for use cases of this function.
Type | Default | Details | |
---|---|---|---|
T | int | Length of the trajectories. | |
N_models | int, numpy.array | - if int, number of trajectories per class (i.e. exponent and model) in the dataset. - if numpy.array, number of trajectories per classes: size (number of models)x(number of classes) |
|
exponents | float, array | Anomalous exponents to include in the dataset. Allows for two digit precision. | |
models | bool, int, list | Labels of the models to include in the dataset. Correspodance between models and labels is given by self.label_correspodance, defined at init. If int/list, choose the given models. If False, choose all of them. |
|
dimension | int | 1 | |
save_trajectories | bool | False | If True, the module saves a .h5 file for each model considered, with N_save trajectories and T = T_save. |
load_trajectories | bool | False | If True, the module loads the trajectories of an .h5 file. |
path | str | datasets/ | Path to the folder where to save/load the trajectories dataset. |
N_save | int | 1000 | Number of trajectories to save for each exponents/model. Advise: save at the beggining a big dataset (t_save ~ 1e3 and N_save ~ 1e4) which then allows you to load any other combiantion of T and N_models. |
T_save | int | 1000 | |
Returns | numpy.array | - Dataset of trajectories of lenght Nx(T+2), with the following structure: o First column: model label o Second column: value of the anomalous exponent o 2:T columns: trajectories |
create_segmented_dataset
create_segmented_dataset (dataset1, dataset2, dimension=1, final_length=200, random_shuffle=False)
Creates a dataset with trajectories which change diffusive feature (either model or anomalous exponent) after a time ‘t_change’.
Type | Default | Details | |
---|---|---|---|
dataset1 | numpy.array | Array of size Nx(t+2), where the first columns values correspond to the labels of the model and anomalous exponent. The rest correspond to the trajectories of length t. |
|
dataset2 | numpy.array | Same as dataset1 | |
dimension | int | 1 | Dimensions of the generated trajectories. Three possible values: 1, 2 and 3. |
final_length | int | 200 | Length of the output trajectories. |
random_shuffle | bool | False | If True, shuffles the first axis of dataset1 and dataset2. |
Returns | numpy.array | Array of size Nx(t+5) whose columns represent: o Column 0: changing time o Column 1,2: labels first part of the trajectory (model, exponent) o Column 3,4: labels second part of the trajectory (model, exponent) o Column 5:(t+5): trajectories of lenght t. |
create_noisy_diffusion_dataset
create_noisy_diffusion_dataset (dataset=False, T=False, N=False, exponents=False, models=False, dimension=1, diffusion_coefficients=False, save_trajectories=False, load_trajectories=False, path='datasets/', N_save=1000, t_save=1000)
Create a dataset of noisy trajectories. This function creates trajectories with _create_trajectories
and then adds given noise to them.
All arguments are the same as _create_trajectories
but dataset and diffusion_coefficients.
Type | Default | Details | |
---|---|---|---|
dataset | bool | False | - If False, creates a dataset with the given parameters. - If numpy array, dataset to which the function applies the noise. |
T | bool | False | |
N | bool | False | |
exponents | bool | False | |
models | bool | False | |
dimension | int | 1 | |
diffusion_coefficients | bool | False | |
save_trajectories | bool | False | |
load_trajectories | bool | False | |
path | str | datasets/ | |
N_save | int | 1000 | |
t_save | int | 1000 | |
Returns | numpy.array | Dataset of trajectories of lenght Nx(T+2), with the following structure: o First column: model label o Second column: value of the anomalous exponent o 2:T columns: trajectories |
create_noisy_localization_dataset
create_noisy_localization_dataset (dataset=False, T=False, N=False, exponents=False, models=False, dimension=1, noise_func=False, sigma=1, mu=0, save_trajectories=False, load_trajectories=False, path='datasets/', N_save=1000, t_save=1000)
Create a dataset of noisy trajectories. This function creates trajectories with _create_trajectories and then adds given noise to them.
All parameters are the same as _create_trajectories but noise_func.
Type | Default | Details | |
---|---|---|---|
dataset | bool | False | If False, creates a dataset with the given parameters. If numpy array, dataset to which the function applies the noise. |
T | bool | False | |
N | bool | False | |
exponents | bool | False | |
models | bool | False | |
dimension | int | 1 | |
noise_func | bool | False | If False, the noise added to the trajectories will be Gaussian distributed, with variance sigma and mean value mu. If function, uses the given function to generate noise to be added to the trajectory. The function must have as input two ints, N and M and the output must be a matrix of size NxM. |
sigma | int | 1 | |
mu | int | 0 | |
save_trajectories | bool | False | |
load_trajectories | bool | False | |
path | str | datasets/ | |
N_save | int | 1000 | |
t_save | int | 1000 | |
Returns | numpy.array | Dataset of trajectories of lenght Nx(T+2), with the following structure: o First column: model label o Second column: value of the anomalous exponent o 2:T columns: trajectories |