ALLEN INSTITUTE

# bmtk.utils.io package

## Submodules

## bmtk.utils.io.cell_vars module

class bmtk.utils.io.cell_vars.CellVarRecorder(file_name, tmp_dir, variables, buffer_data=True, mpi_rank=0, mpi_size=1, **kwargs)

  Bases: `object`

  Used to save cell membrane variables (V, Ca2+, etc) to the described hdf5 format.

  For parallel simulations this class will write to a seperate tmp file on each rank, then use the merge method to combine the results. This is less efficent, but doesn’t require the user to install mpi4py and build h5py in parallel mode. For better performance use the CellVarRecorderParallel class instead.

  class DataTable(var_name)

    Bases: `object`

    A small struct to keep track of different data (and buffer) tables

  add_cell(gid, sec_list, seg_list, **map_attrs)
  close()
  property dt
  flush()

    Move data from memory to dataset

  initialize(n_steps, buffer_size=0)
  property is_initialized
  merge()
  record_cell(gid, var_name, seg_vals, tstep)

    Record cell parameters.

    Parameters:

      - gid – gid of cell.

      - var_name – name of variable being recorded.

      - seg_vals – list of all segment values

      - tstep – time step

  record_cell_block(gid, var_name, seg_vals)

    Save cell parameters one block at a time

    Parameters:

      - gid – gid of cell.

      - var_name – name of variable being recorded.

      - seg_vals – A vector/matrix of values being recorded

  property tstart
  property tstop

class bmtk.utils.io.cell_vars.CellVarRecorderParallel(file_name, tmp_dir, variables, buffer_data=True, **kwargs)

  Bases: `CellVarRecorder`

  Unlike the parent, this take advantage of parallel h5py to writting to the results file across different ranks.

  merge()

## bmtk.utils.io.firing_rates module

class bmtk.utils.io.firing_rates.RatesInput(params)

  Bases: `object`

  get_rate(gid)
  property populations

class bmtk.utils.io.firing_rates.RatesWriter(file_name)

  Bases: `object`

  add_rates(gid, times, rates)
  to_csv(file_name)
  to_h5(file_name)

## bmtk.utils.io.ioutils module

class bmtk.utils.io.ioutils.BMTKWorldComm

  Bases: `object`

  property MPI_rank
  property MPI_size
  barrier()
  property comm

bmtk.utils.io.ioutils.set_world_comm(comm)

## bmtk.utils.io.spike_trains module

class bmtk.utils.io.spike_trains.DFIndexedGIDs(spikes_input_h5)

  Bases: `SONATAIndexer`

  get_spikes(gid)

class bmtk.utils.io.spike_trains.DictIndexedGIDs(spikes_input_h5)

  Bases: `SONATAIndexer`

  get_spikes(gid)

class bmtk.utils.io.spike_trains.HDF5IndexedGIDs(spikes_input_h5)

  Bases: `SONATAIndexer`

class bmtk.utils.io.spike_trains.PoissonSpikesGenerator(gids, firing_rate, tstart=0.0, tstop=1000.0)

  Bases: `object`

  to_hdf5(file_name, sort_order='gid')

class bmtk.utils.io.spike_trains.SONATAIndexer

  Bases: `object`

  get_spikes(gid)

class bmtk.utils.io.spike_trains.SpikeTrainWriter(tmp_dir, mpi_rank=0, mpi_size=1)

  Bases: `object`

  class TmpFileMetadata(file_name, sort_order=None)

    Bases: `object`

  add_spike(time, gid)
  add_spikes(times, gid)
  add_spikes_file(file_name, sort_order=None)
  close()
  close_tmp_file()
  flush()
  to_csv(csv_file, sort_order=None, gid_map=None)
  to_hdf5(hdf5_file, sort_order=None, gid_map=None)
  to_nwb(nwb_file)

class bmtk.utils.io.spike_trains.SpikesInput

  Bases: `object`

  get_spikes(gid)
  static load(name, module, input_type, params)

class bmtk.utils.io.spike_trains.SpikesInputCSV(name, module, input_type, params)

  Bases: `SpikesInput`

  get_spikes(gid)

class bmtk.utils.io.spike_trains.SpikesInputH5(name, module, input_type, params)

  Bases: `SpikesInput`

  get_spikes(gid)
  property gids
  property timestamps

class bmtk.utils.io.spike_trains.SpikesInputNWBv1(name, module, input_type, params)

  Bases: `SpikesInput`

  get_spikes(gid)

class bmtk.utils.io.spike_trains.UnindexedGIDs(spikes_input_h5)

  Bases: `SONATAIndexer`

## Module contents

bmtk.utils.io.log_warning(message)