33Generating Recordings
44=====================
55
6- Recordings are generated combining templates and spike trains. The recordings parameters are divided in different
6+ Recordings are generated combining templates and spike trains. The recordings parameters are divided into different
77sections:
88
99* :code: `spiketrains `
@@ -13,8 +13,8 @@ sections:
1313* :code: `seeds `
1414
1515The :code: `spiketrains ` part deals with the generation of spike trains, while the :code: `templates `,
16- :code: `cell-types `, and :code: `recordings ` sections specify parameters to assemble spike trains and templates and build
17- the extracellular recordings. The :code: `seeds ` contains all the random seeds involved in the simulations, to ensure
16+ :code: `cell-types `, and :code: `recordings ` sections specify parameters to assemble templates, select cell types, and build
17+ the extracellular recordings, respectively . The :code: `seeds ` contains all the random seeds involved in the simulations to ensure
1818reproducibility.
1919
2020
@@ -23,19 +23,19 @@ Spike trains generation
2323
2424The first step is the spike train generation. The user can specify the number and type of cells in 2 ways:
2525
26- 1. providing a list of :code: `rates ` and corresponding :code: `types `: e.g. rates = [3, 3, 5], types = ['E', 'E', 'E ']
26+ 1. providing a list of :code: `rates ` and corresponding :code: `types `: e.g. rates = [3, 3, 5], types = ['E', 'E', 'I ']
2727will generate 3 spike trains with average firing rates 3, 3, and 5 Hz and respectively excitatory, excitatory , and inhibitory type.
28282. providing :code: `n_exc `, :code: `n_inh `, :code: `f_exc `, :code: `f_inh `, :code: `st_exc `, :code: `st_min `: in this case
2929there will be generated :code: `n_exc ` excitatory spike trains with average firing rate of :code: `f_exc ` and firing rate standard deviation of :code: `st_exc ` (same for inhibitory spike trains)
3030
31- The firinga rates generated with the second option have a minimum firing rate of :code: `min_rate ` (default 0.5 Hz).
31+ The firing rates generated with the second option have a minimum firing rate of :code: `min_rate ` (default 0.5 Hz).
3232
3333Spike trains are simulated as Poisson or Gamma processes (chosen with the parameter :code: `process `) and in the latter
3434case the :code: `gamma ` parameter controls the curve shape.
3535
3636Spikes violating the refreactory period :code: `ref_per ` (default is 2 ms) are removed.
3737
38- :code: `t_start ` (0 s by default) is the start timestamp of the recordings in second and :code: `duration ` will correspond
38+ :code: `t_start ` (0 s by default) is the start timestamp of the recordings in seconds and :code: `duration ` will correspond
3939to the duration of the recordings.
4040
4141
@@ -60,7 +60,7 @@ Spike trains parameters section summary
6060 st_inh: 3 # firing rate standard deviation of inhibitory cells in Hz
6161 min_rate: 0.5 # minimum firing rate in Hz
6262 ref_per: 2 # refractory period in ms
63- process: poisson # process for spike train simulation (poisson- gamma)
63+ process: poisson # process for spike train simulation (poisson, gamma)
6464 gamma_shape: 2 # gamma shape (for gamma process)
6565 t_start: 0 # start time in s
6666 duration: 10 # duration in s
@@ -72,8 +72,8 @@ Recordings Generation
7272Specifying excitatory and inhibitory cell-types
7373~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7474
75- In order to select the proper cell type (excitatory - inhibitory) the :code: `cell-types ` section of the parameters
76- allows the user to specify which strings to look for in the cell model name (from the NMC database) to assign it to
75+ In order to select the proper cell type (excitatory or inhibitory) the :code: `cell-types ` section of the parameters
76+ allows the user to specify which strings to look for in the cell model name (from the NMC database) to assign it to
7777the excitatory or inhibitory set. In this example from L5 cells, all cells contining LBC (Large Basket Cells) will be
7878marked as inhibitory, and so on.
7979If you use custom cell models, you should overwrite this section as shown in
@@ -104,8 +104,8 @@ provided) and they follow the following rules:
104104Once the templates are selected and matched to the corresponding spike train, temporal jitter is added to them to
105105simulate the uncertainty of the spike event within the sampling period. :code: `n_jitters ` (default is 10) templates are
106106created by upsampling the original templates by :code: `upsample ` times (default is 8) and shifting them within a
107- sampling period. During convolution, randomly a jittered version of the spike is selected.
108- Finally, the templates are linearly padded on both sides (:code: `pad_len ` by default pads 3 ms before and 3 after the
107+ sampling period. During convolution, a jittered version of the spike is randomly selected.
108+ Finally, the templates are linearly padded on both sides (:code: `pad_len ` by default pads 3 ms before and 3 ms after the
109109duration of the template) to ensure a smooth convolution.
110110
111111The :code: `overlap_threshold ` allows to define spatially overlapping templates. For example, if set to 0.9 (by default)
@@ -139,7 +139,7 @@ Other recordings settings
139139
140140After the templates are selected, jittered, and padded, clean recordings are generated by convolving each template with
141141its corresponding spike train.
142- The :code: `fs ` parameters permits to resample the recordings and if it is not provided recordings are created with the
142+ The :code: `fs ` parameters permits resampling of the recordings and if it is not provided recordings are created with the
143143same sampling frequency as the templates.
144144Recordings can be split in times chunks using the :code: `chunk_duration ` (20 s by default) parameter.
145145Chunks can be processed in parallel.
@@ -151,7 +151,7 @@ coincident. :code:`sync_jitt` (default 1 ms) controls the jittering in time for
151151The :code: `modulation ` parameter is extremely important, as it controls the variablility of the amplitude modulation:
152152* if :code: `modulation ` id :code: `none `, spikes are not modulated and each instance will have the same aplitude
153153* if :code: `modulation ` id :code: `template `, each spike event is modulated with the same amplitude for all electrodes
154- * if :code: `modulation ` id :code: `electrode `, each spike event is modulated with different amplitude for each electrode
154+ * if :code: `modulation ` id :code: `electrode `, each spike event is modulated with a different amplitude for each electrode
155155
156156For the :code: `template ` and :code: `electrode ` modulations, the amplitude is modulated as a Normal distribution with
157157amplitude 1 and standard deviation of :code: `sdrand ` (default is 0.05).
@@ -178,14 +178,14 @@ The templates are stretched with the same value on all electrodes, and then, in
178178the eap on each electrode to match the specific :math: `mod` for the electrode. Also for an :code: `template `-type modulation,
179179the eap is rescaled at the template level.
180180
181- Next, noise is added to to the clean recordings. Three different noise modes can be used (using the :code: `noise_mode `
181+ Next, noise is added to the clean recordings. Three different noise modes can be used (using the :code: `noise_mode `
182182parameter):
183183
1841841. :code: `uncorrelated `: additive gaussian noise (default) with a standard deviation of :code: `noise_level `
185185(10 :math: `\mu V` by default)
186186
187- 2. :code: `distance-correlated `: noise is generated as a multivariate normal with covariance matrix decaying with
188- distance between electrodes. The :code: `noise_half_distance ` parameter is the distance for which correlation is 0.5.
187+ 2. :code: `distance-correlated `: noise is generated as a multivariate normal with a covariance matrix decaying with
188+ distance between electrodes. The :code: `noise_half_distance ` parameter is the distance for which the correlation is 0.5.
189189
1901903. :code: `far-neurons `: noise is generated by the activity of :code: `far_neurons_n ` far neurons (default 300). In order to use this mode,
191191 it is recommended to generate templates with a small or null maximum amplitude. In fact, far neurons if their maximum amplitude
@@ -205,7 +205,7 @@ noise level is adjusted so that the overall standard deviation is equal to :code
205205
206206Finally, and optionally, the recordings can be filtered (if :code: `filter ` is :code: `True `) with a high-pass or band-pass
207207filter with :code: `filter_cutoff ` frequency(ies) ([300, 6000] by default). If :code: `filter_cutoff ` is a scalar, the signal is high-pass
208- filtered. The order of the Butterworth filter can be adjusted with the :code: `filter_order ` frequency(ies) param .
208+ filtered. The order of the Butterworth filter can be adjusted with the :code: `filter_order ` frequency(ies) parameter .
209209
210210For further analysis, spike events can be annotated as "TO" (temporal overlapping) or "SO" (spatio-temporal overlapping)
211211when :code: `overlap ` is set to :code: `True `. The waveforms can also be extracted and loaded to the
@@ -262,23 +262,23 @@ When drifting templates are generated (:ref:`drift-templates`), drifting recordi
262262:code: `drifting ` is set to :code: `True `. The :code: `preferred_dir ` parameter indicates the 3D vector with the
263263preferred direction of drift ([0,0,1], default, is upwards in the z-direction) and the :code: `angle_tol ` (default is 15
264264degrees) corresponds to the tolerance in this direction.
265- There are three types of :code: `drift_mode `: slow or fast.
265+ There are two types of :code: `drift_mode `: slow or fast.
266266The different modalities vary in terms of how the drifting template is selected for each spike during the modulated convolution.
267267
268- For slow drifts , a new position is calculated moving from the initial position along the drifting direction with
268+ For slow drift , a new position is calculated moving from the initial position along the drifting direction with
269269a velocity of :code: `slow_drift_velocity ` (default 5 :math: `\mu m`/min).
270270If a boundary position is reached (initial or final positions), the drift direction is reversed.
271271The shape of slow drift can be controlled with the :code: `slow_drift_shape ` parameter (default is a :code: `triangluar ` shape),
272272while the amplitude in :math: `\mu m` with the :code: `slow_drift_amplitude `.
273273
274- For fast drifts , the user can set the frequency at which fast drift events occur (every :code: `fast_drift_period ` s, default 20 s).
274+ For fast drift , the user can set the frequency at which fast drift events occur (every :code: `fast_drift_period ` s, default 20 s).
275275When a fast drift event happens, a new template position is selected randomly among the drifting templates for each
276276drifting neuron, so that the amplitude of the new template on the channel in which the old template has the largest
277- peak is within :code: `fast_drift_min_jump ` and :code: `fast_drift_min_jump ` (defaults 5-20 ).
278- This is to ensure that fast drifts are not too abrupt.
277+ peak is within :code: `fast_drift_min_jump ` and :code: `fast_drift_max_jump ` (defaults 5 and 20, respectively ).
278+ This is to ensure that each fast drift event is not too abrupt.
279279
280280Drift can be rigid (all neurons drift coherently) or non-rigid (each neuron drifts differently). The :code: `drift_mode_probe ` parameter
281- controls this and in case of non-rigid drift, the a lineare gradient depending on the neurons' depth is applied.
281+ controls this and in the case of non-rigid drift, a linear gradient depending on the neuron's depth is applied.
282282By default, the neurons at the bottom of the probe will drift at 50% speed with respect to the neurons at the top of the probe.
283283Other parameters can be controlled. See the :py:func: `~MEArec.drift_tools.generate_drift_dict_from_params ` function for more details.
284284
@@ -341,13 +341,13 @@ Recordings can also be generated using a Python script, or a jupyter notebook.
341341 recgen = mr.gen_recordings(params = None , templates = None , tempgen = None , n_jobs = None , verbose = False )
342342
343343
344- The :code: `params ` argument can be the path to a yaml file or a dictionary containing the parameters (if :code: `None` ` default
345- parameters are used). On of the :code: `templates ` or :code: `tempgen ` parameters must be indicated, the
344+ The :code: `params ` argument can be the path to a yaml file or a dictionary containing the parameters (if :code: `None ` default
345+ parameters are used). One of the :code: `templates ` or :code: `tempgen ` parameters must be indicated, the
346346former pointing to a generated templates file, the latter instead is a :code: `TemplateGenerator ` object.
347- The :code: `n_jobs ` argument indicates how many jobs will be used in parallel (for parallel processing, more than 1 chunks
348- are required).
347+ The :code: `n_jobs ` argument indicates how many jobs will be used in parallel (for parallel processing, more than 1 chunk
348+ is required).
349349If :code: `verbose=True `, the output shows the progress of the template simulation. :code: `verbose=True ` corresponds to
350- :code: `verbose=1 `. For a higher level of verbosity also :code: `verbose=2 ` can be used.
350+ :code: `verbose=1 `. For a higher level of verbosity :code: `verbose=2 ` can also be used.
351351
352352
353353The :code: `gen_recordings() ` function returns a gen_templates :code: `RecordingGenerator ` object (:code: `recgen `).
@@ -388,4 +388,4 @@ The :code:`RecordingGenerator` class contains several fields:
388388 import MEArec as mr
389389 mr.save_recording_generator(recgen, filename = None )
390390
391- where :code: `recgen ` is a :code: `RecordingGenerator ` object and :code: `filename ` is the output file name.
391+ where :code: `recgen ` is a :code: `RecordingGenerator ` object and :code: `filename ` is the output file name.
0 commit comments