snnlab
API referencesnnlab.sim

snnlab.sim.scan

Complete declared API of the scan module, with signatures, data fields, validation and source.

Back to sim reference

Scan-mode utilities.

Provides shared utilities for scanning parameters and recording-key resolution.

The signatures, defaults, fields, docstrings and implementation excerpts below are generated from the Python source. Annotations are shown as declared; unannotated means the source supplies no type annotation. These pages document callable surfaces, including legacy support utilities, without promising backend support for every declaration.

SymbolKind
primary_hid_keyfunction
primary_inh_keyfunction

primary_hid_key

View source

def primary_hid_key(rec)

Source docstring:

Return the recording key for the deepest hidden layer.

WHY: Multi-layer networks record each layer separately ('hid_0', 'hid_1', etc.).
For analysis, we typically care about the DEEPEST/FINAL hidden layer
(the one with the most relevant representation before readout).

Returns:
    str: Recording key for the deepest excitatory layer.
         Single-layer models: 'hid'
         Multi-layer models: 'hid_1' (layer 1 is the deepest; layer 0 is input→hid_0)
         Networks with no hidden layer: 'hid' (default fallback)

Args:
    rec: Recording dict from network.spike_record
ParameterAnnotationDefaultMeaning
recunannotatedrequiredDefined by the source contract and implementation below.

Return expressions (branch-dependent; names refer to the linked implementation):

hid_keys[-1] if hid_keys else 'hid'
Implementation
def primary_hid_key(rec):
    """Return the recording key for the deepest hidden layer.

    WHY: Multi-layer networks record each layer separately ('hid_0', 'hid_1', etc.).
    For analysis, we typically care about the DEEPEST/FINAL hidden layer
    (the one with the most relevant representation before readout).

    Returns:
        str: Recording key for the deepest excitatory layer.
             Single-layer models: 'hid'
             Multi-layer models: 'hid_1' (layer 1 is the deepest; layer 0 is input→hid_0)
             Networks with no hidden layer: 'hid' (default fallback)

    Args:
        rec: Recording dict from network.spike_record
    """
    hid_keys = sorted(k for k in rec if k.startswith("hid"))
    return hid_keys[-1] if hid_keys else "hid"

primary_inh_key

View source

def primary_inh_key(rec)

Source docstring:

Return the recording key for the deepest inhibitory layer, or None if no inhibition.

WHY: Like primary_hid_key, but for inhibitory spikes. Networks without E-I
structure return None (e.g., standard feedforward networks).

Returns:
    str or None: Recording key for the deepest inhibitory layer (e.g. 'inh', 'inh_1'),
                 or None if the network doesn't have inhibitory populations.

Args:
    rec: Recording dict from network.spike_record
ParameterAnnotationDefaultMeaning
recunannotatedrequiredDefined by the source contract and implementation below.

Return expressions (branch-dependent; names refer to the linked implementation):

inh_keys[-1] if inh_keys else None
Implementation
def primary_inh_key(rec):
    """Return the recording key for the deepest inhibitory layer, or None if no inhibition.

    WHY: Like primary_hid_key, but for inhibitory spikes. Networks without E-I
    structure return None (e.g., standard feedforward networks).

    Returns:
        str or None: Recording key for the deepest inhibitory layer (e.g. 'inh', 'inh_1'),
                     or None if the network doesn't have inhibitory populations.

    Args:
        rec: Recording dict from network.spike_record
    """
    inh_keys = sorted(k for k in rec if k.startswith("inh"))
    return inh_keys[-1] if inh_keys else None

Constants and type aliases

Initial source expressions are shown, not evaluated runtime values. Legacy configuration may mutate module defaults.

NameAnnotationInitial expressionSource
logunannotatedlogging.getLogger('cli')Source

On this page