Utilities

process_nwb.utils.chang_sds(cfs)[source]

Compute variable bandwidths for a set of center frequencies used by the Chang lab.

Parameters
  • cfs (ndarray) – Center frequencies.

  • Q (float) – Q value for the wavelet. Default = 8.

process_nwb.utils.const_Q_sds(cfs, Q=8)[source]

Compute constant Q bandwidths for a set of center frequencies.

Parameters
  • cfs (ndarray) – Center frequencies.

  • Q (float) – Q value for the wavelet. Default = 8.

process_nwb.utils.dtype(X, precision)[source]

Return the type to cast to depending on precision and whether X is complex.

Parameters
  • X (ndarray) – Input data.

  • precision (str) – Either single for float32/complex64 or double for float/complex.

process_nwb.utils.generate_nwbfile(nchannels=4)[source]

Generate an NWBFile object that an ElectricalSeries can be added to.

Returns

  • nwbfile (NWBFile) – NWBFile object

  • Device (Device) – Device for the ElectricalSeries

  • electrode_group (ElectrodeGroup) – ElectrodeGroup for the ElectricalSeries

  • electrodes (Electrodes) – Electrodes for the ElectricalSeries

process_nwb.utils.generate_synthetic_data(duration, nchannels, rate, high_gamma=True, linenoise=True, seed=0)[source]

Generate synthetic data by smoothing white noise with a boxcar for testing or tutorials. Optional high gamma and 60 Hz linenoise can be added.

Parameters
  • duration (float) – Data duration in seconds.

  • nchannels (int) – Number of channels

  • rate (float) – Sampling rate in Hz

  • high_gamma (bool) – If True, include extra modulating power in the high gamma range.

  • linenoise (bool) – If True, include 60 Hz linenoise.

Returns

neural_data – Synthetic neural data

Return type

ndarray (time, channels)

process_nwb.utils.log_spaced_cfs(fmin, fmax, ncfs)[source]

Return log-spaced center frequencies.

Parameters
  • fmin (float) – Minimum center frequency.

  • fmax (float) – Maximum center frequency.

  • ncfs (int) – Number of bands to generate.