ipfx.bin package¶
Submodules¶
ipfx.bin.generate_fx_input module¶
ipfx.bin.generate_pipeline_input module¶
ipfx.bin.generate_qc_input module¶
ipfx.bin.generate_se_input module¶
-
ipfx.bin.generate_se_input.
generate_se_input
(cell_dir, specimen_id=None, input_nwb_file=None)[source]¶
ipfx.bin.get_fx_output module¶
-
ipfx.bin.get_fx_output.
get_fx_output_json
(specimen_id)[source]¶ Find in LIMS the full path to the json output of the feature extraction module If more than one file exists, then chose the latest version
Parameters: - specimen_id
Returns: - file_name: string
ipfx.bin.make_stimulus_ontology module¶
ipfx.bin.mcc_get_settings module¶
Code for interfacing with the Multi Clamp Commander application from Axon/Molecular Devices
-
class
ipfx.bin.mcc_get_settings.
DataGatherer
[source]¶ Bases:
object
Collect data from all available MCC amplifiers
Methods
getData
(self, mcc)Return all MCC settings for all amplifiers as dictionary
-
class
ipfx.bin.mcc_get_settings.
MultiClampControl
(dllPath=None)[source]¶ Bases:
object
Class for interacting with the MultiClamp Commander from Axon/Molecular Devices
Usage:
- ```
import mcc
m = mcc.MultiClampControl() UIDs = m.getUIDs() # output all found amplifiers m.selectUniqueID(next(iter(UIDs))) # select the first one (implicitly done by __init__) clampMode = m.GetMode() # return the clamp mode if m._handleError()[0]:
# handle error pass
Methods
CreateObject
(self)run this first to create self.hMCCmsg DestroyObject
(self)Do this last if you do it FindFirstMultiClamp
(self)Find the first available amplifier and return its parameter FindNextMultiClamp
(self)Find the next available amplifier and return its parameter getUIDs
(self)Return a list of all amplifier UIDs AutoBridgeBal AutoFastComp AutoLeakSub AutoOutputZero AutoPipetteOffset AutoSlowComp AutoWholeCellComp BuildErrorText Buzz CheckAPIVersion ClearMinus ClearPlus GetBridgeBalEnable GetBridgeBalResist GetBuzzDuration GetFastCompCap GetFastCompTau GetHolding GetHoldingEnable GetLeakSubEnable GetLeakSubResist GetMeterIrmsEnable GetMeterResistEnable GetMeterValue GetMode GetModeSwitchEnable GetNeutralizationCap GetNeutralizationEnable GetOscKillerEnable GetOutputZeroAmplitude GetOutputZeroEnable GetPipetteOffset GetPrimarySignal GetPrimarySignalGain GetPrimarySignalHPF GetPrimarySignalLPF GetPulseAmplitude GetPulseDuration GetRsCompBandwidth GetRsCompCorrection GetRsCompEnable GetRsCompPrediction GetScopeSignalLPF GetSecondarySignal GetSecondarySignalGain GetSecondarySignalLPF GetSlowCompCap GetSlowCompTau GetSlowCompTauX20Enable GetSlowCurrentInjEnable GetSlowCurrentInjLevel GetSlowCurrentInjSettlingTime GetTestSignalAmplitude GetTestSignalEnable GetTestSignalFrequency GetWholeCellCompCap GetWholeCellCompEnable GetWholeCellCompResist GetZapDuration Pulse QuickSelectButton Reset SelectMultiClamp SetBridgeBalEnable SetBridgeBalResist SetBuzzDuration SetFastCompCap SetFastCompTau SetHolding SetHoldingEnable SetLeakSubEnable SetLeakSubResist SetMeterIrmsEnable SetMeterResistEnable SetMode SetModeSwitchEnable SetNeutralizationCap SetNeutralizationEnable SetOscKillerEnable SetOutputZeroAmplitude SetOutputZeroEnable SetPipetteOffset SetPrimarySignal SetPrimarySignalGain SetPrimarySignalHPF SetPrimarySignalLPF SetPulseAmplitude SetPulseDuration SetRsCompBandwidth SetRsCompCorrection SetRsCompEnable SetRsCompPrediction SetScopeSignalLPF SetSecondarySignal SetSecondarySignalGain SetSecondarySignalLPF SetSlowCompCap SetSlowCompTau SetSlowCompTauX20Enable SetSlowCurrentInjEnable SetSlowCurrentInjLevel SetSlowCurrentInjSettlingTime SetTestSignalAmplitude SetTestSignalEnable SetTestSignalFrequency SetTimeOut SetWholeCellCompCap SetWholeCellCompEnable SetWholeCellCompResist SetZapDuration ToggleAlwaysOnTop ToggleResize Zap cleanup getChannel getSerial selectUniqueID
-
class
ipfx.bin.mcc_get_settings.
SettingsFetcher
(settingsFile)[source]¶ Bases:
watchdog.events.RegexMatchingEventHandler
Attributes: case_sensitive
(Read-only)
ignore_directories
(Read-only)
ignore_regexes
(Read-only)
regexes
(Read-only)
Methods
dispatch
(self, event)Dispatches events to the appropriate methods. on_any_event
(self, event)Catch-all event handler. on_closed
(self, event)Called when a file opened for writing is closed. on_created
(self, event)Called when a file or directory is created. on_deleted
(self, event)Called when a file or directory is deleted. on_modified
(self, event)Called when a file or directory is modified. on_moved
(self, event)Called when a file or a directory is moved or renamed. on_opened
(self, event)Called when a file is opened.
-
ipfx.bin.mcc_get_settings.
c_bool_p
¶ alias of
ipfx.bin.mcc_get_settings.LP_c_bool
-
ipfx.bin.mcc_get_settings.
c_double_p
¶ alias of
ipfx.bin.mcc_get_settings.LP_c_double
-
ipfx.bin.mcc_get_settings.
c_uint_p
¶ alias of
ipfx.bin.mcc_get_settings.LP_c_uint
ipfx.bin.nwb_to_pdf module¶
-
class
ipfx.bin.nwb_to_pdf.
PatchClampSeriesPlotData
(pcs)[source]¶ Bases:
object
- Data class for storing plotting information for PatchClampSeries
- pcs: neurodata patchClampSeries or derived object
Methods
add_annotation check_type get_annotation
-
class
ipfx.bin.nwb_to_pdf.
SingleSweep
(id)[source]¶ Bases:
object
Generic Class for storing sweep specific PatchClampSeries Data
Methods
add_acquisition add_stimulus get_acquisition get_stimulus num_acquisition num_stimulus
-
class
ipfx.bin.nwb_to_pdf.
SweepCollection
[source]¶ Bases:
object
Class for grouping sweep related PatchClampSeries
Methods
get
-
ipfx.bin.nwb_to_pdf.
check_stimset_reconstruction
(nwbfile, outfile)[source]¶ From a specially crafted NWB file this routine creates a PDF for checking the stimset reconstruction.
The NWB file must have data acquired on two headstages/electrodes where the second just reads back the stimulus set.
-
ipfx.bin.nwb_to_pdf.
create_regular_pdf
(nwbfile, outfile)[source]¶ convert a NeurodataWithoutBorders file to a PortableDocumentFile
-
ipfx.bin.nwb_to_pdf.
plot_patchClampSeries
(axis, pcs_data_plot, length)[source]¶ - plot a PatchClampSeries against the axis
- pcs_data_plot: class PatchClampSeriesPlotData axis: plt.axis length: number of points to plot
-
ipfx.bin.nwb_to_pdf.
plot_sweepdata
(sweepdata, axes, length, addXTicks=False)[source]¶ - plot the given sweep data (stimulus or acquisition) on the given axes
- sweepdata: dict(class PatchClampSeriesPlotData) (either acquisition or
- stimulus)
axes: np.ndarray(plt.axis) length: number of points to plot addXTicks: Add ticks and a label to the X axis at the bottom
-
ipfx.bin.nwb_to_pdf.
to_si
(d, sep=' ')[source]¶ taken from https://stackoverflow.com/a/15734251/7809404
Convert number to string with SI prefix
Example: >>> to_si(2500.0) '2.5 k'
>>> to_si(2.3E6) '2.3 M'
>>> to_si(2.3E-6) '2.3 µ'
>>> to_si(-2500.0) '-2.5 k'
>>> to_si(0) '0'
ipfx.bin.pipeline_from_specimen_id module¶
ipfx.bin.plot_ephys_nwb module¶
-
ipfx.bin.plot_ephys_nwb.
main
()[source]¶ Plot sweeps of a given ephys nwb file # Usage: $ python plot_ephys_nwb_file.py NWB_FILE_NAME
ipfx.bin.run_chirp_fv_extraction module¶
-
class
ipfx.bin.run_chirp_fv_extraction.
CollectChirpFeatureVectorParameters
(only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
argschema.schemas.ArgSchema
Attributes: - dict_class
- set_class
Methods
Meta
Options object for a Schema. OPTIONS_CLASS
alias of marshmallow.schema.SchemaOpts
dump
(self, obj[, many])Serialize an object to native Python data types according to this Schema’s fields. dumps
(self, obj[, many])Same as dump()
, except return a JSON-encoded string.get_attribute
(self, obj, attr, default)Defines how to pull values from an object to serialize. handle_error
(self, error, data)Custom error handler function for the schema. load
(self, data[, many, partial, unknown])Deserialize a data structure to an object defined by this Schema’s fields. loads
(self, json_data[, many, partial, unknown])Same as load()
, except it takes a JSON string as input.make_object
(self, in_data)marshmallow.pre_load decorated function for applying defaults on deserialation on_bind_field
(self, field_name, field_obj)Hook to modify a field when it is bound to the Schema. validate
(self, data[, many, partial])Validate data against the schema, returning a dictionary of validation errors. -
opts
= <marshmallow.schema.SchemaOpts object>¶
-
ipfx.bin.run_chirp_fv_extraction.
edit_ontology_data
(original_ontology_data, codes_to_rename, new_name_tag, new_core_tag)[source]¶
ipfx.bin.run_feature_collection module¶
-
class
ipfx.bin.run_feature_collection.
CollectFeatureParameters
(only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
argschema.schemas.ArgSchema
Attributes: - dict_class
- set_class
Methods
Meta
Options object for a Schema. OPTIONS_CLASS
alias of marshmallow.schema.SchemaOpts
dump
(self, obj[, many])Serialize an object to native Python data types according to this Schema’s fields. dumps
(self, obj[, many])Same as dump()
, except return a JSON-encoded string.get_attribute
(self, obj, attr, default)Defines how to pull values from an object to serialize. handle_error
(self, error, data)Custom error handler function for the schema. load
(self, data[, many, partial, unknown])Deserialize a data structure to an object defined by this Schema’s fields. loads
(self, json_data[, many, partial, unknown])Same as load()
, except it takes a JSON string as input.make_object
(self, in_data)marshmallow.pre_load decorated function for applying defaults on deserialation on_bind_field
(self, field_name, field_obj)Hook to modify a field when it is bound to the Schema. validate
(self, data[, many, partial])Validate data against the schema, returning a dictionary of validation errors. -
opts
= <marshmallow.schema.SchemaOpts object>¶
-
ipfx.bin.run_feature_collection.
data_for_specimen_id
(specimen_id, passed_only, data_source, ontology, file_list=None)[source]¶
-
ipfx.bin.run_feature_collection.
extract_features
(data_set, ramp_sweep_numbers, ssq_sweep_numbers, lsq_sweep_numbers, amp_interval=20, max_above_rheo=100)[source]¶
-
ipfx.bin.run_feature_collection.
first_spike_lsq
(spike_data, feature_list=['threshold_v', 'peak_v', 'upstroke', 'downstroke', 'upstroke_downstroke_ratio', 'width', 'fast_trough_v'])[source]¶
-
ipfx.bin.run_feature_collection.
first_spike_ramp
(ramp_analyzer, feature_list=['threshold_v', 'peak_v', 'upstroke', 'downstroke', 'upstroke_downstroke_ratio', 'width', 'fast_trough_v'])[source]¶
-
ipfx.bin.run_feature_collection.
first_spike_ssq
(ssq_analyzer, feature_list=['threshold_v', 'peak_v', 'upstroke', 'downstroke', 'upstroke_downstroke_ratio', 'width', 'fast_trough_v'])[source]¶
-
ipfx.bin.run_feature_collection.
mean_spike_lsq
(spike_data, feature_list=['threshold_v', 'peak_v', 'upstroke', 'downstroke', 'upstroke_downstroke_ratio', 'width', 'fast_trough_v'])[source]¶
ipfx.bin.run_feature_extraction module¶
ipfx.bin.run_feature_vector_extraction module¶
-
class
ipfx.bin.run_feature_vector_extraction.
CollectFeatureVectorParameters
(only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]¶ Bases:
argschema.schemas.ArgSchema
Attributes: - dict_class
- set_class
Methods
Meta
Options object for a Schema. OPTIONS_CLASS
alias of marshmallow.schema.SchemaOpts
dump
(self, obj[, many])Serialize an object to native Python data types according to this Schema’s fields. dumps
(self, obj[, many])Same as dump()
, except return a JSON-encoded string.get_attribute
(self, obj, attr, default)Defines how to pull values from an object to serialize. handle_error
(self, error, data)Custom error handler function for the schema. load
(self, data[, many, partial, unknown])Deserialize a data structure to an object defined by this Schema’s fields. loads
(self, json_data[, many, partial, unknown])Same as load()
, except it takes a JSON string as input.make_object
(self, in_data)marshmallow.pre_load decorated function for applying defaults on deserialation on_bind_field
(self, field_name, field_obj)Hook to modify a field when it is bound to the Schema. validate
(self, data[, many, partial])Validate data against the schema, returning a dictionary of validation errors. -
opts
= <marshmallow.schema.SchemaOpts object>¶
-
ipfx.bin.run_feature_vector_extraction.
data_for_specimen_id
(specimen_id, sweep_qc_option, data_source, ontology, ap_window_length=0.005, target_sampling_rate=50000, file_list=None)[source]¶ Extract feature vector from given cell identified by the specimen_id Parameters ———- specimen_id : int
cell identified- sweep_qc_option : str
- see CollectFeatureVectorParameters input schema for details
- data_source: str
- see CollectFeatureVectorParameters input schema for details
- ontology : stimulus.StimulusOntology
- mapping of stimuli names to stimulus codes
- ap_window_length : float
- see CollectFeatureVectorParameters input schema for details
- target_sampling_rate : float
- sampling rate
- file_list : list of str
- nwbfile names
- dict :
- features for a given cell specimen_id
-
ipfx.bin.run_feature_vector_extraction.
run_feature_vector_extraction
(output_dir, data_source, output_code, project, output_file_type, sweep_qc_option, include_failed_cells, run_parallel, ap_window_length, ids=None, file_list=None, **kwargs)[source]¶ Extract feature vector from a list of cells and save result to the output file(s)
Parameters: - output_dir : str
see CollectFeatureVectorParameters input schema for details
- data_source : str
see CollectFeatureVectorParameters input schema for details
- output_code: str
see CollectFeatureVectorParameters input schema for details
- project : str
see CollectFeatureVectorParameters input schema for details
- output_file_type : str
see CollectFeatureVectorParameters input schema for details
- sweep_qc_option: str
see CollectFeatureVectorParameters input schema for details
- include_failed_cells: bool
see CollectFeatureVectorParameters input schema for details
- run_parallel: bool
see CollectFeatureVectorParameters input schema for details
- ap_window_length: float
see CollectFeatureVectorParameters input schema for details
- ids: int
ids associated to each cell.
- file_list: list of str
nwbfile names
- kwargs
ipfx.bin.run_pipeline module¶
ipfx.bin.run_pipeline_from_nwb_file module¶
ipfx.bin.run_qc module¶
-
ipfx.bin.run_qc.
main
()[source]¶ Usage: python run_qc.py –input_json INPUT_JSON –output_json OUTPUT_JSON
-
ipfx.bin.run_qc.
qc_summary
(sweep_features, sweep_states, cell_features, cell_state)[source]¶ Output QC summary
Parameters: - sweep_features: list of dicts
- sweep_states: list of dict
- cell_features: list of dicts
- cell_state: dict
-
ipfx.bin.run_qc.
run_qc
(stimulus_ontology_file, cell_features, sweep_features, qc_criteria)[source]¶ Parameters: - stimulus_ontology_file : str
ontology file name
- cell_features: dict
cell features
- sweep_features : list of dicts
sweep features
- qc_criteria: dict
qc criteria
Returns: - dict
containing state of the cell and sweeps
ipfx.bin.run_sweep_extraction module¶
ipfx.bin.run_synphys_feature_vector_extraction module¶
ipfx.bin.run_x_to_nwb_conversion module¶
-
ipfx.bin.run_x_to_nwb_conversion.
convert
(inFileOrFolder, overwrite=False, fileType=None, outputMetadata=False, outputFeedbackChannel=False, multipleGroupsPerFile=False, compression=True)[source]¶ Convert the given file to a NeuroDataWithoutBorders file using pynwb
- Supported fileformats:
- ABF v2 files created by Clampex
- DAT files created by Patchmaster v2x90
Parameters: - inFileOrFolder – path to a file or folder
- overwrite – overwrite output file, defaults to False
- fileType – file type to be converted, must be passed iff inFileOrFolder refers to a folder
- outputMetadata – output metadata of the file, helpful for debugging
- outputFeedbackChannel – Output ADC data which stems from stimulus feedback channels (ignored for DAT files)
- multipleGroupsPerFile – Write all Groups in the DAT file into one NWB file. By default we create one NWB per Group (ignored for ABF files).
- compression – Toggle compression for HDF5 datasets
Returns: path of the created NWB file
ipfx.bin.validate_experiment module¶
-
ipfx.bin.validate_experiment.
get_pipeline_output_json
(storage_dir, err_id)[source]¶ Return the name of the output file giving preference to the newer version Parameters ———- storage_dir: str of storage directory err_id: str err_id Returns ——- pipeline_output_json: str filename