session.widefield¶
Widefield imaging acquisitions (dF/F0, F0). An acquisition is addressed by [module, name].
cicada_nwb.submodules.widefield.NWBWidefield ¶
Read-only access to widefield imaging data stored in an NWB file. No computation — returns raw arrays, and paths as stored (relative external files made relative to the .nwb).
get_wf_acquisition_dict ¶
get_wf_acquisition_dict()
Return a dict of widefield (OnePhotonSeries) acquisitions grouped by module. Structure: {module_name: [acquisition_name, ...]}
get_widefield_dff0 ¶
get_widefield_dff0(keys, start, stop)
Return a slice of widefield dF/F0 data as a 3D numpy array (frames, y, x). Args: keys: [module_name, interface_name] start: start frame index (int) stop: stop frame index (int) Returns: numpy array of shape (stop-start, height, width) or None
get_widefield_dff0_mmap ¶
get_widefield_dff0_mmap(keys)
Return the full widefield dF/F0 dataset as a lazy-access object.
Unlike get_widefield_dff0(), does NOT load data into RAM — slicing fetches only the requested frames. Pass this to get_avg_frames_by_epoch() as data_3d.
The return type depends on how the NWB file is backed: - HDF5-backed NWB (standard, .nwb files): returns an h5py Dataset. Slicing (e.g. data[10:20]) reads only those frames from disk. - Memory-mapped NWB (rare, np.memmap backend): returns a numpy memmap. Slicing reads the mapped region without loading the full file. In both cases the object supports numpy-style indexing and has a .shape attribute — the caller does not need to distinguish between the two.
Lifetime warning: the returned object is backed by the open NWB file
handle. It is only valid while the NWB session is open. When the file is
closed (e.g. the with NWBSession(...) block exits), the object becomes
invalid and any further access will raise an error.
When you slice it (e.g. via get_avg_frames_by_epoch), h5py materializes each slice as a numpy array immediately — those arrays survive file closure. Only the raw lazy object itself must not be stored beyond the session scope.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
keys
|
[module_name, interface_name] |
required |
Returns: h5py Dataset or np.memmap of shape (n_frames, height, width), or None. Valid only while the NWB file remains open.
get_widefield_f0 ¶
get_widefield_f0(acquisition_names)
Return the F0 baseline image for a widefield acquisition. Args: acquisition_names: [acquisition_key, image_name] where acquisition_key indexes nwb.acquisition and image_name indexes the images container within. Returns: 2D numpy array or None.
get_widefield_raw_acquisition_path ¶
get_widefield_raw_acquisition_path(acquisition_name)
Return the external file path(s) for a widefield raw acquisition. Args: acquisition_name: Key in nwb.acquisition. Returns: Array of file paths or None.
get_widefield_timestamps ¶
get_widefield_timestamps(keys)
Return timestamps for a widefield acquisition as a 1D numpy array. Args: keys: [module_name, interface_name] Returns: numpy array or None