ibllib.io.extractors.fibrephotometry
Data extraction from fibrephotometry DAQ files.
Below is the expected folder structure for a fibrephotometry session:
subject/ ├─ 2021-06-30/ │ ├─ 001/ │ │ ├─ raw_photometry_data/ │ │ │ │ ├─ _neurophotometrics_fpData.raw.pqt │ │ │ │ ├─ _neurophotometrics_fpData.channels.csv │ │ │ │ ├─ _mcc_DAQdata.raw.tdms
fpData.raw.pqt is a copy of the ‘FPdata’ file, the output of the Neuophotometrics Bonsai workflow. fpData.channels.csv is table of frame flags for deciphering LED and GPIO states. The default table, copied from the Neurophotometrics manual can be found in iblscripts/deploy/fppc/ _mcc_DAQdata.raw.tdms is the DAQ tdms file, containing the pulses from bpod and from the neurophotometrics system
Module attributes
Neurophotometrics FP3002 specific information. |
Functions
Reads data file and checks that the number of timestamps check out with a tolerance of n_frames |
|
From a tdms daq file, extracts the photometry frames and their tagging. |
|
Classes
- V_THRESHOLD = 3
Neurophotometrics FP3002 specific information. The light source map refers to the available LEDs on the system. The flags refers to the byte encoding of led states in the system.
- sync_photometry_to_daq(vdaq, fs, df_photometry, chmap={'bpod': 'AI1', 'photometry': 'AI0'}, v_threshold=3)[source]
- Parameters:
vdaq – dictionary of daq traces.
fs – sampling frequency
df_photometry
chmap
v_threshold
- Returns:
- read_daq_timestamps(vdaq, v_threshold=3)[source]
From a tdms daq file, extracts the photometry frames and their tagging.
- Parameters:
vsaq – dictionary of the voltage traces from the DAQ. Each item has a key describing
the channel as per the channel map, and contains a single voltage trace. :param v_threshold: :return:
- check_timestamps(daq_file, photometry_file, tolerance=20, chmap={'bpod': 'AI1', 'photometry': 'AI0'}, v_threshold=3)[source]
Reads data file and checks that the number of timestamps check out with a tolerance of n_frames
- Parameters:
daq_file
photometry_file
tolerance – number of acceptable missing frames between the daq and the photometry file
chmap
v_threshold
- Returns:
None
- class FibrePhotometry(self.session_path, collection=self.collection)[source]
Bases:
BaseExtractor
- save_names = 'photometry.signal.pqt'
The filenames of each extracted dataset, or None if array should not be saved.
- Type:
tuple of str
- var_names = 'df_out'
A list of names for the extracted variables. These become the returned output keys.
- Type:
tuple of str
- extract_timestamps(fp_data, **kwargs)[source]
Extract the photometry.timestamps array.
This depends on the DAQ and task synchronization protocol.
- Parameters:
fp_data (dict) – A Bunch of raw fibrephotometry data, with the keys (‘raw’, ‘channels’).
- Returns:
An array of timestamps, one per frame.
- Return type:
numpy.ndarray