miv_simulator.stimulus#

Functions

arena_rate_maps_from_features(env, ...[, ...])

Initializes presynaptic spike sources from a file with input selectivity features represented as firing rates.

bin_stimulus_features(features, t, bin_size, ...)

Continuous stimulus feature binning.

choose_input_selectivity_type(p, local_random)

type p:

generate_input_features(env, population, ...)

Generates input features for the given population and returns the selectivity type-specific dictionary provided through argument selectivity_type_namespaces.

generate_input_spike_trains(env, population, ...)

Generates spike trains for the given gid according to the input selectivity rate maps contained in the given selectivity file, and returns a dictionary with spike trains attributes.

generate_linear_trajectory(trajectory[, ...])

Construct coordinate arrays for a spatial trajectory, considering run velocity to interpolate at the specified temporal resolution.

get_2D_arena_bounds(arena[, margin, ...])

type arena:

get_2D_arena_extents(arena)

type arena:

get_2D_arena_grid(arena[, ...])

type arena:

get_2D_arena_spatial_mesh(arena[, ...])

type arena:

get_equilibration(env)

rtype:

Tuple[ndarray, int]

get_input_cell_config(selectivity_type, ...)

type selectivity_type:

uint8

global_oscillation_initial_phases(env, n_trials)

Computes initial oscillatory phases for multiple trials.

global_oscillation_phase_pref(env, ...[, ...])

Computes oscillatory phase preferences for all cells in the given population.

global_oscillation_phase_shift(env, position)

Computes the phase shift of the global oscillatory signal for the given position, assumed to be on the long axis.

oscillation_phase_mod_config(env, ...[, ...])

Obtains phase modulation configuration for a given neuronal population.

rate_maps_from_features(env, population, ...)

Initializes presynaptic spike sources from a file with input selectivity features represented as firing rates.

read_feature(feature_path, ...)

read_stimulus(stimulus_path, ...[, module])

spatial2d_phase_mod(x, y, velocity, ...)

spatial_phase_mod(x, velocity, field_width, ...)

Non-stationary phase modulation for spatial receptive fields.

stationary_phase_mod(t, phase_range, ...)

Computes stationary oscillatory phase modulation with the given parameters.

Classes

ConstantInputCellConfig([selectivity_type, ...])

PhaseModConfig(phase_range, phase_pref, ...)

class miv_simulator.stimulus.PhaseModConfig(phase_range, phase_pref, phase_offset, mod_depth, frequency)#

Bases: tuple

frequency#

Alias for field number 4

mod_depth#

Alias for field number 3

phase_offset#

Alias for field number 2

phase_pref#

Alias for field number 1

phase_range#

Alias for field number 0

miv_simulator.stimulus.get_input_cell_config(selectivity_type, selectivity_type_names, population=None, stimulus_config=None, arena=None, distance=None, local_random=None, selectivity_attr_dict=None, phase_mod_config=None, noise_gen_dict=None, comm=None)[source]#
Parameters:
  • selectivity_type (uint8) – int

  • selectivity_type_names (Dict[int, str]) – dict: {int: str}

  • population (None) – str

  • stimulus_config (None) – dict

  • arena (None) – namedtuple

  • distance (None) – float; u arc distance normalized to reference layer

  • local_random (None) – :class:’np.random.RandomState’

  • selectivity_attr_dict (Optional[Dict[str, ndarray]]) – dict

  • phase_mod_config (None) – dict; oscillatory phase modulation configuration

Return type:

ConstantInputCellConfig

Returns:

instance of one of various InputCell classes

miv_simulator.stimulus.get_2D_arena_bounds(arena, margin=0.0, margin_fraction=None)[source]#
Parameters:

arena – namedtuple

Returns:

tuple of (tuple of float)

miv_simulator.stimulus.get_2D_arena_extents(arena)[source]#
Parameters:

arena – namedtuple

Returns:

tuple of (tuple of float)

miv_simulator.stimulus.get_2D_arena_spatial_mesh(arena, spatial_resolution=5.0, margin=0.0, indexing='ij')[source]#
Parameters:
  • arena – namedtuple

  • spatial_resolution – float (cm)

  • margin – float

Returns:

tuple of array

miv_simulator.stimulus.get_2D_arena_grid(arena, spatial_resolution=5.0, margin=0.0, indexing='ij')[source]#
Parameters:
  • arena – namedtuple

  • spatial_resolution – float (cm)

  • margin – float

Returns:

tuple of array

miv_simulator.stimulus.generate_linear_trajectory(trajectory, temporal_resolution=1.0, equilibration_duration=None)[source]#

Construct coordinate arrays for a spatial trajectory, considering run velocity to interpolate at the specified temporal resolution. Optionally, the trajectory can be prepended with extra distance traveled for a specified network equilibration time, with the intention that the user discards spikes generated during this period before analysis. :type trajectory: :param trajectory: namedtuple :type temporal_resolution: :param temporal_resolution: float (ms) :type equilibration_duration: :param equilibration_duration: float (ms) :return: tuple of array

miv_simulator.stimulus.generate_input_spike_trains(env, population, selectivity_type_names, trajectory, gid, selectivity_attr_dict, spike_train_attr_name='Spike Train', selectivity_type_name=None, spike_hist_resolution=1000, equilibrate=None, phase_mod_config=None, initial_phases=None, spike_hist_sum=None, return_selectivity_features=True, n_trials=1, merge_trials=True, time_range=None, comm=None, seed=None, debug=False)[source]#

Generates spike trains for the given gid according to the input selectivity rate maps contained in the given selectivity file, and returns a dictionary with spike trains attributes.

Parameters:

env (AbstractEnv) –

Return type:

Dict[str, ndarray]

miv_simulator.stimulus.choose_input_selectivity_type(p, local_random)[source]#
Parameters:
  • p – dict: {str: float}

  • local_random – :class:’np.random.RandomState’

Returns:

str

miv_simulator.stimulus.generate_input_features(env, population, arena, arena_x, arena_y, gid, norm_distances, selectivity_type_names, selectivity_type_namespaces, noise_gen_dict=None, rate_map_sum=None, debug=False)[source]#

Generates input features for the given population and returns the selectivity type-specific dictionary provided through argument selectivity_type_namespaces. The set of selectivity attributes is determined by procedure get_selectivity_attr_dict in the respective input cell configuration class (e.g. ConstantInputCellConfig).

:param env :type population: :param population: str :type arena: :param arena: str :type gid: :param gid: int :param distances: (float, float) :type selectivity_type_names: :param selectivity_type_names: :type selectivity_type_namespaces: :param selectivity_type_namespaces: :type debug: :param debug: bool

miv_simulator.stimulus.bin_stimulus_features(features, t, bin_size, time_range)[source]#

Continuous stimulus feature binning.

Parameters:
features: matrix of size “number of times each feature was recorded” x “number of features”
t: a vector of size “number of times each feature was recorded”
bin_size: size of time bins
time_range: the start and end times for binning the stimulus
Returns:
matrix of size “number of time bins” x “number of features in the output”

the average value of each output feature in every time bin

miv_simulator.stimulus.rate_maps_from_features(env, population, cell_index_set, input_features_path=None, input_features_namespace=None, input_features_dict=None, arena_id=None, trajectory_id=None, time_range=None, include_time=False, phase_mod_config=None)[source]#

Initializes presynaptic spike sources from a file with input selectivity features represented as firing rates.

miv_simulator.stimulus.arena_rate_maps_from_features(env, population, input_features_path, input_features_namespace, cell_index_set, arena_id=None, time_range=None, n_trials=1)[source]#

Initializes presynaptic spike sources from a file with input selectivity features represented as firing rates.

miv_simulator.stimulus.oscillation_phase_mod_config(env, population, soma_positions, local_random=None)[source]#

Obtains phase modulation configuration for a given neuronal population.

miv_simulator.stimulus.global_oscillation_phase_shift(env, position)[source]#

Computes the phase shift of the global oscillatory signal for the given position, assumed to be on the long axis. Uses the “Global Oscillation” entry in the input configuration. See global_oscillation_signal for a description of the configuration format.

miv_simulator.stimulus.global_oscillation_phase_pref(env, population, num_cells, local_random=None)[source]#

Computes oscillatory phase preferences for all cells in the given population. Uses the “Global Oscillation” entry in the input configuration. See global_oscillation_signal for a description of the configuration format.

Returns: an array of phase preferences of length equal to the population size.

miv_simulator.stimulus.global_oscillation_initial_phases(env, n_trials, local_random=None)[source]#

Computes initial oscillatory phases for multiple trials. Uses the “Global Oscillation” entry in the input configuration. See global_oscillation_signal for a description of the configuration format.

Returns: an array of phases in radians of length equal to n_trials.

miv_simulator.stimulus.stationary_phase_mod(t, phase_range, phase_pref, phase_offset, mod_depth, freq)[source]#

Computes stationary oscillatory phase modulation with the given parameters.

miv_simulator.stimulus.spatial_phase_mod(x, velocity, field_width, phase_range, phase_entry, phase_offset, mod_depth, freq)[source]#

Non-stationary phase modulation for spatial receptive fields. Calculates modulation according to the equation:

s = cos(r*x/field_width + 2*pi*freq*x/velocity - phase_entry - phase_offset + r/2.) + 1 mod = s*mod_depth/2. + (1. - mod_depth)

  • position: spatial position

  • velocity: movement velocity

  • field_width: receptive field

  • phase_range: range of preferred phase

  • phase_entry: receptive field entry phase

  • mod_depth: modulation depth

  • freq: frequency of global oscillation