ipfx.dataset package¶
Submodules¶
ipfx.dataset.create module¶
-
ipfx.dataset.create.create_ephys_data_set(nwb_file: str, sweep_info: Optional[Dict[str, Any]] = None, ontology: Optional[str] = None) → ipfx.dataset.ephys_data_set.EphysDataSet[source]¶ Create an ephys data set with the appropriate nwbdata reader class
nwb_file sweep_info ontology
EphysDataSet
-
ipfx.dataset.create.get_nwb_version(nwb_file: str) → Dict[str, Any][source]¶ Find version of the nwb file
nwb_file
dict in the format:
- {
- major: str full str.
}
ipfx.dataset.ephys_data_interface module¶
-
class
ipfx.dataset.ephys_data_interface.EphysDataInterface(ontology: ipfx.stimulus.StimulusOntology, validate_stim: bool = True)[source]¶ Bases:
abc.ABCThe interface that any child class providing data to the EphysDataSet must implement
-
get_clamp_mode(sweep_number) → str[source]¶ Extract clamp mode from the class of Time Series Parameters ———- sweep_number
-
get_full_recording_date() → datetime.datetime[source]¶ Obtain the full date and time at which recording began.
A datetime object, with timezone, reporting the start of recording
-
get_stimulus_code(sweep_number: int) → str[source]¶ Obtain the code of the stimulus presented on a particular sweep.
sweep_number : unique identifier for the sweep
The codified name of the stimulus presented on the identified sweep
-
get_stimulus_unit(sweep_number: int) → str[source]¶ Extract unit of a stimulus
sweep_number
stimulus unit
-
get_sweep_attrs(sweep_number) → Dict[str, Any][source]¶ Extract sweep attributes
sweep_number
sweep attributes
-
get_sweep_data(sweep_number: int) → Dict[str, Any][source]¶ Extract sweep data
sweep_number
dict in the format:
- {
- ‘stimulus’: np.ndarray, ‘response’: np.ndarray, ‘stimulus_unit’: string, ‘sampling_rate’: float
}
-
get_sweep_metadata(sweep_number: int) → Dict[str, Any][source]¶ Returns metadata about a sweep
sweep_number : identifier of the sweep whose metadata will be returned
dict in the format:
- {
- “sweep_number”: int, “stimulus_units”: str, “bridge_balance_mohm”: float, “leak_pa”: float, “stimulus_scale_factor”: float, “stimulus_code”: str, “stimulus_code_ext”: str, “stimulus_name”: str, “clamp_mode”: str
}
-
sweep_numbers¶ A time-ordered sequence of each sweep’s integer identifier
-
ipfx.dataset.ephys_data_set module¶
-
class
ipfx.dataset.ephys_data_set.EphysDataSet(data: ipfx.dataset.ephys_data_interface.EphysDataInterface, sweep_info: Optional[List[Dict[KT, VT]]] = None)[source]¶ Bases:
object-
CLAMP_MODE= 'clamp_mode'¶
-
COARSE_LONG_SQUARE= 'coarse_long_square'¶
-
COLUMN_NAMES= ['stimulus_units', 'stimulus_code', 'stimulus_amplitude', 'stimulus_name', 'clamp_mode', 'sweep_number']¶
-
CURRENT_CLAMP= 'CurrentClamp'¶
-
LONG_SQUARE= 'long_square'¶
-
RAMP= 'ramp'¶
-
SHORT_SQUARE= 'short_square'¶
-
SHORT_SQUARE_TRIPLE= 'short_square_triple'¶
-
STIMULUS_AMPLITUDE= 'stimulus_amplitude'¶
-
STIMULUS_CODE= 'stimulus_code'¶
-
STIMULUS_NAME= 'stimulus_name'¶
-
STIMULUS_UNITS= 'stimulus_units'¶
-
SWEEP_NUMBER= 'sweep_number'¶
-
VOLTAGE_CLAMP= 'VoltageClamp'¶
-
filtered_sweep_table(clamp_mode: Optional[str] = None, stimuli: Optional[Collection[str]] = None, stimuli_exclude: Optional[Collection[str]] = None) → pandas.core.frame.DataFrame[source]¶ Utility for filtering the sweep table
clamp_mode: filter to one of self.VOLTAGE_CLAMP or self.CURRENT_CLAMP stimuli: filter to sweeps presenting these stimuli (codes) stimuli_exclude: filter to sweeps not presenting these stimuli
filtered sweep table
-
get_clamp_mode(sweep_number: int) → str[source]¶ Obtain the clamp mode of a given sweep. Should be one of EphysDataSet.VOLTAGE_CLAMP or EphysDataSet.CURRENT_CLAMP
- sweep_number : identifier for the sweep whose clamp mode will be
- returned
The clamp mode of the identified sweep
-
get_recording_date() → str[source]¶ Return the date and time at which recording began.
a string, formatted like: “%Y-%m-%d %H:%M:%S” in local time
-
get_stimulus_code(sweep_number: int) → str[source]¶ Return the (short form) stimulus code for a particular sweep.
- sweep_number : identifier for the sweep whose stimulus code will be
- returned
code defining the stimulus presented on the identified sweep
-
get_stimulus_code_ext(sweep_number: int) → str[source]¶ Obtain the extended stimulus code for a sweep. This is the stimulus code for that sweep augmented with an integer counter describing the number of presentations of that stimulus up to and including the requested sweep.
sweep_number : identifies the sweep whose extended stimulus code will be returned
A string of the form “{stimulus_code}[{counter}]”
-
get_stimulus_units(sweep_number: int) → str[source]¶ Report the SI unit of measurement for a sweep’s stimulus data
- sweep_number : identifies the sweep whose stimulus unit will be
- returned
An SI (or derived) unit’s name
-
get_sweep_data(sweep_number: int) → Dict[KT, VT][source]¶ Obtain the recorded data for a given sweep.
sweep_number : identifier for the sweep whose data will be returned
- A dictionary containing at least:
- {
- ‘stimulus’: np.ndarray, ‘response’: np.ndarray, ‘stimulus_unit’: string, ‘sampling_rate’: float
}
-
get_sweep_number(stimuli: Collection[str], clamp_mode: Optional[str] = None) → int[source]¶ Convenience for getting the integer identifier of the temporally latest sweep matching argued criteria.
stimuli : filter to sweeps presentingthese stimuli clamp_mode : filter to sweeps of this clamp mode
The identifier of the last sweep matching argued criteria
-
get_sweep_numbers(stimuli: Collection[str] = None, clamp_mode: Optional[str] = None) → List[int][source]¶ Return the integer identifier of all sweeps matching argued criteria
stimuli : filter to sweeps presenting these stimuli (codes) clamp_mode : filter to sweeps of this clamp mode
A list of sweep numbers matching these criteria
-
ontology¶ The stimulus ontology maps codified description of the stimulus type to the human-readable descriptions.
-
sweep(sweep_number: int) → ipfx.sweep.Sweep[source]¶ Create an instance of the Sweep class with the data loaded from the from a file
sweep_number: int
sweep: Sweep object
-
sweep_info¶
-
sweep_set(sweep_numbers: Union[Sequence[int], int, None] = None) → ipfx.sweep.SweepSet[source]¶ Construct a SweepSet object, which offers convenient access to an ordered collection of sweeps.
- sweep_numbers : Identifiers for the sweeps which will make up this set.
- If None, use all available sweeps.
A SweepSet constructed from the requested sweeps
-
sweep_table¶ Each row of the sweep table contains the metadata for a single sweep. In particular details of the stimulus presented and the clamp mode. See EphysDataInterface.get_sweep_metadata for more information.
-
ipfx.dataset.ephys_nwb_data module¶
-
class
ipfx.dataset.ephys_nwb_data.EphysNWBData(nwb_file: None, ontology: ipfx.stimulus.StimulusOntology, load_into_memory: bool = True, validate_stim: bool = True)[source]¶ Bases:
ipfx.dataset.ephys_data_interface.EphysDataInterfaceAbstract base class for implementing an EphysDataInterface with an NWB file
Provides common NWB2 reading and writing functionality
-
RESPONSE= (<class 'pynwb.icephys.VoltageClampSeries'>, <class 'pynwb.icephys.CurrentClampSeries'>)¶
-
STIMULUS= (<class 'pynwb.icephys.VoltageClampStimulusSeries'>, <class 'pynwb.icephys.CurrentClampStimulusSeries'>)¶
-
get_clamp_mode(sweep_number)[source]¶ Extract clamp mode from the class of Time Series Parameters ———- sweep_number
-
get_full_recording_date()[source]¶ Extract session_start_time in nwb Use last value if more than one is present
- recording_date: str
- use date format “%Y-%m-%d %H:%M:%S”, drop timezone info
-
get_stimulus_code(sweep_number)[source]¶ Obtain the code of the stimulus presented on a particular sweep.
sweep_number : unique identifier for the sweep
The codified name of the stimulus presented on the identified sweep
-
get_sweep_metadata(sweep_number: int)[source]¶ Returns metadata about a sweep
sweep_number : identifier of the sweep whose metadata will be returned
dict in the format:
- {
- “sweep_number”: int, “stimulus_units”: str, “bridge_balance_mohm”: float, “leak_pa”: float, “stimulus_scale_factor”: float, “stimulus_code”: str, “stimulus_code_ext”: str, “stimulus_name”: str, “clamp_mode”: str
}
-
load_nwb(nwb_file: None, load_into_memory: bool = True)[source]¶ Load NWB to self.nwb
nwb_file: NWB file path or hdf5 obj load_into_memory: whether using load_into_memory approach to load NWB
-
sweep_numbers¶ A time-ordered sequence of each sweep’s integer identifier
-
ipfx.dataset.hbg_nwb_data module¶
-
class
ipfx.dataset.hbg_nwb_data.HBGNWBData(nwb_file: str, ontology: ipfx.stimulus.StimulusOntology, load_into_memory: bool = True, validate_stim: bool = True)[source]¶ Bases:
ipfx.dataset.ephys_nwb_data.EphysNWBDataProvides an Ephys Data Interface to an HBG generated NWB file
-
get_sweep_metadata(sweep_number: int) → Dict[str, Any][source]¶ Returns metadata about a sweep
sweep_number : identifier of the sweep whose metadata will be returned
dict in the format:
- {
- “sweep_number”: int, “stimulus_units”: str, “bridge_balance_mohm”: float, “leak_pa”: float, “stimulus_scale_factor”: float, “stimulus_code”: str, “stimulus_code_ext”: str, “stimulus_name”: str, “clamp_mode”: str
}
-
ipfx.dataset.labnotebook module¶
-
class
ipfx.dataset.labnotebook.LabNotebookReader[source]¶ Bases:
objectThe Lab Notebook Reader class
This class reads two sections: numeric data and text data
-
get_numeric_value(name, data_col, sweep_col, enable_col, sweep_num, default_val)[source]¶ fetch numeric data
val_number has 3 dimensions – the first has a shape of (#fields * 9). there are many hundreds of elements in this dimension. they look to represent the full array of values (for each field for each multipatch) for a given point in time, and thus given sweep according to Thomas Braun (igor nwb dev), the first 8 pages are for headstage data, and the 9th is for headstage-independent data
name: str data_col: int sweep_col: int enable_col: int sweep_num: int default_val: dict
last non-empty entry in specified column for specified sweep number
-
get_text_value(name, data_col, sweep_col, enable_col, sweep_num, default_val)[source]¶ fetch text data
name: str data_col: int sweep_col: int enable_col: int sweep_num: int default_val: dict
last non-empty entry in specified column for specified sweep number
-
get_value(name, sweep_num, default_val)[source]¶ looks for key in lab notebook and returns the value associated with the specified sweep, or the default value if no value is found (NaN and empty strings are considered to be non-values)
name_number has 3 dimensions – the first has shape (#fields * 9) and stores the key names. the second looks to store units for those keys. The third is numeric text but it’s role isn’t clear
val_number has 3 dimensions – the first has a shape of (#fields * 9). there are many hundreds of elements in this dimension. they look to represent the full array of values (for each field for each multipatch) for a given point in time, and thus given sweep
name: str sweep_num: int default_val: dict
values obtained from lab notebook
-
-
class
ipfx.dataset.labnotebook.LabNotebookReaderIgorNwb(nwb_file)[source]¶ Bases:
ipfx.dataset.labnotebook.LabNotebookReaderLabNotebookReaderIgorNwb: Loads lab notebook data out of an Igor-generated NWB file. Module input is the name of the nwb file. Notebook data can be read through get_value() function
ipfx.dataset.mies_nwb_data module¶
-
class
ipfx.dataset.mies_nwb_data.MIESNWBData(nwb_file: str, notebook: ipfx.dataset.labnotebook.LabNotebookReader, ontology: ipfx.stimulus.StimulusOntology, load_into_memory: bool = True, validate_stim: bool = True)[source]¶ Bases:
ipfx.dataset.ephys_nwb_data.EphysNWBDataProvides an Ephys Data Interface to a MIES generated NWB file
-
get_sweep_metadata(sweep_number: int) → Dict[str, Any][source]¶ Returns metadata about a sweep
sweep_number : identifier of the sweep whose metadata will be returned
dict in the format:
- {
- “sweep_number”: int, “stimulus_units”: str, “bridge_balance_mohm”: float, “leak_pa”: float, “stimulus_scale_factor”: float, “stimulus_code”: str, “stimulus_code_ext”: str, “stimulus_name”: str, “clamp_mode”: str
}
-