miv_simulator.utils.io#

Functions

copy_dataset(f_src, f_dst, dset_path)

rtype:

None

create_neural_h5(output_filepath, ...[, ...])

rtype:

None

get_h5py_attr(attrs, key)

str values are stored as bytes in h5py container attrs dictionaries.

get_h5py_group(file, hierarchy[, create])

type file:

h5_concat_dataset(dset, data)

h5_get_dataset(g, dsetname, **kwargs)

h5_get_group(h, groupname)

import_celltypes(celltype_path, output_path)

import_spikeraster(celltype_path, ...[, ...])

lfpout(env, output_path)

Writes local field potential voltage traces to specified HDF5 output file.

list_concat(a, b, datatype)

rtype:

List[Union[str, Any]]

mkout(env, results_filename)

Creates simulation results file and adds H5Types group compatible with NeuroH5.

query_cell_attributes(input_file, ...[, ...])

recsout(env, output_path[, t_start, ...])

Writes intracellular state traces to specified NeuroH5 output file.

set_h5py_attr(attrs, key, val)

str values are stored as bytes in h5py container attrs dictionaries.

set_union(a, b, datatype)

show_celltypes(input_path[, output])

Given the H5 file, output the table of cell types, starting id, and counts.

spikeout(env, output_path[, t_start, clear_data])

Writes spike times to specified NeuroH5 output file.

write_cell_selection(env, ...[, ...])

Writes out the data necessary to instantiate the selected cells.

write_connection_selection(env, ...[, ...])

Loads NeuroH5 connectivity file, and writes the corresponding synapse and network connection mechanisms for the selected postsynaptic cells.

write_input_cell_selection(env, ...[, ...])

Writes out predefined spike trains when only a subset of the network is instantiated.

Classes

H5FileManager(directory)

Utility to manage NeuroH5 simulator files

miv_simulator.utils.io.show_celltypes(input_path, output=<built-in function print>)[source]#

Given the H5 file, output the table of cell types, starting id, and counts.. The CLI command is provided as 'show-h5types'.

Parameters:
input_pathstr

Input h5 file path

outputCallable

output stream (default=print)

miv_simulator.utils.io.mkout(env, results_filename)[source]#

Creates simulation results file and adds H5Types group compatible with NeuroH5.

Parameters:
Return type:

None

Returns:

miv_simulator.utils.io.spikeout(env, output_path, t_start=None, clear_data=False)[source]#

Writes spike times to specified NeuroH5 output file.

Parameters:
  • env (AbstractEnv) –

  • output_path (str) –

  • clear_data (bool) –

Return type:

None

Returns:

miv_simulator.utils.io.recsout(env, output_path, t_start=None, clear_data=False, write_cell_location_data=False, write_trial_data=False)[source]#

Writes intracellular state traces to specified NeuroH5 output file.

Parameters:
  • env (AbstractEnv) –

  • output_path (str) –

  • clear_data (bool) –

  • reduce_data

Return type:

None

Returns:

miv_simulator.utils.io.lfpout(env, output_path)[source]#

Writes local field potential voltage traces to specified HDF5 output file.

Parameters:
  • env (AbstractEnv) –

  • output_path (str) –

  • clear_data

Returns:

miv_simulator.utils.io.get_h5py_attr(attrs, key)[source]#

str values are stored as bytes in h5py container attrs dictionaries. This function enables py2/py3 compatibility by always returning them to str type upon read. Values should be converted during write with the companion function set_h5py_str_attr. :type attrs: :param attrs: :class:’h5py._hl.attrs.AttributeManager’ :type key: :param key: str :return: val with type converted if str or array of str

miv_simulator.utils.io.set_h5py_attr(attrs, key, val)[source]#

str values are stored as bytes in h5py container attrs dictionaries. This function enables py2/py3 compatibility by always converting them to np.string_ upon write. Values should be converted back to str during read with the companion function get_h5py_str_attr.

Parameters:
  • attrs – :class:’h5py._hl.attrs.AttributeManager’

  • key – str

  • val – type converted if str or array of str

miv_simulator.utils.io.get_h5py_group(file, hierarchy, create=False)[source]#
Parameters:
  • file

    class:

    in [‘h5py.File’, ‘h5py.Group’]

  • hierarchy – list of str

  • create – bool

Returns:

:class:’h5py.Group’

miv_simulator.utils.io.write_cell_selection(env, write_selection_file_path, populations=None, write_kwds={})[source]#

Writes out the data necessary to instantiate the selected cells.

Parameters:

env (AbstractEnv) – an instance of the Env class

miv_simulator.utils.io.write_connection_selection(env, write_selection_file_path, populations=None, write_kwds={})[source]#

Loads NeuroH5 connectivity file, and writes the corresponding synapse and network connection mechanisms for the selected postsynaptic cells.

Parameters:

env (AbstractEnv) – an instance of the Env class

miv_simulator.utils.io.write_input_cell_selection(env, input_sources, write_selection_file_path, populations=None, write_kwds={})[source]#

Writes out predefined spike trains when only a subset of the network is instantiated.

Parameters:
  • env (AbstractEnv) – an instance of the Env class

  • input_sources – a dictionary of the form { pop_name, gid_sources }

class miv_simulator.utils.io.H5FileManager(directory)[source]#

Bases: object

Utility to manage NeuroH5 simulator files