Complete API Reference¶
All 231 core functions, classes, and constants exported in the top-level jnwb namespace.
Generated from
jnwb.__all__,inspect.signature, and runtime docstrings. Do not edit by hand — runpython scripts/generate_api_md.py --write.
Module: jnwb¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.CANONICAL_BANDS | constant | dict |
| jnwb.DB_AGGREGATIONS | constant | tuple |
| jnwb.DETECTION_TAILS | constant | tuple |
| jnwb.LAYERS | constant | tuple |
| jnwb.RELATIVE_POWER_MODELS | constant | tuple |
| jnwb.SKILLS_URL | constant | str |
| jnwb.io | module | Streaming array slice reader for NPZ archives without full-file RAM allocation. |
| jnwb.paths | module | Central path resolution for jnwb. |
| jnwb.vis | module | jnwb.vis -- Publication-grade electrophysiology visualization engine in pure Plotly. |
| jnwb.visual_qc | module | Visual quality control and multi-session inspection. |
Module: jnwb.addressing¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.ProbeGeometry | class | Extracted contact geometry and spatial properties for an electrode array. |
| jnwb.classify_layer_from_depth | function | (peak_channel_id: float, electrodes_df: pandas.DataFrame, *, depth_unit: str | None = None, threshold: float | None = None, threshold_unit: str | None = None, depth_axis: str | None = None, shallow_end: str | None = None) -> strClassify a unit's geometric depth class from electrode z depth. |
| jnwb.enrich_units_dataframe | function | (units_df: pandas.DataFrame, electrodes_df: pandas.DataFrame | None, *, depth_unit: str | None = None, threshold: float | None = None, threshold_unit: str | None = None, depth_axis: str | None = None, shallow_end: str | None = None, stable_threshold: float = 1.0, stable_labels: Collection[str] = ('good', 'sua', 'single', 'stable', 'clean')) -> pandas.DataFrameEnrich units DataFrame with standardized area, depth class, and quality flags. |
| jnwb.map_peak_channel_to_area | function | (peak_channel_id: float, electrodes_df: pandas.DataFrame) -> str | NoneMap peak channel ID to brain area location. |
| jnwb.probe_geometry | function | (electrodes_table: typing.Any, *, probe_name: str | None = None, units: str = 'um', nominal_pitch: float | None = None, pitch_tolerance: float = 0.1, strict_linear: bool = False, stagger_tolerance_um: float = 100.0) -> jnwb.addressing.ProbeGeometryExtract contact geometry, linear ordering, and spacing from electrode coordinates. |
Module: jnwb.analyzers¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.PopulationAnalyzer | class | Population-Level Statistics. |
| jnwb.TFRAnalyzer | class | Time-Frequency Representation Analysis. |
| jnwb.UnitAnalyzer | class | Single-Unit Spike Analysis. |
Module: jnwb.artifact_detection¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.bad_channels_from_correlation | function | (corr: 'np.ndarray', z_thresh: 'float' = 5.0) -> 'Tuple[np.ndarray, np.ndarray, np.ndarray]'corr: (n_ch, n_ch). Returns (bad_mask, summary_per_channel, z_per_channel). |
| jnwb.bad_trials_single_channel | function | (trial_waveforms: 'np.ndarray', corr_z_thresh: 'float' = 5.0, amp_z_thresh: 'float' = 5.0) -> 'Tuple[np.ndarray, np.ndarray, np.ndarray]'trial_waveforms: (n_trials, n_times), single GOOD channel. |
| jnwb.channel_correlation_matrix | function | (data_ch_by_time: 'np.ndarray') -> 'np.ndarray'data_ch_by_time: (n_channels, n_samples). Returns (n_channels, n_channels) Pearson corr. |
| jnwb.consensus_bad_trials | function | (per_channel_flags: 'np.ndarray', min_frac_channels: 'float' = 0.5) -> 'Tuple[np.ndarray, np.ndarray]'per_channel_flags: (n_good_channels, n_trials) bool. A trial is excluded only if flagged on at least min_frac_channels of the good channels independently -- the cross-channel- consensus requirement (real artifacts are shared events, not one channel's quirk). |
| jnwb.trial_correlation_matrix | function | (trial_waveforms: 'np.ndarray') -> 'np.ndarray'trial_waveforms: (n_trials, n_times), single channel. Returns (n_trials, n_trials) corr. |
Module: jnwb.artifact_repair¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.detect_band_outliers | function | (band_trace, z_thresh = 6.0, sided = 'upper')Flag (trial, time) cells whose power departs from the cross-trial trend. |
| jnwb.repair_band_artifacts | function | (power, freqs, band_ranges = None, z_thresh = 6.0, sided = 'upper')Per-band, cross-trial-median substitution of sparse single-trial TFR power spikes. |
| jnwb.repair_lfp_trials | function | (segments, times_ms = None, z_thresh = 6.0, exclude_window_ms = None, reward_window_ms = None, min_trials = 5, max_trial_fraction = 0.5)Cross-channel-synchrony detection + cross-trial-median substitution. |
Module: jnwb.compression¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.compress_fp32 | function | (src: "'str | Path'", dst: "'str | Path | None'" = None, *, drop_convolved: 'bool' = False, verify: 'bool' = True, n_check: 'int' = 200000, overwrite: 'bool' = False, select: "'list[str]'") -> 'dict'Compress one NWB file: cast the select= datasets to float32, chunk, gzip1+shuffle, compact. |
Module: jnwb.connectivity¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.DirectedResult | class | Uniform return type for every directed connectivity estimator. |
| jnwb.as_trials | function | (X, time_axis: 'int' = -1, name: 'str' = 'X', allow_ragged: 'bool' = True) -> 'np.ndarray'Normalize any supported signal container to a (n_trials, n_times) float array. |
| jnwb.bin_spikes | function | (spike_times, window_s: 'Optional[Tuple[float, float]]' = None, bin_size_ms: 'float' = 10.0, trial_starts: 'Optional[Sequence[float]]' = None, output: 'str' = 'count', return_centers: 'bool' = False, *, window: 'Optional[Tuple[float, float]]' = None)Bridge spike data into the (n_trials, n_bins) contract used by every estimator. |
| jnwb.directed_connectivity | function | (X, Y, method: 'str' = 'granger', **kwargs) -> 'DirectedResult'One entry point for every estimator in DIRECTED_METHODS. |
| jnwb.directed_network | function | (signals, method: 'str' = 'granger', labels: 'Optional[Sequence[str]]' = None, fdr: 'bool' = True, fdr_method: 'str' = 'bh', n_jobs: 'int' = 1, *, conditional: 'bool' = False, signal_class: 'str' = _OMITTED, **kwargs) -> 'Dict[str, Any]'All-pairs directed connectivity over N nodes. |
| jnwb.granger | function | (X, Y, order: 'Union[int, str]' = 'auto', max_lag: 'int' = 20, criterion: 'str' = 'bic', Z = None, ridge: 'float' = 0.0, detrend: 'Optional[str]' = 'zscore', n_surrogates: 'int' = 0, rng: 'RNGLike' = 0, time_axis: 'int' = -1, *, signal_class: 'Union[str, Tuple[str, str]]' = _OMITTED, seed: 'Any' = 0, device: 'str' = 'cpu') -> 'DirectedResult'Bivariate or conditional Granger causality between two arbitrary signals. |
| jnwb.granger_nonparametric | function | (X, Y, *, fs: 'float', bands, n_freqs: 'int' = 256, n_surrogates: 'int' = 0, rng: 'RNGLike' = 0, detrend: 'Optional[str]' = 'zscore', time_axis: 'int' = -1, seed: 'Any' = 0) -> 'DirectedResult'Frequency-resolved Granger causality by spectral factorization, with no fitted model. |
| jnwb.granger_spectral | function | (X, Y, fs: 'float', order: 'Union[int, str]' = 'auto', max_lag: 'int' = 20, criterion: 'str' = 'bic', n_freqs: 'int' = 256, bands: 'Union[str, Dict[str, Tuple[float, float]], Tuple[float, float], None]' = None, ridge: 'float' = 0.0, detrend: 'Optional[str]' = 'zscore', n_surrogates: 'int' = 0, rng: 'RNGLike' = 0, time_axis: 'int' = -1, *, signal_class: 'Union[str, Tuple[str, str]]' = _OMITTED, seed: 'Any' = 0) -> 'DirectedResult'Frequency-resolved Granger causality (Geweke, 1982) — directionality per band. |
| jnwb.granger_time_reversed | function | (X, Y, *, order: 'int', n_surrogates: 'int' = 0, rng: 'RNGLike' = 0, detrend: 'Optional[str]' = 'zscore', time_axis: 'int' = -1, signal_class: 'Union[str, Tuple[str, str]]' = _OMITTED, seed: 'Any' = 0) -> 'DirectedResult'Time-reversed Granger control: a directed claim needs the net flow to change sign under reversal. |
| jnwb.network_topology | function | (adjacency_matrix: 'np.ndarray', threshold: 'float' = 0.3) -> 'Dict[str, Union[float, int, List[int]]]'Compute network graph metrics from a correlation or Granger causality matrix. |
| jnwb.phase_slope_index | function | (X, Y, fs: 'float', bands: 'Union[str, Dict[str, Tuple[float, float]], Tuple[float, float], None]' = None, nperseg: 'Optional[int]' = None, noverlap: 'Optional[int]' = None, window: 'str' = 'hann', detrend: 'Optional[str]' = 'demean', jackknife: 'bool' = True, n_surrogates: 'int' = 0, rng: 'RNGLike' = 0, time_axis: 'int' = -1, *, signal_class: 'Union[str, Tuple[str, str]]' = _OMITTED, seed: 'Any' = 0) -> 'DirectedResult'Phase Slope Index (Nolte et al., 2008) — which signal leads in phase. |
| jnwb.spike_mutual_information | function | (spike_times1: 'np.ndarray', spike_times2: 'np.ndarray', time_window_s: 'Optional[Tuple[float, float]]' = None, bin_size_ms: 'float' = 10.0, estimator: 'str' = 'binary_occupancy', *, time_window: 'Optional[Tuple[float, float]]' = None) -> 'float'Compute Shannon Mutual Information (MI) between two binned spike trains. |
| jnwb.transfer_entropy | function | (X, Y, k: 'int' = 1, l: 'int' = 1, delay: 'int' = 1, estimator: 'str' = 'quantile', bins: 'int' = 4, symbolic_order: 'int' = 3, bias_correction: 'Optional[str]' = 'mm', n_surrogates: 'int' = 200, rng: 'RNGLike' = 0, detrend: 'Optional[str]' = None, time_axis: 'int' = -1, *, signal_class: 'Union[str, Tuple[str, str]]' = _OMITTED, seed: 'Any' = 0) -> 'DirectedResult'Transfer entropy — model-free, nonlinear, directed predictive information, in bits. |
Module: jnwb.continuous¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.EffectiveRate | class | Evidence on the rate a stream was sampled at, returned by effective_rate. |
| jnwb.TickClock | class | Map from timestamp ticks to seconds on a spike clock, built by derive_tick_clock. |
| jnwb.derive_tick_clock | function | (tick_segments: 'Sequence[np.ndarray]', spike_times) -> 'TickClock'Derive the map from acquisition ticks to spike-clock seconds from one recording. |
| jnwb.effective_rate | function | (data: 'np.ndarray | Sequence[float]', rate: 'float') -> 'EffectiveRate'Measure whether a stream repeats samples as if it were held from a lower rate. |
| jnwb.epoch_continuous | function | (data: 'np.ndarray', onsets: 'np.ndarray | Sequence[float]', *, win_s: 'tuple[float, float]', fs: 'float', start_s: 'float' = 0.0, onset_unit: 'OnsetUnit' = 'seconds', boundary_policy: 'BoundaryPolicy' = 'nan', return_indices: 'bool' = False) -> 'tuple[np.ndarray, np.ndarray] | tuple[np.ndarray, np.ndarray, np.ndarray]'Extract fixed-duration epochs from a continuous signal aligned to event onsets. |
| jnwb.gaze_departure_onsets | function | (gaze: 'np.ndarray | Sequence[float]', rate: 'float', trial_starts: 'np.ndarray | Sequence[float]', *, baseline_window_s: 'tuple[float, float]', reference_trials: 'np.ndarray | Sequence[int]', envelope_percentile: 'float' = 99.5, hold_s: 'float' = 0.025, walkback_fraction: 'float' = 0.5) -> 'np.ndarray'Find, per trial, the time the gaze leaves its baseline position. |
Module: jnwb.decoding¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.assign_outer_folds | function | (trials: 'pd.DataFrame', *, analysis_cols: 'tuple' = ('session', 'analysis', 'slot_key'), group_col: 'str' = 'cycle') -> 'pd.DataFrame'Assign deterministic leave-one-group-out outer folds without touching features. |
| jnwb.build_inner_validation_partitions | function | (outer_trials: 'pd.DataFrame', *, analysis_cols: 'tuple' = ('session', 'analysis', 'slot_key')) -> 'pd.DataFrame'Build nested inner train/validation partitions from outer-training groups. |
| jnwb.build_representation_ladder | function | (raster: 'np.ndarray', *, modality: 'str' = 'SPK', spatial_axis_metadata: 'Union[Mapping[str, object], None]' = None) -> 'Dict[str, object]'Return R0/R1/R2 representation contracts without fitting a model. |
| jnwb.fold_majority_baseline | function | (y_train: 'np.ndarray', y_test: 'np.ndarray') -> 'float'Accuracy of predicting the training-fold majority class on the held-out fold. |
| jnwb.majority_baseline | function | (labels: 'np.ndarray') -> 'float'Accuracy of always predicting the most frequent class in labels. |
| jnwb.nested_cv_linear_svm | function | (X: 'np.ndarray', labels: 'np.ndarray', n_splits: 'int', rng: 'RNGLike' = 42, *, groups: 'Union[np.ndarray, None]' = None) -> 'Dict[str, Union[float, np.ndarray, dict, str]]'Outer stratified CV; inner GridSearchCV for C. No synthetic metrics. |
Module: jnwb.execution¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.ExecutionRecord | class | What ran where, recorded by the caller. |
| jnwb.cache_clear | function | (cache_dir: 'str | Path') -> 'int'Remove the entries cache_store wrote directly under cache_dir; return the count. |
| jnwb.cache_key | function | (name: 'str', inputs: 'Any', params: 'dict') -> 'str'A hex key from the operation name, the inputs, the parameters and the version. |
| jnwb.cache_load | function | (cache_dir: 'str | Path', key: 'str') -> 'Any'The value stored under key in cache_dir, or None on a miss. |
| jnwb.cache_store | function | (cache_dir: 'str | Path', key: 'str', value: 'Any') -> 'Path'Save value under key in cache_dir and return the file path. |
Module: jnwb.filtering¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.bandpass_filter | function | (data: 'np.ndarray', fs: 'float', low_cut: 'float', high_cut: 'float', order: 'int' = 4, zero_phase: 'bool' = True, axis: 'int' = -1) -> 'np.ndarray'Apply a Butterworth bandpass filter using Second-Order Sections (SOS). |
| jnwb.notch_filter | function | (data: 'np.ndarray', fs: 'float', freq: 'float' = 60.0, q: 'float' = 30.0, zero_phase: 'bool' = True, axis: 'int' = -1) -> 'np.ndarray'Apply an IIR notch filter using Second-Order Sections (SOS) conversion. |
Module: jnwb.io¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.stream_npz_array | function | (file_path: 'Union[str, Path]', key: 'str', slice_tuple: 'Union[slice, int, Tuple[Union[slice, int], ...]]' = (slice(None, None, None),)) -> 'np.ndarray'Stream a memory-bounded slice from an uncompressed or compressed NPZ archive. |
Module: jnwb.jrsa¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.JRSAResult | class | Container returned by jrsa(). |
| jnwb.jrsa | function | (x1, x2 = None, adim = -1, labels = None, align = 'auto', reduction = None, metric = 'rsa', lag = 0, window = None, sliding = False, step = None, normalize = False, standardize = False, detrend = False, nan_policy = 'omit', stats = True, permutations = 1000, bootstrap = 0, correction = 'fdr_bh', alpha = 0.05, alternative = 'two-sided', null = None, block_len = None, backend = 'auto', device = 'auto', n_jobs = 1, batch_size = None, rng: 'RNGLike' = None, return_type = 'result', return_null = False, return_input = False, verbose = False, **kwargs) -> 'JRSAResult'Unified representational similarity / cross-area analysis. |
Module: jnwb.laminar¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.VFlip2Result | class | The best channel window vFLIP2 found, and whether its omega clears the cut. |
| jnwb.VFlipResult | class | Container for Vectorized Frequency-based Laminar Identity Profile (vFLIP) results. |
| jnwb.XFlipResult | class | Container for Cross-Channel Laminar Correlation Profile (xFLIP) results. |
| jnwb.ZFlipResult | class | Container for zFLIP Cortical Depth Phase-Gradient & Delay Estimation results. |
| jnwb.label_layers | function | (vflip_result: 'VFlipResult', probe_geometry: 'Any', *, granular_thickness_um: 'float' = 400.0, bad_channel_mask: 'Optional[np.ndarray]' = None, depth_range_um: 'Optional[Tuple[float, float]]' = None, contact_range: 'Optional[Tuple[float, float]]' = None, depth_axis: 'Optional[str]' = None, shallow_end: 'Optional[str]' = None) -> 'Dict[Any, str]'Assign cortical layer labels (superficial, input, deep) to probe contacts. |
| jnwb.vflip | function | (psd: 'np.ndarray', freqs: 'np.ndarray', *, band_low: 'Tuple[float, float]' = (8.0, 30.0), band_high: 'Tuple[float, float]' = (50.0, 150.0), contact_spacing: 'Optional[float]' = None, probe_geometry: 'Optional[Any]' = None, orientation: 'str' = 'auto', min_support_score: 'float' = 3.75, bad_channel_mask: 'Optional[np.ndarray]' = None, min_channels: 'int' = 8, min_peak_distance: 'int' = 2, device: 'str' = 'cpu', depth_axis: 'Optional[str]' = None, shallow_end: 'Optional[str]' = None) -> 'VFlipResult'Vectorized Frequency-based Laminar Identity Profile (vFLIP). |
| jnwb.vflip2 | function | (psd: 'np.ndarray', freqs: 'np.ndarray', *, contact_spacing: 'float', orientation: 'str' = 'both', layer4_thickness_mm: 'Optional[float]' = None, omega_cut: 'float' = 6.0) -> 'VFlip2Result'vFLIP2, the spectrolaminar estimator of Major et al. (2025), ported from vFLIP2.m. |
| jnwb.vflip2_from_lfp | function | (lfp, fs: 'float', *, contact_spacing: 'float', orientation: 'str' = 'both', layer4_thickness_mm: 'Optional[float]' = None, omega_cut: 'float' = 6.0) -> 'VFlip2Result'vFLIP2 on LFP: vFLIP2.m's Hanning-window PSD, then :func: vflip2 on it. |
| jnwb.vflip_from_lfp | function | (lfp: 'np.ndarray', fs: 'float', *, nperseg: 'Optional[int]' = None, noverlap: 'Optional[int]' = None, window: 'str' = 'hann', detrend: 'Union[str, bool]' = 'constant', scaling: 'str' = 'density', band_low: 'Tuple[float, float]' = (8.0, 30.0), band_high: 'Tuple[float, float]' = (50.0, 150.0), contact_spacing: 'Optional[float]' = None, probe_geometry: 'Optional[Any]' = None, orientation: 'str' = 'auto', min_support_score: 'float' = 3.75, bad_channel_mask: 'Optional[np.ndarray]' = None, min_channels: 'int' = 8, min_peak_distance: 'int' = 2, device: 'str' = 'cpu', depth_axis: 'Optional[str]' = None, shallow_end: 'Optional[str]' = None) -> 'VFlipResult'Vectorized Frequency-based Laminar Identity Profile from raw LFP time series. |
| jnwb.xflip | function | (data: 'np.ndarray', *, method: 'str' = 'pearson', contiguous: 'bool' = True, n_blocks: 'Optional[int]' = 2, min_block_size: 'Optional[int]' = None, n_surrogates: 'int' = 200, surrogate_method: 'str' = 'auto', alpha: 'float' = 0.05, min_contrast: 'float' = 0.05, min_boundary_drop: 'float' = 0.05, channel_axis: 'int' = 0, is_corr_matrix: 'Optional[bool]' = None, n_samples: 'Optional[int]' = None, rng: 'Optional[Union[np.random.Generator, int]]' = None, window: 'Optional[Union[VFlip2Result, Tuple[int, int]]]' = None, contact_spacing: 'Optional[float]' = None, layer4_thickness_mm: 'Optional[float]' = None) -> 'XFlipResult'Cross-Channel Laminar Correlation Profile (xFLIP). |
| jnwb.zflip | function | (lfp_matrix: 'np.ndarray', fs: 'float', *, orientation: 'Union[str, VFlip2Result]', window: 'Union[VFlip2Result, Tuple[int, int], None]' = None, freq_range: 'Tuple[float, float]' = (15.0, 35.0), pitch_um: 'Optional[float]' = None, nperseg: 'Optional[int]' = None, noverlap: 'Optional[int]' = None, min_linearity_r2: 'float' = 0.7, min_wpli: 'float' = 0.15, min_band_power_fraction: 'float' = 0.01, n_surrogates: 'int' = 50, alpha: 'float' = 0.05, rng: 'RNGLike' = 0, seed: 'Any' = 0) -> 'ZFlipResult'Estimate depth phase gradients, and an apparent phase delay and velocity only where phase is linear in frequency. |
Module: jnwb.laminar_curation¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.LaminarCurationResult | class | Result of :func:curate_and_label. |
| jnwb.curate_and_label | function | (lfp: 'np.ndarray', fs: 'float', *, pitch_um: 'float', erp: 'Optional[np.ndarray]' = None, erp_times_ms: 'Optional[np.ndarray]' = None, n_windows: 'int' = 4, band_low_hz: 'Tuple[float, float]' = (10.0, 19.0), band_high_hz: 'Tuple[float, float]' = (75.0, 150.0), granular_thickness_um: 'float' = 400.0, max_superficial_um: 'float' = 1200.0, max_deep_um: 'float' = 1600.0, silent_threshold: 'float' = 0.12, smooth_um: 'float' = 50.0, min_lobe_um: 'float' = 150.0, min_lobe_amplitude: 'float' = 0.2, bad_zone_contacts: 'int' = 6, bad_zone_fraction: 'float' = 0.6, edge_fraction: 'float' = 0.1, edge_jump_z: 'float' = 6.0, stable_sd_um: 'float' = 75.0, min_ok_windows: 'int' = 3, consistency_a: 'float' = 0.75, consistency_b: 'float' = 0.6, compute_xflip: 'bool' = True, xflip_n_surrogates: 'int' = 50, xflip_n_blocks: 'Optional[int]' = None, rng: 'RNGLike' = 42, max_interpolate_run: 'int' = 3, min_contacts: 'int' = 8, min_edge_contacts: 'int' = 11, nperseg: 'int' = 512, **bad_channel_kwargs: 'Any') -> 'LaminarCurationResult'Curate a laminar LFP recording and label every contact by cortical compartment. |
| jnwb.detect_bad_channels | function | (data: 'np.ndarray', fs: 'float', *, neighbor_contacts: 'int' = 2, min_neighbor_corr_z: 'float' = -4.0, max_power_z: 'float' = 5.0, power_band_hz: 'Tuple[float, float]' = (1.0, 150.0), correlation_fs_hz: 'float' = 100.0, max_iterations: 'int' = 4, nperseg: 'int' = 512) -> 'Dict[str, Any]'Flag contacts that decorrelate from their neighbors or have outlying power. |
| jnwb.evoked_csd_sink | function | (erp: 'np.ndarray', times_ms: 'np.ndarray', *, pitch_um: 'float', usable_mask: 'Optional[np.ndarray]' = None, smooth_um: 'float' = 50.0, sink_window_ms: 'Tuple[float, float]' = (40.0, 150.0), min_sink_z: 'float' = 3.0, onset_z: 'float' = 3.0, onset_min_duration_ms: 'float' = 5.0, onset_earliest_ms: 'float' = 25.0, min_contacts: 'int' = 8) -> 'Dict[str, Any]'Locate the evoked current-source-density sink along the shaft. |
| jnwb.fuse_laminar_anchors | function | (*, vflip_um: 'Optional[float]' = None, vflip2_um: 'Optional[float]' = None, motif_um: 'Optional[float]' = None, xflip_um: 'Optional[float]' = None, csd_um: 'Optional[float]' = None, window_um: 'Optional[np.ndarray]' = None, consistency_deep: 'float' = nan, consistency_superficial: 'float' = nan, stable_sd_um: 'float' = 75.0, min_ok_windows: 'int' = 3, consistency_a: 'float' = 0.75, consistency_b: 'float' = 0.6, contact_spacing_um: 'Optional[float]' = None) -> 'Dict[str, Any]'Choose the laminar anchor and grade it; report how the other estimates sit against it. |
| jnwb.interpolate_channel_runs | function | (data: 'np.ndarray', bad_mask: 'np.ndarray', *, max_run: 'int' = 3, blocked_mask: 'Optional[np.ndarray]' = None) -> 'Dict[str, Any]'Linearly interpolate runs of at most max_run adjacent bad contacts. |
| jnwb.map_peak_channel_to_layer | function | (units_df: 'pd.DataFrame', curation: 'LaminarCurationResult', channel_ids: 'Sequence') -> 'np.ndarray'One curated layer label per unit: the label of the unit's peak channel. |
Module: jnwb.metadata¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.assign_quality_tier | function | (quality: pandas.Series, trial_presence_fraction: pandas.Series, snr: pandas.Series, presence_threshold: float = 0.98, snr_threshold: float = 0.5, *, stable_threshold: float = 1.0, stable_labels: Collection[str] = ('good', 'sua', 'single', 'stable', 'clean')) -> pandas.SeriesTier units 'mua' / 'stable' / 'unstable' / 'unknown' from quality, presence and SNR. |
| jnwb.audit_electrodes | function | (elec_df: pandas.DataFrame, units_df: pandas.DataFrame | None = None) -> DictAudit electrode configuration and unit-to-electrode mapping coverage. |
| jnwb.audit_units | function | (units_df: pandas.DataFrame, *, quality_threshold: float = 1.0, snr_threshold: float = 1.0, stable_labels: Collection[str] = ('good',)) -> DictAudit unit quality and completeness: spike-time coverage, and quality/SNR/firing-rate summary statistics. |
| jnwb.classify_unit_quality | function | (units_df: pandas.DataFrame, thresholds: Dict[str, float] | None = None) -> pandas.DataFrameClassify units by quality based on metrics. |
| jnwb.electrode_inventory | function | (nwb_paths: str | pathlib.Path | List[str | pathlib.Path], on_read_error: Literal['skip', 'raise'] = 'skip') -> pandas.DataFrameBuild inventory of electrodes, mapping to units and areas. |
| jnwb.filter_by_criteria | function | (df: pandas.DataFrame, criteria: Dict, *, unknown: Literal['ignore', 'raise'] = 'ignore') -> pandas.DataFrameApply a criteria dict to a DataFrame (units, electrodes, or any other table). |
| jnwb.get_all_units_metadata | function | (nwb_paths: str | pathlib.Path | pynwb.file.NWBFile | List[str | pathlib.Path | pynwb.file.NWBFile], filter_quality: bool = False, quality_threshold: float = 1.0, on_read_error: Literal['skip', 'raise'] = 'skip', *, stable_threshold: float = 1.0, stable_labels: Collection[str] = ('good', 'sua', 'single', 'stable', 'clean'), allow_missing: Sequence[str] | str | None = None) -> pandas.DataFrameExtract all units and metadata from one or more NWB files. |
| jnwb.get_snr_analysis | function | (units_df: pandas.DataFrame, snr_threshold: float = 1.0, detail: bool = False) -> DictAnalyze SNR distribution and quality. |
| jnwb.unit_census_report | function | (units_df: pandas.DataFrame, group_by: List[str] | None = None) -> pandas.DataFrameGenerate a census/summary report of units grouped by session, area and depth class. |
| jnwb.units_table | function | (nwb: pynwb.file.NWBFile) -> Tuple[pandas.DataFrame, Dict[str, Dict[str, str]]]One row per unit of an open NWB file: identity, probe, peak channel, area, depth class and the waveform features the units table carries. |
Module: jnwb.nwb_events¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.AmbiguousIntervalTableError | class | Several interval tables are present and table was not specified. |
| jnwb.ColumnNotFoundError | class | A required interval-table column is missing. |
| jnwb.EventTable | class | Structured event rows from one NWB interval table. |
| jnwb.IntervalTableNotFoundError | class | The requested interval table does not exist. |
| jnwb.InvalidOnsetValueError | class | A selected row has a missing or non-finite onset timestamp. |
| jnwb.NWBEventError | class | Base class for event/onset extraction errors. |
| jnwb.edges_near_events | function | (path_or_nwb: 'NWBInput', series_path: 'str', events: 'Sequence[float] | np.ndarray', *, threshold: 'float', window_s: 'tuple[float, float]') -> 'pd.DataFrame'Return the rising and falling edge nearest each event of a TimeSeries. |
| jnwb.event_onsets | function | (path_or_nwb: 'NWBInput', *, table: 'str | None' = None, codes: 'CodeSequence | None' = None, code_column: 'str | None' = 'codes', onset_column: 'str' = 'start_time') -> 'np.ndarray'Return onset timestamps (seconds) for rows matching codes. |
| jnwb.events | function | (path_or_nwb: 'NWBInput', *, table: 'str | None' = None, code_column: 'str | None' = 'codes', onset_column: 'str' = 'start_time') -> 'EventTable'Read event codes and onset timestamps from one interval table. |
| jnwb.resolve_interval_table | function | (path_or_nwb: 'NWBInput', table: 'str | None' = None) -> 'str'Resolve an interval table name using jnwb addressing rules. |
Module: jnwb.nwb_inspect¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.AcquisitionNotFoundError | class | The requested acquisition does not exist. |
| jnwb.AmbiguousAcquisitionError | class | Several acquisitions are present and name was not specified. |
| jnwb.AmbiguousLayoutError | class | The channel axis of a 2-D continuous series cannot be determined. |
| jnwb.ChannelIndexError | class | The requested channel index is out of range for the continuous series. |
| jnwb.NWBInspectError | class | Base for every error raised while addressing an NWB file's contents. |
| jnwb.UnitNotFoundError | class | The requested units-table row does not exist. |
| jnwb.acquisition_channel | function | (path_or_nwb: 'InspectInput', name: 'str | None' = None, channel: 'int' = 0) -> 'tuple[np.ndarray, float]'Return one continuous acquisition channel and its sampling rate in Hz. |
| jnwb.inspect | function | (path_or_nwb: 'InspectInput') -> 'dict[str, Any]'Return structured metadata about an NWB file or in-memory NWB object. |
| jnwb.resolve_acquisition | function | (path_or_nwb: 'InspectInput', name: 'str | None' = None) -> 'str'Resolve an acquisition or processing continuous series name. |
| jnwb.unit_spike_times | function | (path_or_nwb: 'InspectInput', unit_index: 'int' = 0) -> 'np.ndarray'Return spike times (seconds) for one units-table row. |
Module: jnwb.nwb_integrity¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.RaggedIndexRepair | class | Outcome of repair_ragged_index. written is False for a dry run and True only after the written index was re-read, checked and moved into place; output_path is the file that holds it (None for a dry run). |
| jnwb.RaggedIndexRepairRefused | class | repair_ragged_index found a condition under which it must not write. |
| jnwb.RaggedIndexReport | class | All ragged columns of one table. unlisted_ragged_columns are datasets that have a <name>_index partner but are absent from the table's colnames attribute, which makes pynwb hide them. ok is every column ok and no unlisted column. |
| jnwb.TableNotFoundError | class | The file has no table group at the requested path, e.g. an NWB without /units. |
| jnwb.WaveformBlockReport | class | Every unit's waveform block of one table. ok is every unit "owned": an "unknown" is explicit uncertainty, not a pass. rtol/atol echo the tolerances the verdicts were computed with, and amplitude_scale the factor applied to each stored amplitude. |
| jnwb.check_ragged_indices | function | (path: 'str | Path', *, table: 'str' = 'units', probe_starts: 'Sequence[int] | None' = None, probe_column: 'str | None' = None) -> 'RaggedIndexReport'Check every <column>_index of one table of an NWB file, without writing. |
| jnwb.check_waveform_blocks | function | (path: 'str | Path', *, table: 'str' = 'units', rtol: 'float', atol: 'float' = 0.0, amplitude_scale: 'float' = 1.0) -> 'WaveformBlockReport'Check every unit's waveform_mean block against its stored amplitude. |
| jnwb.repair_ragged_index | function | (path: 'str | Path', column: 'str', *, table: 'str' = 'units', probe_starts: 'Sequence[int] | None' = None, probe_column: 'str | None' = None, dry_run: 'bool' = True, output_path: 'str | Path | None' = None, in_place: 'bool' = False, backup_path: 'str | Path | None' = None) -> 'RaggedIndexRepair'Correct one ragged index that carries the multi-probe offset defect. |
Module: jnwb.nwb_io¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.ContainerTypeContradictionWarning | class | A container's declared neurodata_type disagrees with what the file stores under it. |
| jnwb.MissingRequiredNWBFieldError | class | A required NWB field is absent from the on-disk builder tree. |
| jnwb.SqueezedAttributeWarning | class | A length-1 array attribute was collapsed to a scalar while reading a malformed file. |
| jnwb.nwb_read_io | function | (path: 'Any', mode: 'Union[str, None]' = None, allow_missing: 'Union[Sequence[str], str, None]' = None, **kwargs: 'Any') -> 'ContextManager[NWBHDF5IO]'Open an NWB file for reading, with jnwb's builder repairs applied. |
| jnwb.read_nwb | function | (path: 'Any', allow_missing: 'Union[Sequence[str], str, None]' = None, **kwargs: 'Any') -> 'Any'Read an NWB file through jnwb's scoped HDMF builder repairs. |
Module: jnwb.nwb_validate¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.NWBValidationReport | class | All layers of one file, plus the versions that produced them. |
| jnwb.ValidationLayer | class | Outcome of one layer. messages holds at most max_messages strings; the counts are complete. n_warnings counts findings that do not fail the layer. detail states why a layer was skipped, or what it ran. |
| jnwb.validate_nwb | function | (path: 'str | Path', *, layers: 'Sequence[str] | None' = None, dandi_ignore: 'Sequence[str]' = ('DANDI.NO_DANDISET_FOUND',), max_messages: 'int' = 50) -> 'NWBValidationReport'Validate one NWB file and report every layer. Read-only; nothing is written. |
Module: jnwb.nwb_write¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.AmbiguousMappingError | class | Two plausible mappings for one conversion; the operation refuses to pick one. |
| jnwb.NWBMutationError | class | Base error for refused NWB mutation operations; carries the report issues. |
| jnwb.NWBVerificationError | class | A written file failed its post-write verify_nwb check; dst is left in place. |
| jnwb.UndeclaredUnitError | class | A stored unit string is absent or outside the unit table; a unit is never guessed. |
| jnwb.UnidentifiableRepairError | class | A named repair's identifiability precondition does not hold; nothing is written. |
| jnwb.repair_nwb | function | (src: 'str | Path', *, dst: 'str | Path', repairs, overwrite: 'bool' = False, verify: 'bool' = True) -> 'MutationReport'Make the read path's in-memory repairs persistent and report the repair. |
| jnwb.transform_nwb | function | (src: 'str | Path', *, dst: 'str | Path', keep = None, drop = None, cast = None, compression = None, overwrite: 'bool' = False, verify: 'bool' = True) -> 'MutationReport'Copy a file with declared changes and report the copy. |
| jnwb.verify_nwb | function | (dst: 'str | Path', *, against: 'str | Path | None' = None, report: 'MutationReport | None' = None, n_check: 'int' = 200000) -> 'MutationReport'Re-read one written NWB file and check it, with or without its source. |
| jnwb.write_nwb | function | (nwbfile: 'NWBFile', *, dst: 'str | Path', overwrite: 'bool' = False, verify: 'bool' = True) -> 'MutationReport'Write a caller-built NWBFile to dst and report the write. |
Module: jnwb.onset_fitting¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.causal_exp_smooth | function | (rate: 'np.ndarray', bin_ms: 'float', tau_ms: 'float' = 30.0) -> 'np.ndarray'Causal (forward-only) exponential-kernel smoothing of an already-binned rate trace. |
| jnwb.causal_gaussian_smooth | function | (rate: 'np.ndarray', sigma_bins: 'float') -> 'tuple[np.ndarray, float]'Causal (past-only) Gaussian smoothing of an already-binned rate trace, with its mean lag. |
| jnwb.fit_exponential_onset | function | (t_ms: 'np.ndarray', rate: 'np.ndarray', t0_bounds_ms: 'tuple[float | None, float | None] | None' = None, tau_bounds_ms: 'tuple[float, float] | None' = None, baseline_window_ms: 'tuple[float, float] | None' = None, min_amplitude: 'float' = 0.0, t0_grid_step_ms: 'float | None' = None, *, t0_bounds: 'tuple[float | None, float | None] | None' = None, tau_bounds: 'tuple[float, float] | None' = None, baseline_window: 'tuple[float, float] | None' = None, t0_grid_step: 'float | None' = None) -> 'dict'Grid-search-over-t0, then bounded nonlinear least-squares fit of onset_model. |
| jnwb.onset_model | function | (t: 'np.ndarray', t0: 'float', tau: 'float', amplitude: 'float', baseline: 'float') -> 'np.ndarray'rate(t) = baseline for t < t0, baseline + amplitude(1-exp(-(t-t0)/tau)) for t >= t0.* |
Module: jnwb.ontology¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.AlignedDataset | class | Dataset with explicit Alignment. |
| jnwb.Alignment | class | Reference frame for time-series data. |
| jnwb.Dataset | class | Aggregated query result: immutable collection of data. |
| jnwb.EpochCollection | class | Filtered set of trials: immutable. |
| jnwb.Figure | class | Visualization: rendering of Result + Interpretation. |
| jnwb.Interpretation | class | Meaning and claims: what does the result mean? |
| jnwb.Lineage | class | Artifact dependencies: where did this come from? |
| jnwb.Preflight | class | The outcome of checking a planned analysis before it runs. |
| jnwb.Provenance | class | Execution context and metadata. |
| jnwb.Query | class | Data selection rules: what subset of data? |
| jnwb.Question | class | Scientific hypothesis: what are we asking? |
| jnwb.Result | class | Analysis output: statistics, provenance, lineage. |
| jnwb.preflight | function | (question: jnwb.ontology.Question, input_path: str | os.PathLike | None = None) -> jnwb.ontology.PreflightCheck a planned analysis before it runs and return one of the four outcomes. |
Module: jnwb.permutation¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.build_permutation_plan | function | (labels: 'Iterable[object]', groups: 'Iterable[object]', *, n_permutations: 'int', rng: 'RNGLike' = <required>, seed: 'Any' = <required>, blocks: 'Optional[Iterable[object]]' = None) -> 'dict'Create an explicit within-group null plan (a manifest of digested draws); no model fitting occurs. |
| jnwb.permute_labels | function | (y, *, groups = None, scheme: 'str', rng: 'RNGLike')Permute labels under an explicitly named exchangeability scheme. |
Module: jnwb.rsa¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.rdm | function | (X: 'np.ndarray', metric: 'str' = 'correlation', condensed: 'bool' = True, device: 'str' = 'cpu') -> 'np.ndarray'Compute a Representational Dissimilarity Matrix (RDM) from feature vectors. |
| jnwb.rdm_similarity | function | (rdm1: 'np.ndarray', rdm2: 'np.ndarray', metric: 'str' = 'spearman') -> 'Tuple[float, float]'Compute second-order representational similarity between two RDMs. |
Module: jnwb.spectral¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.AperiodicFitResult | class | Container for 1/f aperiodic spectral parameter estimates. |
| jnwb.aggregate_to_db | function | (power, baseline, *, how: str, aggregate_over = None, nan_policy: str = 'propagate')Form a power ratio, aggregate on the RATIO scale, and take 10*log10 exactly once. |
| jnwb.aperiodic_fit | function | (freqs: numpy.ndarray, psd: numpy.ndarray, freq_range: Tuple[float, float], mode: str = 'fixed', *, robust: bool = False) -> jnwb.spectral.AperiodicFitResult | List[typing.Any]Fit aperiodic 1/f spectral parameters directly to an existing power spectrum. |
| jnwb.band_power | function | (lfp_trace: numpy.ndarray, fs: float | None = None, sampling_rate: float | None = None, freq_range: Tuple[float, float] = (1.0, 90.0), normalize: bool = True, baseline: numpy.ndarray | None = None, device: str = 'cpu') -> floatMean power spectral density over a frequency band. |
| jnwb.bipolar_reference | function | (channel_data: numpy.ndarray, channel_order: numpy.ndarray | None = None) -> numpy.ndarrayBipolar (adjacent-channel difference) re-reference along a probe's depth order. |
| jnwb.coherence_bias_floor | function | (signals, *, fs: float, freq_bands, pairing: str = 'random_pairs', n_draws: int = 200, rng: int | numpy.random._generator.Generator | None = 0, nperseg: int | None = None, noverlap: int | None = None) -> DictThe coherence that randomly paired epochs produce: the bias floor of a finite epoch count. |
| jnwb.compute_multitaper_psd | function | (data: numpy.ndarray, fs: float, nw: float = 3.0, k_tapers: int | None = None, axis: int = -1) -> Tuple[numpy.ndarray, numpy.ndarray]Compute power spectral density via the Discrete Prolate Spheroidal Sequences (DPSS) multitaper method. |
| jnwb.compute_psd | function | (lfp_data: numpy.ndarray, fs: float, axis: int = 0, *, nperseg: int | None = None)Welch power spectral density of a plain LFP array. |
| jnwb.cross_area_coherence | function | (lfp_area1: numpy.ndarray, lfp_area2: numpy.ndarray, fs: float | None = None, sampling_rate: float | None = None, freq_bands: Dict[str, Tuple[float, float]] | str | None = None, device: str = 'cpu', rng: int | numpy.random._generator.Generator | None = 42, n_surrogates: int = 50, n_jobs: int = 1, nperseg: int | None = None, noverlap: int | None = None) -> DictCompute frequency-resolved coherence between two LFP signals. |
| jnwb.current_source_density_1d | function | (lfp_matrix: numpy.ndarray, pitch_um: float, conductivity_s_per_m: float, axis: int = 0) -> numpy.ndarrayCompute physical 1D Current Source Density (CSD) along a laminar electrode array. |
| jnwb.harmonic_analysis | function | (lfp_trace: numpy.ndarray, fs: float | None = None, sampling_rate: float | None = None, freq_range: Tuple[float, float] = (1.0, 90.0), harmonic_orders: int = 3, device: str = 'cpu') -> DictDecompose LFP trace into fundamental and harmonic components. |
| jnwb.imaginary_coherency | function | (x: numpy.ndarray, y: numpy.ndarray, fs: float | None = None, sampling_rate: float | None = None, freq_range: Tuple[float, float] = (1.0, 90.0), nperseg: int | None = None, noverlap: int | None = None, device: str = 'cpu', *, signal_class: str | Tuple[str, str] = _OMITTED) -> Dict[str, float]Imaginary part of coherency (Nolte et al. 2004) between two continuous signals. |
| jnwb.laplacian_reference | function | (channel_data: numpy.ndarray, channel_order: numpy.ndarray | None = None) -> numpy.ndarray1D nearest-neighbor Laplacian re-reference along a probe's depth order. |
| jnwb.partial_coherence | function | (X, Y, Z, *, fs: float, freq_bands, nperseg: int | None = None, noverlap: int | None = None, n_surrogates: int = 50, rng: int | numpy.random._generator.Generator | None = 42, n_jobs: int = 1) -> DictPartial coherence of X and Y given one conditioning signal Z (Dahlhaus, 2000). |
| jnwb.relative_power | function | (power: numpy.ndarray, baseline: numpy.ndarray, *, model: str = 'mean_of_ratios', axis: int | Tuple[int, ...] | None = None, device: str = 'cpu') -> numpy.ndarrayCompute relative power of a signal against baseline under an explicit mathematical estimand. |
| jnwb.spectral_tilt | function | (lfp_trace: numpy.ndarray, fs: float | None = None, sampling_rate: float | None = None, freq_range: Tuple[float, float] = (1.0, 100.0), device: str = 'cpu') -> DictFit 1/f spectral tilt via linear regression of log10 power versus log10 frequency. |
| jnwb.to_db | function | (ratio)10*log10(ratio) with divide and invalid warnings silenced — average power, divide by baseline, then take the logarithm exactly once. |
| jnwb.voltage_curvature_1d | function | (lfp_matrix: numpy.ndarray, pitch_um: float, axis: int = 0) -> numpy.ndarrayCompute the discrete second spatial derivative of extracellular potential along a laminar probe. |
| jnwb.wpli | function | (x: numpy.ndarray, y: numpy.ndarray, fs: float | None = None, sampling_rate: float | None = None, freq_range: Tuple[float, float] = (1.0, 90.0), nperseg: int | None = None, noverlap: int | None = None, device: str = 'cpu') -> Dict[str, typing.Any]Weighted Phase Lag Index (wPLI) between two continuous signals. |
Module: jnwb.spiking¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.classify_response_significance | function | (metrics: Dict[str, float], zscore_threshold: float = 1.96, min_spike_count: int = 5, *, alpha: float = 0.05) -> Dict[str, bool | float]Classify a unit's response against its baseline from compute_response_metrics output. |
| jnwb.compute_response_metrics | function | (spike_times: numpy.ndarray, epoch_onsets: numpy.ndarray, baseline_window_s: Tuple[float, float] | None = None, response_window_s: Tuple[float, float] | None = None, z_score: bool = True, *, baseline_window: Tuple[float, float] | None = None, response_window: Tuple[float, float] | None = None) -> Dict[str, typing.Any]Compute firing rate and spike count metrics for stimulus responses. |
| jnwb.fano_factor | function | (spike_times, onsets_s, *_positional, window_s: Tuple[float, float] = _REQUIRED, summary: str) -> Dict[str, typing.Any]Fano factor per unit across trials, summarised over units (Churchland et al. 2010). |
| jnwb.fleiss_kappa | function | (counts: numpy.ndarray) -> floatFleiss' kappa: chance-corrected agreement of many raters on nominal categories (Fleiss 1971). |
| jnwb.gaussian_smooth_rate | function | (rate: numpy.ndarray, bin_ms: float, sigma_ms: float = 20.0, axis: int = -1) -> numpy.ndarrayApply symmetrical, acausal Gaussian smoothing to a binned firing rate trace. |
| jnwb.network_burst_index | function | (spike_times, *_positional, window_s: Tuple[float, float] = _REQUIRED, bin_ms: float, threshold_hz: float, min_duration_ms: float) -> Dict[str, typing.Any]Fraction of spikes inside network bursts found from the population rate (Wagenaar et al. 2006). |
| jnwb.noise_correlation | function | (counts, condition_id, *, min_trials: int) -> Dict[str, typing.Any]Trial-based noise correlation: Pearson r of within-condition residual counts (Cohen and Kohn 2011). |
| jnwb.pairwise_phase_consistency | function | (phases: numpy.ndarray, axis: int = -1) -> float | numpy.ndarrayCompute the Pairwise Phase Consistency (PPC) across angular samples (Vinck et al., 2010). |
| jnwb.phase_locking_index | function | (unit_spike_times: numpy.ndarray, lfp_phase: numpy.ndarray, lfp_timestamps: numpy.ndarray, n_bins: int = 18) -> Dict[str, float | numpy.ndarray]Compute circular phase distribution and Rayleigh non-uniformity test of spikes relative to LFP phase. |
| jnwb.spike_count_correlation | function | (spike_times, *_positional, window_s: Tuple[float, float] = _REQUIRED, bin_ms: float) -> Dict[str, typing.Any]Mean pairwise Pearson correlation of binned spike counts (Cohen and Kohn 2011). |
Module: jnwb.statistics¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.StatisticalAnalysis | class | Dual statistical testing with honest multiple-comparison handling. |
| jnwb.assign_subblock_quartiles | function | (epochs_df: 'pd.DataFrame', n_quantiles: 'int' = 4) -> 'np.ndarray'Assign each row a temporal quantile bucket 0..n_quantiles-1 by its own start_time order. |
| jnwb.clopper_pearson | function | (k: 'int', n: 'int', alpha: 'float' = 0.05) -> 'Tuple[float, float]'Exact (Clopper-Pearson) binomial confidence interval via the Beta-quantile form. |
| jnwb.cluster_permutation_test | function | (X: 'np.ndarray', Y: 'np.ndarray', *, paired: 'bool' = False, groups: 'Optional[Union[np.ndarray, Tuple[np.ndarray, np.ndarray]]]' = None, scheme: 'Optional[str]' = None, threshold: 'float' = 2.0, n_permutations: 'int' = 1000, tail: 'str' = 'both', rng: 'RNGLike' = 0, n_jobs: 'int' = 1) -> 'Dict[str, Union[np.ndarray, List[Dict[str, Union[float, np.ndarray]]]]]'Non-parametric cluster-based permutation test for multidimensional signals (Maris & Oostenveld, 2007). |
| jnwb.cross_modal_comparison | function | (tfr_data: 'np.ndarray', spike_data: 'np.ndarray', lag_range_ms: 'Tuple[int, int]' = (-500, 500), bin_ms: 'Optional[float]' = None, n_permutations: 'int' = 1000, rng: 'RNGLike' = None, *, seed: 'Any' = None) -> 'Dict'Trial-averaged correlation between a TFR-derived signal and a spike-count signal. |
| jnwb.detect_trial_cycles | function | (epochs_df: 'pd.DataFrame', gap_factor: 'float' = 10.0) -> 'np.ndarray'Detect temporal cluster ("cycle") boundaries in a trial table via a gap threshold. |
| jnwb.effective_sample_size | function | (x: 'np.ndarray') -> 'float'Effective number of independent samples in autocorrelated data. |
| jnwb.exact_sign_flip | function | (diffs: 'Union[Sequence[float], np.ndarray]', alternative: 'str' = 'two-sided', n_mc: 'int' = 10000, rng: 'RNGLike' = 42) -> 'Tuple[float, float, float]'Exact paired sign-flip permutation test for paired sample differences. |
| jnwb.fdr_correct | function | (p_values: 'Union[Sequence[float], np.ndarray]', method: 'str' = 'bh') -> 'np.ndarray'Benjamini-Hochberg (or compatible) FDR across a hypothesis family. |
| jnwb.fire_indicator | function | (spike_times: 'np.ndarray', onsets_s: 'np.ndarray', *_positional, window_ms = _REQUIRED) -> 'np.ndarray'Vectorized boolean fire indicator, one entry per onset, constant window. |
| jnwb.fires_in_window | function | (spike_times: 'np.ndarray', onset_s: 'float', *_positional, window_ms = _REQUIRED) -> 'bool'True iff >=1 spike has spike - onset_s in [window_ms[0]/1000, window_ms[1]/1000). |
| jnwb.mann_whitney_p_floor | function | (n1: 'int', n2: 'int', alternative: 'str' = 'two-sided') -> 'float'Attainable minimal non-zero p-value floor for a Mann-Whitney U test without ties. |
| jnwb.paired_fire_prob_test | function | (fires_target: 'np.ndarray', fires_null: 'np.ndarray', n_shuffles: 'int', n_bootstrap: 'int', rng: 'RNGLike') -> 'Dict'Paired binary test: P(fire | target window) vs P(fire | paired baseline window). |
| jnwb.rate_in_window | function | (spike_times: 'np.ndarray', onset_s: 'float', *_positional, window_ms: 'Tuple[float, float]' = _REQUIRED) -> 'float'Firing rate (Hz) of spikes with spike - onset_s in [window_ms[0]/1000, window_ms[1]/1000). |
| jnwb.shuffle_pvalue_paired | function | (a: 'np.ndarray', b: 'np.ndarray', n_shuffles: 'int', rng: 'RNGLike', alternative: 'str' = 'two-sided') -> 'Tuple[float, float]'Shuffle-controlled p-value for mean(a - b) via paired sign-flips. |
| jnwb.shuffle_pvalue_unpaired | function | (a: 'np.ndarray', b: 'np.ndarray', n_shuffles: 'int', rng: 'RNGLike', alternative: 'str' = 'two-sided') -> 'Tuple[float, float]'Shuffle-controlled p-value for mean(a) - mean(b) via label-shuffling. |
| jnwb.shuffle_r2_ci | function | (y_true: 'np.ndarray', y_score: 'np.ndarray', groups: 'Optional[np.ndarray]' = None, n_shuffle: 'int' = 200, rng: 'RNGLike' = 42, *, random_state: 'Any' = 42) -> 'Dict[str, float]'R^2 (squared Pearson correlation) between a continuous score and a 0/1 label, with a shuffle-null 95% CI. |
Module: jnwb.tfr¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.ComplexTFR | class | Container for complex Time-Frequency Representation outputs. |
| jnwb.complex_tfr | function | (data: 'np.ndarray', fs: 'float', freqs: 'np.ndarray', n_cycles: 'Union[float, np.ndarray]' = 5.0, time_axis: 'int' = -1, normalization: 'str' = 'amplitude', dtype: 'np.dtype' = <class 'numpy.complex128'>, coi_sigma: 'Optional[float]' = None, device: 'str' = 'cpu') -> 'ComplexTFR'Compute complex Time-Frequency Representation via Morlet wavelet convolution. |
| jnwb.morlet_wavelet | function | (f0: 'float', fs: 'float', n_cycles: 'float' = 5.0, normalization: 'str' = 'amplitude', cutoff_sigma: 'float' = 4.0) -> 'Tuple[np.ndarray, np.ndarray]'Generate a discrete complex Morlet wavelet kernel. |
Module: jnwb.tfr_accumulator¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.TFRAccumulator | class | Poolable sufficient statistics for complex TFR. Accumulate in float64/complex128. |
| jnwb.assert_mergeable | function | (attrs_a: 'Dict', attrs_b: 'Dict') -> 'None' |
Module: jnwb.trajectory¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.build_time_resolved_matrix | function | (session, area: str, epochs_df: pandas.DataFrame, time_window_ms: Tuple[float, float], bin_size_ms: float = 20.0, quality: str | None = None, *, label: Literal['center', 'right'] = 'center') -> Tuple[numpy.ndarray, List[int], numpy.ndarray]Build a trial-by-trial time-resolved population spike count matrix. |
| jnwb.compute_population_trajectory | function | (session, area: str, epochs_df: pandas.DataFrame, time_window_ms: Tuple[float, float], bin_size_ms: float = 20.0, n_components: int = 3, quality: str | None = None, device: str = 'cpu', *, label: Literal['center', 'right'] = 'center') -> Dict[str, numpy.ndarray | List[int] | float | str]Compute population trajectory using standardized correlation PCA (SVD). Supports GPU SVD acceleration via PyTorch if device='cuda' and CUDA is available. |
Module: jnwb.unit_quality¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.amplitude_cutoff | function | (amplitudes, *, num_histogram_bins: 'int' = 500, histogram_smoothing_value: 'float' = 3.0) -> 'float'Fraction of a unit's spikes missing below the detection threshold, from its amplitudes. |
| jnwb.isi_cv | function | (spike_times) -> 'float'Coefficient of variation of the inter-spike intervals (Shinomoto et al. 2009, eq. 1). |
| jnwb.presence_ratio | function | (spike_times, blocks) -> 'float'Fraction of caller-given blocks that hold at least one spike (Siegle et al. 2021). |
| jnwb.refractory_contamination | function | (spike_times, *, duration_s: 'float', refractory_ms: 'float', censored_ms: 'float') -> 'Dict[str, Any]'Fraction of a unit's spikes that come from a contaminating source (Hill et al. 2011). |
| jnwb.repolarization_slope | function | (waveform, fs: 'float', *, upsampling_factor: 'float' = 2.4390243902439024, window_samples: 'int' = 20) -> 'float'Slope of the return towards baseline after the largest deflection (Jia et al. 2019). |
| jnwb.screen_units_against_labels | function | (metrics, labels, session_id, *, metric_columns, classifier, min_units, rng) -> 'dict'Held-out agreement, per session, between a linear-SVM screen and caller labels. |
| jnwb.spatial_derivative_sharpness | function | (waveform, channel_positions, *, threshold: 'float') -> 'Dict[str, Any]'How sharply amplitude falls from the peak channel to its nearest channels. |
| jnwb.waveform_features | function | (waveform, fs: 'float') -> 'Dict[str, Any]'Peak channel, amplitude, trough-to-peak duration, peak-trough ratio and polarity. |
| jnwb.waveform_flatness | function | (waveform, *, threshold: 'float') -> 'Dict[str, Any]'Whether a mean waveform is flat: its peak-channel amplitude is below threshold. |
| jnwb.waveform_halfwidth | function | (waveform, fs: 'float', *, upsampling_factor: 'float' = 2.4390243902439024) -> 'float'Width of the largest deflection at half its height, in ms (Jia et al. 2019). |
| jnwb.waveform_snr | function | (spike_waveforms) -> 'float'Signal-to-noise ratio of one unit on one channel (Siegle et al. 2021, Methods). |
| jnwb.waveform_spread | function | (waveform, *, site_spacing_um: 'float', threshold: 'float' = 0.12, site_range: 'int' = 16, site_step: 'int' = 2, outlier_z: 'float' = 1.5) -> 'float'Extent along the probe of the channels that carry the unit, in micrometers (Jia et al. 2019). |
Module: jnwb.viz¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.apply_tight_auto_axis | function | (ax, x_span: Tuple[float, float] = (-500, 4124), y_margin: float = 0.12)Pin the x-axis to x_span and fit the y-axis to the plotted lines. |
| jnwb.raster_psth | function | (st, onsets, win_ms, bin_ms: float = 10.0)Trial-averaged PSTH (mean + SEM firing rate per bin) for a raw spike-time array against an explicit onset array -- raw arrays in, no session/unit_id lookup. Distinct from :func: jnwb.spiking.compute_response_metrics's single-response-window-scalar contract: this returns the full time-binned PSTH curve. |
| jnwb.resample_onsets | function | (onsets: numpy.ndarray, target_n: int = 100, rng: int | numpy.random._generator.Generator | None = 42, *, random_state: typing.Any = 42) -> numpy.ndarrayResample a trial-onset array to exactly target_n onsets (with replacement if there are fewer than target_n available), for a consistent raster trial count across units with different trial counts. |
| jnwb.save_figure_suite | function | (figures: List[matplotlib.figure.Figure], output_dir: str | pathlib.Path, basename: str, dpi: int = 300, formats: List[str] = ['png', 'pdf']) -> NoneSave a suite of figures to disk with consistent naming. |
| jnwb.setup_vector_graphics | function | ()Enforce editable vector SVG font rendering in Adobe Illustrator / Inkscape. |
Module: jnwb.wavemap¶
| Symbol | Type | Signature / Description |
|---|---|---|
| jnwb.WaveMAPResult | class | What wavemap returns. |
| jnwb.align_waveforms | function | (waveforms, fs: 'float', *, pre_s: 'float' = 0.0004, post_s: 'float' = 0.0012) -> 'Tuple[np.ndarray, np.ndarray]'Cut each mean waveform to the window [trough - pre_s, trough + post_s). |
| jnwb.normalize_waveforms | function | (waveforms, *, subtract_mean: 'bool' = True) -> 'np.ndarray'Scale each row so its largest absolute value is 1, after removing its mean. |
| jnwb.wavemap | function | (waveforms, *, resolution: 'float', n_neighbors: 'int' = 20, min_dist: 'float' = 0.1, metric: 'str' = 'euclidean', embedding: 'bool' = True, rng: 'RNGLike' = 42) -> 'WaveMAPResult'Cluster normalized mean waveforms on their UMAP graph with Louvain (Lee et al. 2021). |
| jnwb.wavemap_resolution_sweep | function | (waveforms, resolutions: 'Sequence[float]', *, n_runs: 'int' = 25, fraction: 'float' = 0.8, n_neighbors: 'int' = 20, metric: 'str' = 'euclidean', rng: 'RNGLike' = 42) -> 'Dict[str, np.ndarray]'Modularity and cluster count across resolutions, over random subsets of units. |
Experimental¶
Outside jnwb.__all__, imported by name, with no stability promise: a release may change or remove them without a deprecation.
| Symbol | Type | Description |
|---|---|---|
jnwb.bilinear |
module | Optional/experimental: bilinear (rank-K) logistic regression for 2D neural decoding. |
jnwb.nam |
module | Optional/experimental: Neural Additive Model (NAM) for (N x T) decoding. |