raster_maker.py

Functional Group Raster Figure

Contains the functions and class (SonataWriter) necessary for generating and saving the input spike rasters.

class L5NeuronSimulation.raster_maker.SonataWriter(f_name, groups, datasets, types)[source]

Class used to dynamically writing spike rasters to an h5 file.

file

file object being worked on

Type

h5py.File

group

gropu where the datasets reside

Type

h5py.Group

datasets

datasets that are saved to the file

Type

dict

append_ds(vals, ds)[source]

appends the given values to the end of the given dataset

append_repeat(ds, val, N)[source]

appends the given value N times to the end of the given dataset

close()[source]

close the h5py file

append_ds(vals, ds)[source]

appends the given values to the end of the given dataset

Parameters
  • vals (list) – list of values to be appended to the dataset

  • ds (str) – key of the dataset to append to

append_repeat(ds, val, N)[source]

appends the given value N times to the end of the given dataset

Parameters
  • ds (str) – key of the dataset to append to

  • val ([type]) – value to be appended N times

  • N (int) – number of vals to append to the dataset

close()[source]

Closes the h5py File

L5NeuronSimulation.raster_maker.make_noise(num_traces=100, num_samples=4999)[source]

Creates a noise trace used in generating spike rasters.

Parameters
  • num_traces (int, optional) – number of noise traces to create (first dimension), by default 100

  • num_samples (int, optional) – length of the trace (second dimension), by default 4999

Returns

noise trace

Return type

np.array

L5NeuronSimulation.raster_maker.make_save_spikes(writer, exp, dist, numUnits=100, rateProf=None, start_id=0, start_time=0)[source]

Creates and saves spikes for the given nodes using the provided noise trace and a random mean firing rate generated with the given distribution.

Parameters
  • writer (SonataWriter) – how the spikes are saved

  • exp (bool) – whether the value from dist should be fed to np.exp()

  • dist (np.array()) – array of firing rates of shape (numUnits,)

  • numUnits (int, optional) – number of nodes to generate spikes for, by default 100

  • rateProf (np.array(), optional) – noise trace for each unit must have numUnits rows, by default None

  • start_id (int, optional) – node_id that the first unit/node should be associated with, by default 0

  • start_time (int, optional) – at what time the spikes should start being generated, by default 0

L5NeuronSimulation.raster_maker.minmax(x)[source]

min max normalizes the given array

L5NeuronSimulation.raster_maker.shift_exc_noise(ts, nid, seconds, time_shift=4)[source]

Creates a shifted, min-max normalized average traces of the given spike raster.

Parameters
  • ts (list) – times (float) where spikes occur

  • nid (int) – node id associated with each spike

  • seconds (float) – length of the raster in seconds

  • time_shift (int, optional) – how many ms to shift the average trace by, by default 4

Returns

[description]

Return type

[type]

L5NeuronSimulation.raster_maker.zscore(x)[source]

z scores the given array