# deer_lib_gen.m

Generates a library of distance distributions and corresponding DEER traces for use in neural network training. Full details are given in our paper on the subject.

## Syntax

    [time_grid,dist_grid,dist_distr_lib,...
deer_ffact_lib,background_lib,deer_trace_lib,...
noise_line_lib,exchange_lib,parameters]=deer_lib_gen(file_name,parameters)


## Arguments

   min_dist          - lower limit of distance distributions,
Angstrom

max_dist          - upper limit of distance distributions,
Angstrom

max_time          - DEER trace duration, seconds

max_exch          - maximum exchange coupling, MHz
(NMR convention)

min_exch          - minimum exchange coupling, MHz
(NMR convention)

ntraces           - number of traces you wish to generate

ndistmax          - maximum number of skewed gaussians
in the distance distribution

npoints           - number of digitisation points in the
DEER trace and the distance distribu-
tion

noise_lvl         - RMS noise level as a fraction of the
modulation depth

min_fwhm          - minimum FWHM for a skewed gaussian in
the distance distribution, fraction of
distance

max_fwhm          - maximum FWHM for a skewed gaussian in
the distance distribution, fraction of
distance

min_skew          - minimum shape parameter for a skewed
gaussian in the distance distribution

max_skew          - maximum shape parameter for a skewed
gaussian in the distance distribution

max_mdep          - minimum DEER modulation depth

min_mdep          - maximum DEER modulation depth

max_brate         - maximum background signal decay
rate, s^-1

min_brate         - minimum background signal decay
rate, s^-1

min_bdim          - minimum background dimensionality

max_bdim          - maximum background dimensionality


## Outputs

   time_grid         - time grid (seconds) as a row vector

dist_grid         - distance grid (Angsrom) as a row vector

dist_distr_lib    - all distance distributions as a horizonal
stack of row vectors

deer_ffact_lib    - all DEER form factors as a horizonal
stack of row vectors

background_lib    - all background signals as a horizonal
stack of row vectors, shifted and scaled
to match DEER traces

deer_trace_lib    - all complete DEER traces as a horizonal
stack of row vectors

noise_line_lib    - all noise tracks as a horizonal
stack of row vectors

exchange_lib      - exchange interaction (MHz), a row vector
conataining the value for each example

parameters        - parameters array as received


If a file name is provided, these variables are written into that file.

## Examples

The example below loads the parameters from one of the example files and generates a library of 1000 DEER traces.

	% Load the training set parameters
run('net_set_any_peaks/netset_params.m');

% Specify number of traces to produce
parameters.ntraces=1000;

% Set the training database name
file_name='dlg_example_set.mat';

% Generate the training library
[time_grid,dist_grid,dist_distr_lib,...
deer_ffact_lib,background_lib,deer_trace_lib,...
noise_line_lib,exchange_lib,parameters]=deer_lib_gen(file_name,parameters);


One of the resulting DEER traces is shown below.

## Notes

Multiple caveats exist in the training process. Please read our paper carefully before training your own networks.