bmtk.simulator.dpointnet.loss_functions package#

Submodules#

bmtk.simulator.dpointnet.loss_functions.loss_utils module#

bmtk.simulator.dpointnet.loss_functions.loss_utils.compute_spike_rate_distribution_loss(_rates, target_rate, dtype=tensorflow.float32)[source]#
bmtk.simulator.dpointnet.loss_functions.loss_utils.compute_spike_rate_target_loss(rates, target_rates, dtype=tensorflow.float32)[source]#
bmtk.simulator.dpointnet.loss_functions.loss_utils.get_pop_names(network, core_radius=None, n_selected_neurons=None, data_dir='', return_node_type_ids=False)[source]#
bmtk.simulator.dpointnet.loss_functions.loss_utils.get_population_neuron_ids(network, data_dir='GLIF_network', core_mask=None, reindex_selected=False)[source]#
bmtk.simulator.dpointnet.loss_functions.loss_utils.get_tuning_angles(network, data_dir='')[source]#

Per-neuron preferred orientation (degrees) in the model’s node order.

Mirrors get_pop_names’ data_dir resolution and isolate_core_neurons’ native-order handling: dpointnet keeps the SONATA file order (no ‘tf_id_to_bmtk_id’ reindexing), so the file order is the model order unless the reference reordering map is present.

bmtk.simulator.dpointnet.loss_functions.loss_utils.huber_quantile_loss(u, tau, kappa, dtype=tensorflow.float32)[source]#
bmtk.simulator.dpointnet.loss_functions.loss_utils.isolate_core_neurons(network, radius=None, n_selected_neurons=None, data_dir='GLIF_network')[source]#
bmtk.simulator.dpointnet.loss_functions.loss_utils.neuropixels_cell_type_to_cell_type(pop_name)[source]#
bmtk.simulator.dpointnet.loss_functions.loss_utils.pop_name_to_cell_type(pop_name, ignore_l5e_subtypes=False)[source]#

convert pop_name in the old format to cell types. for example, ‘e4Rorb’ -> ‘L4 Exc’ ‘i4Pvalb’ -> ‘L4 PV’ ‘i23Sst’ -> ‘L2/3 SST’ ‘e5ET’ -> ‘L5 ET’

bmtk.simulator.dpointnet.loss_functions.loss_utils.process_neuropixels_data(path='')[source]#
bmtk.simulator.dpointnet.loss_functions.loss_utils.resolve_core_mask(network, core_mask=None, core_radius=None, data_dir='GLIF_network')[source]#

Resolve a boolean core mask for a loss function.

If an explicit core_mask is given it is used as-is. Otherwise, if a core_radius is given, the central-core mask is computed from neuron positions (sqrt(x^2+z^2)<radius), matching the reference V1_GLIF_model’s loss_core_radius. Returns None if neither is provided (loss applies to all neurons).

bmtk.simulator.dpointnet.loss_functions.loss_utils.sample_firing_rates(firing_rates, n_neurons, rnd_seed)[source]#
bmtk.simulator.dpointnet.loss_functions.loss_utils.spike_trimming(spikes, pre_delay=50, post_delay=50, trim=True)[source]#

bmtk.simulator.dpointnet.loss_functions.orientation_selectivity_loss module#

class bmtk.simulator.dpointnet.loss_functions.orientation_selectivity_loss.OrientationSelectivityLoss(rnn, osi_cost=20.0, pre_delay=None, post_delay=None, dtype=tensorflow.float32, core_mask=None, method='crowd_osi', subtraction_ratio=1.0, layer_info=None, data_dir='GLIF_network', neuropixels_df='Neuropixels_data/v1_OSI_DSI_DF.csv', ema_decay=0.95, use_ema_normalizer=True, annulus_loss_weight=0.0, **kwargs)[source]#

Bases: object

calculate_delta_angle(stim_angle, tuning_angle)[source]#
crowd_osi_loss(spikes, angle, normalizer=None, batch_size_hint=None)[source]#
crowd_spikes_loss(spikes, angle)[source]#
get_neuropixels_osi_dsi(selection_mask=None)[source]#

Processes neuropixels data to obtain neurons average firing rates.

Returns:

dict: Dictionary containing rates and node_type_ids for each population query.

static module()[source]#
update_normalizers(spikes, normalizers, trim=True)[source]#
property uses_ema_normalizer#

bmtk.simulator.dpointnet.loss_functions.spike_rate_distribution_target module#

class bmtk.simulator.dpointnet.loss_functions.spike_rate_distribution_target.SpikeRateDistributionTarget(rnn, stimulus_type='drifting_gratings', rate_cost=0.5, pre_delay=None, post_delay=None, data_dir='GLIF_network', core_mask=None, rates_dampening=1.0, seed=42, dtype=tensorflow.float32, neuropixels_df=None, annulus_loss_weight=0.0, **kwargs)[source]#

Bases: object

get_neuropixels_firing_rates(core_mask=None)[source]#

Processes neuropixels data to obtain neurons average firing rates.

Returns:

dict: Dictionary containing rates and node_type_ids for each population query.

static module()[source]#

bmtk.simulator.dpointnet.loss_functions.synchronization_loss module#

class bmtk.simulator.dpointnet.loss_functions.synchronization_loss.SynchronizationLoss(*args: Any, **kwargs: Any)[source]#

Bases: Layer

static module()[source]#
pop_fano_tf(spikes)[source]#

bmtk.simulator.dpointnet.loss_functions.target_firing_rates module#

class bmtk.simulator.dpointnet.loss_functions.target_firing_rates.TargetFiringRate(rnn, firing_rate, **kwargs)[source]#

Bases: object

static module()[source]#
bmtk.simulator.dpointnet.loss_functions.target_firing_rates.compute_spike_rate_distribution_loss(_rates, target_rate, dtype=tensorflow.float32)[source]#
bmtk.simulator.dpointnet.loss_functions.target_firing_rates.huber_quantile_loss(u, tau, kappa, dtype=tensorflow.float32)[source]#

bmtk.simulator.dpointnet.loss_functions.voltage_regularization module#

class bmtk.simulator.dpointnet.loss_functions.voltage_regularization.VoltageRegularization(rnn, voltage_cost=1e-05, dtype=tensorflow.float32, core_mask=None, penalty_mode='range', **kwargs)[source]#

Bases: object

static module()[source]#

bmtk.simulator.dpointnet.loss_functions.weight_regularization module#

class bmtk.simulator.dpointnet.loss_functions.weight_regularization.EMDWeightRegularization(rnn, cost=10.0, data_dir='', dtype=None, **kwargs)[source]#

Bases: object

Earth Mover’s Distance (Wasserstein-1) regularizer on the recurrent weights.

Penalizes the per-connection-type EMD between the current and initial recurrent synaptic weight distributions, averaged over all connection types. Because the initial distribution is captured at construction, the loss is exactly 0 at init. Ported from V1_GLIF_model loss_functions.EarthMoversDistanceRegularizer.

static module()[source]#

Module contents#

class bmtk.simulator.dpointnet.loss_functions.LossModules(*args, **kwargs)[source]#

Bases: object

add_module(module_cls, module_name=None, overwrite=True)[source]#
get_module(module_name)[source]#
bmtk.simulator.dpointnet.loss_functions.add_loss_module(mod, module_name=None, overwrite=True)[source]#
bmtk.simulator.dpointnet.loss_functions.register_loss_module(_cls=None, *_, **wkargs)[source]#