ALLEN INSTITUTE

# bmtk.simulator.core.modules package

## Submodules

## bmtk.simulator.core.modules.ecephys_module module

class bmtk.simulator.core.modules.ecephys_module.ECEphysUnitsModule(name, **kwargs)

  Bases: `SimulatorMod`

  TODO: - Have option to specify the nwb file units and/or get them from the NWB - Have option to save units-node mapping to output folder

  initialize(sim)

    Will be called once at the beginning of the simulation run, after the network and simulation parameters have all been finalized.

    Parameters:

      sim – Simulation object

class bmtk.simulator.core.modules.ecephys_module.MappingStrategy(**kwargs)

  Bases: `object`

  build_map(node_set)
  get_spike_trains(node_id, source_population)
  property nwb_files
  property units2nodes_map
  property units_table

class bmtk.simulator.core.modules.ecephys_module.NWBFileWrapper(nwb_path)

  Bases: `object`

  property uuid

class bmtk.simulator.core.modules.ecephys_module.SamplingStrategy(with_replacement=False, **kwargs)

  Bases: `MappingStrategy`

  build_map(node_set)

class bmtk.simulator.core.modules.ecephys_module.TimeWindow(defaults=None, nwb_files=None)

  Bases: `object`

  A class for dealing with different strategies for storing and intrepreting time windows intervals [start, stop], mainly for use in filtering spike times. Including converting between seconds/miliseconds, parsing an NWB stimulus table, and look up for individual unit time, and dealing with defaults. To initialize:

      tw = TimeWindow(defaults=[interval1, interval2, ...], nwb_files=[session1.nwb, session2.nwb, ...])

  Where interval<i> is a time-window associated with all unit spikes in session<i>.nwb, and can include None (in which case it will not filter unit spike times).

  If individual units will have unique time intervals then you can pass in a pandas DataFrame with columns [unit_ids, start_times, stop_times], with values in ms:

      tw.units_lu = units_times_table_df

  And to fetch the time window associated with unit, for example unit_id 9999 in session_0.nwb, then call:

      window = tw[9999, 'session_0.nwb']

  If will first check to see if unit 9999 has a special [start_time, stop_time] in units_lu table, and if not then fall back to the default for ‘session_0.nwb’, and in seconds. If unit_id/default_session is then it returns a None value.

  property units_lu

class bmtk.simulator.core.modules.ecephys_module.UnitIdMapStrategy(**kwargs)

  Bases: `MappingStrategy`

  build_map(node_set)

bmtk.simulator.core.modules.ecephys_module.filter_table(table_df, filters_dict)

## bmtk.simulator.core.modules.iclamp module

class bmtk.simulator.core.modules.iclamp.AmpsReader(**args)

  Bases: `object`

class bmtk.simulator.core.modules.iclamp.CSVAmpReader(**args)

  Bases: `object`

class bmtk.simulator.core.modules.iclamp.IClampMod(input_type, **mod_args)

  Bases: `SimulatorMod`

  A Module to help with creating a current-clamp/generator that can be injected into a selected subset of cells.

  This class if primarily focused on reading the inputs parameters and/or configuration files to determine the current injection onsets, amplitudes, and stop times depending on the input-type. The actual implementation of the current injections is dependent on the simulator (IClamp for BioNet, step_current_generator for PointNet) and implementation is done in their respective modules.iclamps.py files.

  property input2reader_map

class bmtk.simulator.core.modules.iclamp.NWBReader(**args)

  Bases: `object`

## bmtk.simulator.core.modules.simulator_module module

class bmtk.simulator.core.modules.simulator_module.SimulatorMod

  Bases: `object`

  Class for writing custom bionet functions that will be called during the simulation. To use overwrite one or more of the following methods in a subclass, and bionet will call the function at the appropiate time.

  To call during a simulation:

    … sim = Simulation(…) mymod = MyModule(…) sim.add_mod(mymod) sim.run()

  block(sim, block_interval)

    This method is called once after every block of time, as specified by the configuration.

    Unlike the step method which is called during every time-step, the block method will typically be called only a few times over the entire simulation. The block method is preferable for accessing and saving to the disk, summing up existing data, or simular functionality

    Parameters:

      - sim – Simulation object

      - block_interval – The time interval (tstep_start, tstep_end) for which the block is being called on.

  finalize(sim)

    Call once at the very end of the simulation.

    Parameters:

      sim – Simulation object

  initialize(sim)

    Will be called once at the beginning of the simulation run, after the network and simulation parameters have all been finalized.

    Parameters:

      sim – Simulation object

  preload(sim)

    Will be called once at the beginning of the simulation run before network is loaded

    Parameters:

      sim – Simulation object

  step(sim, tstep)

    Called on every single time step (dt).

    The step method is used for anything that should be recorded or changed continously. dt is determined during the setup, and the sim parameter can be used to access simulation, network and individual cell properties

    Parameters:

      - sim – Simulation object.

      - tstep – The decrete time-step

## Module contents