ipfx.x_to_nwb package¶
Submodules¶
ipfx.x_to_nwb.ABFConverter module¶
Convert ABF files, created by PClamp/Clampex, to NWB v2 files.
ipfx.x_to_nwb.DatConverter module¶
-
class
ipfx.x_to_nwb.DatConverter.
DatConverter
(inFile, outFile, multipleGroupsPerFile=False, compression=True)[source]¶ Bases:
object
Methods
outputMetadata
(inFile)Create a file with metadata of the given DAT file.
ipfx.x_to_nwb.conversion_utils module¶
Miscellaneous helper routines for the ABF/DAT to NWB v2 (aka X to NWB) conversion functionality.
-
ipfx.x_to_nwb.conversion_utils.
clampModeToString
(clampMode)[source]¶ Return the given clamp mode as human readable string. Useful for error messages.
-
ipfx.x_to_nwb.conversion_utils.
convertDataset
(array, compression)[source]¶ Convert to FP32 and optionally request compression for the given array and return it wrapped.
-
ipfx.x_to_nwb.conversion_utils.
createCycleID
(numbers, total)[source]¶ Create an integer from all numbers which is unique for that combination.
Param: numbers: Iterable holding non-negative integer numbers Param: total: Total number of TimeSeries written to the NWB file
-
ipfx.x_to_nwb.conversion_utils.
createSeriesName
(prefix, number, total)[source]¶ Format a unique series group name of the form prefix_XXX where XXX is the formatted number long enough for total number of groups.
-
ipfx.x_to_nwb.conversion_utils.
getAcquiredSeriesClass
(clampMode)[source]¶ Return the appropriate pynwb acquisition class for the given clamp mode.
-
ipfx.x_to_nwb.conversion_utils.
getChannelRecordIndex
(pgf, sweep, trace)[source]¶ Given a pgf node, a SweepRecord and TraceRecord this returns the corresponding ChannelRecordStimulus node as index.
-
ipfx.x_to_nwb.conversion_utils.
getPackageInfo
()[source]¶ Return a dictionary with version information for the allensdk package
ipfx.x_to_nwb.hr_bundle module¶
-
class
ipfx.x_to_nwb.hr_bundle.
Bundle
(file_name)[source]¶ Bases:
object
Represent a PATCHMASTER tree file in memory
Attributes: amp
The Amplifier object from this bundle.
data
The Data object from this bundle.
mrk
The Markers object from this bundle.
mth
The ProtocolMethod object from this bundle.
onl
The Online Analysis object from this bundle.
pgf
The Stimulus Template object from this bundle.
pul
The Pulsed object from this bundle.
sol
The Solutions object from this bundle.
-
amp
¶ The Amplifier object from this bundle.
-
data
¶ The Data object from this bundle.
-
item_classes
= {'.amp': <class 'ipfx.x_to_nwb.hr_nodes.AmplifierFile'>, '.dat': <class 'ipfx.x_to_nwb.hr_nodes.RawData'>, '.mrk': <class 'ipfx.x_to_nwb.hr_nodes.Marker'>, '.mth': <class 'ipfx.x_to_nwb.hr_nodes.ProtocolMethod'>, '.onl': <class 'ipfx.x_to_nwb.hr_nodes.Analysis'>, '.pgf': <class 'ipfx.x_to_nwb.hr_nodes.StimulusTemplate'>, '.pul': <class 'ipfx.x_to_nwb.hr_nodes.Pulsed'>, '.sol': <class 'ipfx.x_to_nwb.hr_nodes.Solutions'>}¶
-
mrk
¶ The Markers object from this bundle.
-
mth
¶ The ProtocolMethod object from this bundle.
-
onl
¶ The Online Analysis object from this bundle.
-
pgf
¶ The Stimulus Template object from this bundle.
-
pul
¶ The Pulsed object from this bundle.
-
sol
¶ The Solutions object from this bundle.
ipfx.x_to_nwb.hr_nodes module¶
All supported nodes are listed here. The root node of each bundle calls the TreeNode constructor explicitly the other are plain children of the root nodes.
- Documentation:
- https://github.com/neurodroid/stimfit/blob/master/src/libstfio/heka/hekalib.cpp
- ftp://server.hekahome.de/pub/FileFormat/Patchmasterv9/
- For the field_info type parameters see https://docs.python.org/3/library/struct.html#format-characters
- The CARD types are unsigned, see e.g. https://www.common-lisp.net/project/cmucl/doc/clx/1_6_Data_Types.html
The nodes are tailored for patchmaster version 2x90.x.
-
class
ipfx.x_to_nwb.hr_nodes.
AmplifierFile
(fh, endianess)[source]¶ Bases:
ipfx.x_to_nwb.hr_treenode.TreeNode
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('Version', 'i'), ('Mark', 'i'), ('VersionName', '32s', <function cstr>), ('AmplifierName', '32s', <function cstr>), ('Amplifier', 'c'), ('ADBoard', 'c'), ('Creator', 'c'), ('Filler1', 'b', None), ('CRC', 'I')]¶
-
rectypes
= [None, <class 'ipfx.x_to_nwb.hr_nodes.AmplifierSeriesRecord'>, <class 'ipfx.x_to_nwb.hr_nodes.AmplifierStateRecord'>]¶
-
required_size
= 80¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
AmplifierSeriesRecord
(fh, endianess, record_types, level_sizes, level=0)[source]¶ Bases:
ipfx.x_to_nwb.hr_treenode.TreeNode
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('Mark', 'i'), ('SeriesCount', 'i'), ('Filler1', 'i', None), ('CRC', 'I')]¶
-
required_size
= 16¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
AmplifierState
(data, endian='<')[source]¶ Bases:
ipfx.x_to_nwb.hr_struct.Struct
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('StateVersion', '8s', <function cstr>), ('RealCurrentGain', 'd'), ('RealF2Bandwidth', 'd'), ('F2Frequency', 'd'), ('RsValue', 'd'), ('RsFraction', 'd'), ('GLeak', 'd'), ('CFastAmp1', 'd'), ('CFastAmp2', 'd'), ('CFastTau', 'd'), ('CSlow', 'd'), ('GSeries', 'd'), ('StimDacScale', 'd'), ('CCStimScale', 'd'), ('VHold', 'd'), ('LastVHold', 'd'), ('VpOffset', 'd'), ('VLiquidJunction', 'd'), ('CCIHold', 'd'), ('CSlowStimVolts', 'd'), ('CCTrackVHold', 'd'), ('TimeoutLength', 'd'), ('SearchDelay', 'd'), ('MConductance', 'd'), ('MCapacitance', 'd'), ('SerialNumber', '8s', <function cstr>), ('E9Boards', 'h'), ('CSlowCycles', 'h'), ('IMonAdc', 'h'), ('VMonAdc', 'h'), ('MuxAdc', 'h'), ('TstDac', 'h'), ('StimDac', 'h'), ('StimDacOffset', 'h'), ('MaxDigitalBit', 'h'), ('HasCFastHigh', 'b'), ('CFastHigh', 'b'), ('HasBathSense', 'b'), ('BathSense', 'b'), ('HasF2Bypass', 'b'), ('F2Mode', 'b'), ('AmplKind', 'b', <function getAmplifierType>), ('IsEpc9N', 'b'), ('ADBoard', 'b', <function getADBoard>), ('BoardVersion', 'b'), ('ActiveE9Board', 'b'), ('Mode', 'b', <function getClampMode>), ('Range', 'b'), ('F2Response', 'b'), ('RsOn', 'b'), ('CSlowRange', 'b'), ('CCRange', 'b'), ('CCGain', 'b'), ('CSlowToTstDac', 'b'), ('StimPath', 'b'), ('CCTrackTau', 'b'), ('WasClipping', 'b'), ('RepetitiveCSlow', 'b'), ('LastCSlowRange', 'b'), ('Old2', 'b', None), ('CanCCFast', 'b'), ('CanLowCCRange', 'b'), ('CanHighCCRange', 'b'), ('CanCCTracking', 'b'), ('HasVmonPath', 'b'), ('HasNewCCMode', 'b'), ('Selector', 'c'), ('HoldInverted', 'b'), ('AutoCFast', '?'), ('AutoCSlow', '?'), ('HasVmonX100', 'b'), ('TestDacOn', 'b'), ('QMuxAdcOn', 'b'), ('Imon1Bandwidth', 'd'), ('StimScale', 'd'), ('Gain', 'b', <function getAmplifierGain>), ('Filter1', 'b'), ('StimFilterOn', 'b'), ('RsSlow', 'b'), ('Old1', 'b', None), ('CCCFastOn', '?'), ('CCFastSpeed', 'b'), ('F2Source', 'b'), ('TestRange', 'b'), ('TestDacPath', 'b'), ('MuxChannel', 'b'), ('MuxGain64', 'b'), ('VmonX100', 'b'), ('IsQuadro', 'b'), ('F1Mode', 'b'), ('Old3', 'b', None), ('StimFilterHz', 'd'), ('RsTau', 'd'), ('DacToAdcDelay', 'd'), ('InputFilterTau', 'd'), ('OutputFilterTau', 'd'), ('vMonFactor', 'd', None), ('CalibDate', '16s', <function cstr>), ('VmonOffset', 'd'), ('EEPROMKind', 'b'), ('VrefX2', 'b'), ('HasVrefX2AndF2Vmon', 'b'), ('Spare1', 'b', None), ('Spare2', 'b', None), ('Spare3', 'b', None), ('Spare4', 'b', None), ('Spare5', 'b', None), ('CCStimDacScale', 'd'), ('VmonFiltBandwidth', 'd'), ('VmonFiltFrequency', 'd')]¶
-
required_size
= 400¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
AmplifierStateRecord
(fh, endianess, record_types, level_sizes, level=0)[source]¶ Bases:
ipfx.x_to_nwb.hr_treenode.TreeNode
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('Mark', 'i'), ('StateCount', 'i'), ('StateVersion', 'b'), ('Filler1', 'b', None), ('Filler2', 'b', None), ('Filler3', 'b', None), ('Filler4', 'i', None), ('LockInParams', <class 'ipfx.x_to_nwb.hr_nodes.LockInParams'>), ('AmplifierState', <class 'ipfx.x_to_nwb.hr_nodes.AmplifierState'>), ('IntSol', 'i'), ('ExtSol', 'i'), ('Filler5', '36s', None), ('CRC', 'I')]¶
-
required_size
= 560¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
Analysis
(fh, endianess)[source]¶ Bases:
ipfx.x_to_nwb.hr_treenode.TreeNode
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('Version', 'i'), ('Mark', 'i'), ('VersionName', '32s', <function cstr>), ('Obsolete', 'b', None), ('MaxTraces', 'c'), ('WinDefined', '?'), ('rt1', 'b'), ('CRC', 'I'), ('WinNr', '12b'), ('rt2', 'i')]¶
-
rectypes
= [None, <class 'ipfx.x_to_nwb.hr_nodes.AnalysisMethodRecord'>, <class 'ipfx.x_to_nwb.hr_nodes.AnalysisFunctionRecord'>]¶
-
required_size
= 64¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
AnalysisEntryRecord
(data, endian='<')[source]¶ Bases:
ipfx.x_to_nwb.hr_struct.Struct
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('XWave', 'h'), ('YWave', 'h'), ('MarkerSize', 'h'), ('MarkerColorRed', 'H'), ('MarkerColorGreen', 'H'), ('MarkerColorBlue', 'H'), ('MarkerKind', 'b'), ('EActive', '?'), ('Line', '?'), ('TraceColor', '?')]¶
-
required_size
= 16¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
AnalysisFunctionRecord
(fh, endianess, record_types, level_sizes, level=0)[source]¶ Bases:
ipfx.x_to_nwb.hr_treenode.TreeNode
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('Mark', 'i'), ('Name', '32s', <function cstr>), ('Unit', '8s', <function cstr>), ('LeftOperand', 'h'), ('RightOperand', 'h'), ('LeftBound', 'd'), ('RightBound', 'd'), ('Constant', 'd'), ('XSegmentOffset', 'i'), ('YSegmentOffset', 'i'), ('TcEnumarator', 'h'), ('Function', 'b'), ('DoNotebook', '?'), ('NoFit', '?'), ('NewName', '?'), ('TargetValue', 'h'), ('CursorKind', 'b'), ('TcKind1', 'b'), ('TcKind2', 'b'), ('CursorSource', 'b'), ('CRC', 'I'), ('Equation', '64s', <function cstr>), ('BaselineMode', 'b'), ('SearchDirection', 'b'), ('SourceValue', 'h'), ('CursorAnker', 'h'), ('Spare1', 'h', None)]¶
-
required_size
= 168¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
AnalysisGraphRecord
(data, endian='<')[source]¶ Bases:
ipfx.x_to_nwb.hr_struct.Struct
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('GActive', '?'), ('Overlay', '?'), ('Wrap', 'b'), ('OvrlSwp', '?'), ('Normalize', 'b'), ('Spare1', 'b', None), ('Spare2', 'b', None), ('Spare3', 'b', None), ('XScaling', <class 'ipfx.x_to_nwb.hr_nodes.AnalysisScalingRecord'>), ('YScaling', <class 'ipfx.x_to_nwb.hr_nodes.AnalysisScalingRecord'>), ('Entry0', <class 'ipfx.x_to_nwb.hr_nodes.AnalysisEntryRecord'>), ('Entry1', <class 'ipfx.x_to_nwb.hr_nodes.AnalysisEntryRecord'>), ('Entry2', <class 'ipfx.x_to_nwb.hr_nodes.AnalysisEntryRecord'>), ('Entry3', <class 'ipfx.x_to_nwb.hr_nodes.AnalysisEntryRecord'>)]¶
-
required_size
= 152¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
AnalysisMethodRecord
(fh, endianess, record_types, level_sizes, level=0)[source]¶ Bases:
ipfx.x_to_nwb.hr_treenode.TreeNode
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('Mark', 'i'), ('EntryName', '32s', <function cstr>), ('SharedXWin1', '?'), ('SharedXWin2', '?'), ('m1', '?'), ('m2', '?'), ('Graph0', <class 'ipfx.x_to_nwb.hr_struct.AnalysisGraphRecord[12]'>), ('m3', 'i'), ('CRC', 'I'), ('Headers', '384s', <function cstr>), ('LastXmin', '12d'), ('LastXmax', '12d'), ('LastYmin', '12d'), ('LastYmax', '12d')]¶
-
required_size
= 2640¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
AnalysisScalingRecord
(data, endian='<')[source]¶ Bases:
ipfx.x_to_nwb.hr_struct.Struct
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('MinValue', 'd'), ('MaxValue', 'd'), ('GridFactor', 'd'), ('TicLength', 'h'), ('TicNumber', 'h'), ('TicDirection', 'b'), ('AxisLevel', 'b'), ('AxisType', 'b'), ('ScaleMode', 'b'), ('NoUnit', '?'), ('Obsolete', '?', None), ('ZeroLine', '?'), ('Grid', '?'), ('Nice', '?'), ('Label', '?'), ('Centered', '?'), ('IncludeZero', '?')]¶
-
required_size
= 40¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
BundleHeader
(data, endian='<')[source]¶ Bases:
ipfx.x_to_nwb.hr_struct.Struct
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('Signature', '8s', <function cstr>), ('Version', '32s', <function cstr>), ('Time', 'd'), ('Items', 'i'), ('IsLittleEndian', '?'), ('Reserved', '11s', None), ('BundleItems', <class 'ipfx.x_to_nwb.hr_struct.BundleItem[12]'>)]¶
-
required_size
= 256¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
BundleItem
(data, endian='<')[source]¶ Bases:
ipfx.x_to_nwb.hr_struct.Struct
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('Start', 'i'), ('Length', 'i'), ('Extension', '8s', <function cstr>)]¶
-
required_size
= 16¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
ChannelRecordStimulus
(fh, endianess, record_types, level_sizes, level=0)[source]¶ Bases:
ipfx.x_to_nwb.hr_treenode.TreeNode
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('Mark', 'i'), ('LinkedChannel', 'i'), ('CompressionFactor', 'i'), ('YUnit', '8s', <function cstr>), ('AdcChannel', 'H'), ('AdcMode', 'b', <function getADCMode>), ('DoWrite', '?'), ('LeakStore', 'b'), ('AmplMode', 'b', <function getAmplMode>), ('OwnSegTime', '?'), ('SetLastSegVmemb', '?'), ('DacChannel', 'H'), ('DacMode', 'b'), ('HasLockInSquare', 'b'), ('RelevantXSegment', 'i'), ('RelevantYSegment', 'i'), ('DacUnit', '8s', <function cstr>), ('Holding', 'd'), ('LeakHolding', 'd'), ('LeakSize', 'd'), ('LeakHoldMode', 'b'), ('LeakAlternate', '?'), ('AltLeakAveraging', '?'), ('LeakPulseOn', '?'), ('StimToDacID', 'H', <function convertStimToDacID>), ('CompressionMode', 'H'), ('CompressionSkip', 'i'), ('DacBit', 'H'), ('HasLockInSine', '?'), ('BreakMode', 'b'), ('ZeroSeg', 'i'), ('StimSweep', 'i'), ('Sine_Cycle', 'd'), ('Sine_Amplitude', 'd'), ('LockIn_VReversal', 'd'), ('Chirp_StartFreq', 'd'), ('Chirp_EndFreq', 'd'), ('Chirp_MinPoints', 'd'), ('Square_NegAmpl', 'd'), ('Square_DurFactor', 'd'), ('LockIn_Skip', 'i'), ('Photo_MaxCycles', 'i'), ('Photo_SegmentNo', 'i'), ('LockIn_AvgCycles', 'i'), ('Imaging_RoiNo', 'i'), ('Chirp_Skip', 'i'), ('Chirp_Amplitude', 'd'), ('Photo_Adapt', 'b'), ('Sine_Kind', 'b'), ('Chirp_PreChirp', 'b'), ('Sine_Source', 'b'), ('Square_NegSource', 'b'), ('Square_PosSource', 'b'), ('Chirp_Kind', 'b', <function getChirpKind>), ('Chirp_Source', 'b'), ('DacOffset', 'd'), ('AdcOffset', 'd'), ('TraceMathFormat', 'b'), ('HasChirp', '?'), ('Square_Kind', 'b', <function getSquareKind>), ('Filler1', '5s', None), ('Square_BaseIncr', 'd'), ('Square_Cycle', 'd'), ('Square_PosAmpl', 'd'), ('CompressionOffset', 'i'), ('PhotoMode', 'i'), ('BreakLevel', 'd'), ('TraceMath', '128s', <function cstr>), ('Filler2', 'i', None), ('CRC', 'I'), ('UnknownFiller', '?', None)]¶
-
required_size
= 401¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
GroupRecord
(fh, endianess, record_types, level_sizes, level=0)[source]¶ Bases:
ipfx.x_to_nwb.hr_treenode.TreeNode
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('Mark', 'i'), ('Label', '32s', <function cstr>), ('Text', '80s', <function cstr>), ('ExperimentNumber', 'i'), ('GroupCount', 'i'), ('CRC', 'I'), ('MatrixWidth', 'd'), ('MatrixHeight', 'd')]¶
-
required_size
= 144¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
LockInParams
(data, endian='<')[source]¶ Bases:
ipfx.x_to_nwb.hr_struct.Struct
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('ExtCalPhase', 'd'), ('ExtCalAtten', 'd'), ('PLPhase', 'd'), ('PLPhaseY1', 'd'), ('PLPhaseY2', 'd'), ('UsedPhaseShift', 'd'), ('UsedAttenuation', 'd'), ('Spares2', 'd', None), ('ExtCalValid', '?'), ('PLPhaseValid', '?'), ('LockInMode', 'b'), ('CalMode', 'b'), ('Spares', '28s', None)]¶
-
required_size
= 96¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
Marker
(fh, endianess)[source]¶ Bases:
ipfx.x_to_nwb.hr_treenode.TreeNode
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('Version', 'i'), ('CRC', 'I')]¶
-
rectypes
= [None]¶
-
required_size
= 8¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
ProtocolMethod
(fh, endianess)[source]¶ Bases:
ipfx.x_to_nwb.hr_treenode.TreeNode
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('Version', 'i'), ('Mark', 'i'), ('VersionName', '32s', <function cstr>), ('MaxSamples', 'i'), ('Filler1', 'i', None), ('Params', '10s', <function cstr>), ('ParamText', '320s', <function cstr>), ('Reserved', '128s', None), ('Filler2', 'i', None), ('CRC', 'I')]¶
-
rectypes
= [None]¶
-
required_size
= 514¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
Pulsed
(fh, endianess)[source]¶ Bases:
ipfx.x_to_nwb.hr_treenode.TreeNode
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('Version', 'i'), ('Mark', 'i'), ('VersionName', '32s', <function cstr>), ('AuxFileName', '80s', <function cstr>), ('RootText', '400s', <function cstr>), ('StartTime', 'd'), ('MaxSamples', 'i'), ('CRC', 'I'), ('Features', 'h'), ('Filler1', 'h', None), ('Filler2', 'i', None), ('RoTcEnumerator', '32h'), ('RoTcKind', '32s', <function cstr>)]¶
-
rectypes
= [None, <class 'ipfx.x_to_nwb.hr_nodes.GroupRecord'>, <class 'ipfx.x_to_nwb.hr_nodes.SeriesRecord'>, <class 'ipfx.x_to_nwb.hr_nodes.SweepRecord'>, <class 'ipfx.x_to_nwb.hr_nodes.TraceRecord'>]¶
-
required_size
= 640¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
SeriesRecord
(fh, endianess, record_types, level_sizes, level=0)[source]¶ Bases:
ipfx.x_to_nwb.hr_treenode.TreeNode
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('Mark', 'i'), ('Label', '32s', <function cstr>), ('Comment', '80s', <function cstr>), ('SeriesCount', 'i'), ('NumberSweeps', 'i'), ('AmplStateOffset', 'i'), ('AmplStateSeries', 'i'), ('MethodTag', 'i'), ('Time', 'd'), ('PageWidth', 'd'), ('SwUserParamDescr', <class 'ipfx.x_to_nwb.hr_struct.UserParamDescrType[4]'>), ('MethodName', '32s', None), ('UserParams', '4d'), ('LockInParams', <class 'ipfx.x_to_nwb.hr_nodes.LockInParams'>), ('AmplifierState', <class 'ipfx.x_to_nwb.hr_nodes.AmplifierState'>), ('Username', '80s', <function cstr>), ('SeUserParamDescr1', <class 'ipfx.x_to_nwb.hr_struct.UserParamDescrType[4]'>), ('Filler1', 'i', None), ('CRC', 'I'), ('SeUserParams2', '4d'), ('SeUserParamDescr2', <class 'ipfx.x_to_nwb.hr_struct.UserParamDescrType[4]'>), ('ScanParams', '96s', <function cstr>)]¶
-
required_size
= 1408¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
Solutions
(fh, endianess)[source]¶ Bases:
ipfx.x_to_nwb.hr_treenode.TreeNode
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('RoVersion', 'H'), ('RoDataBaseName', '80s', <function cstr>), ('RoSpare1', 'H', None), ('RoCRC', 'I')]¶
-
rectypes
= [None]¶
-
required_size
= 88¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
StimSegmentRecord
(fh, endianess, record_types, level_sizes, level=0)[source]¶ Bases:
ipfx.x_to_nwb.hr_treenode.TreeNode
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('Mark', 'i'), ('Class', 'b', <function getSegmentClass>), ('StoreKind', 'b', <function getStoreType>), ('VoltageIncMode', 'b', <function getIncrementMode>), ('DurationIncMode', 'b', <function getIncrementMode>), ('Voltage', 'd'), ('VoltageSource', 'i', <function getSourceType>), ('DeltaVFactor', 'd'), ('DeltaVIncrement', 'd'), ('Duration', 'd'), ('DurationSource', 'i', <function getSourceType>), ('DeltaTFactor', 'd'), ('DeltaTIncrement', 'd'), ('Filler1', 'i', None), ('CRC', 'I'), ('ScanRate', 'd')]¶
-
required_size
= 80¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
StimulationRecord
(fh, endianess, record_types, level_sizes, level=0)[source]¶ Bases:
ipfx.x_to_nwb.hr_treenode.TreeNode
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('Mark', 'i'), ('EntryName', '32s', <function cstr>), ('FileName', '32s', <function cstr>), ('AnalName', '32s', <function cstr>), ('DataStartSegment', 'i'), ('DataStartTime', 'd'), ('SampleInterval', 'd'), ('SweepInterval', 'd'), ('LeakDelay', 'd'), ('FilterFactor', 'd'), ('NumberSweeps', 'i'), ('NumberLeaks', 'i'), ('NumberAverages', 'i'), ('ActualAdcChannels', 'i'), ('ActualDacChannels', 'i'), ('ExtTrigger', 'b'), ('NoStartWait', '?'), ('UseScanRates', '?'), ('NoContAq', '?'), ('HasLockIn', '?'), ('OldStartMacKind', '?'), ('OldEndMacKind', '?'), ('AutoRange', 'b'), ('BreakNext', '?'), ('IsExpanded', '?'), ('LeakCompMode', '?'), ('HasChirp', '?'), ('OldStartMacro', '32s', <function cstr>), ('OldEndMacro', '32s', <function cstr>), ('IsGapFree', '?'), ('HandledExternally', '?'), ('Filler1', '?', None), ('Filler2', '?', None), ('CRC', 'I')]¶
-
required_size
= 248¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
StimulusTemplate
(fh, endianess)[source]¶ Bases:
ipfx.x_to_nwb.hr_treenode.TreeNode
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('Version', 'i'), ('Mark', 'i'), ('VersionName', '32s', <function cstr>), ('MaxSamples', 'i'), ('Filler1', 'i', None), ('StimParams', '10d'), ('StimParamChars', '320s', <function cstr>), ('Reserved', '128s', None), ('Filler2', 'i', None), ('CRC', 'I')]¶
-
rectypes
= [None, <class 'ipfx.x_to_nwb.hr_nodes.StimulationRecord'>, <class 'ipfx.x_to_nwb.hr_nodes.ChannelRecordStimulus'>, <class 'ipfx.x_to_nwb.hr_nodes.StimSegmentRecord'>]¶
-
required_size
= 584¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
SweepRecord
(fh, endianess, record_types, level_sizes, level=0)[source]¶ Bases:
ipfx.x_to_nwb.hr_treenode.TreeNode
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('Mark', 'i'), ('Label', '32s', <function cstr>), ('AuxDataFileOffset', 'i'), ('StimCount', 'i'), ('SweepCount', 'i'), ('Time', 'd'), ('Timer', 'd'), ('SwUserParams', '4d'), ('Temperature', 'd'), ('OldIntSol', 'i'), ('OldExtSol', 'i'), ('DigitalIn', 'h'), ('SweepKind', 'h'), ('DigitalOut', 'h'), ('Filler1', 'h', None), ('Markers', '4d'), ('Filler2', 'i', None), ('CRC', 'I'), ('SwHolding', '16d')]¶
-
required_size
= 288¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
TraceRecord
(fh, endianess, record_types, level_sizes, level=0)[source]¶ Bases:
ipfx.x_to_nwb.hr_treenode.TreeNode
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('Mark', 'i'), ('Label', '32s', <function cstr>), ('TraceCount', 'i'), ('Data', 'i'), ('DataPoints', 'i'), ('InternalSolution', 'i'), ('AverageCount', 'i'), ('LeakCount', 'i'), ('LeakTraces', 'i'), ('DataKind', 'h', <function convertDataKind>), ('UseXStart', '?'), ('Kind', 'b'), ('RecordingMode', 'b', <function getRecordingMode>), ('AmplIndex', 'b'), ('DataFormat', 'b', <function getDataFormat>), ('DataAbscissa', 'b'), ('DataScaler', 'd'), ('TimeOffset', 'd'), ('ZeroData', 'd'), ('YUnit', '8s', <function cstr>), ('XInterval', 'd'), ('XStart', 'd'), ('XUnit', '8s', <function cstr>), ('YRange', 'd'), ('YOffset', 'd'), ('Bandwidth', 'd'), ('PipetteResistance', 'd'), ('CellPotential', 'd'), ('SealResistance', 'd'), ('CSlow', 'd'), ('GSeries', 'd'), ('RsValue', 'd'), ('GLeak', 'd'), ('MConductance', 'd'), ('LinkDAChannel', 'i'), ('ValidYrange', '?'), ('AdcMode', 'b', <function getADCMode>), ('AdcChannel', 'h'), ('Ymin', 'd'), ('Ymax', 'd'), ('SourceChannel', 'i'), ('ExternalSolution', 'i'), ('CM', 'd'), ('GM', 'd'), ('Phase', 'd'), ('DataCRC', 'I'), ('CRC', 'I'), ('GS', 'd'), ('SelfChannel', 'i'), ('InterleaveSize', 'i'), ('InterleaveSkip', 'i'), ('ImageIndex', 'i'), ('Markers', '10d'), ('SECM_X', 'd'), ('SECM_Y', 'd'), ('SECM_Z', 'd'), ('Holding', 'd'), ('Enumerator', 'i'), ('XTrace', 'i'), ('IntSolValue', 'd'), ('ExtSolValue', 'd'), ('IntSolName', '32s', <function cstr>), ('ExtSolName', '32s', <function cstr>), ('DataPedestal', 'd')]¶
-
required_size
= 512¶
-
-
class
ipfx.x_to_nwb.hr_nodes.
UserParamDescrType
(data, endian='<')[source]¶ Bases:
ipfx.x_to_nwb.hr_struct.Struct
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
field_info
= [('Name', '32s', <function cstr>), ('Unit', '8s', <function cstr>)]¶
-
required_size
= 40¶
-
ipfx.x_to_nwb.hr_segments module¶
Create a numpy array with the stimulus set data from the stored parameters.
-
class
ipfx.x_to_nwb.hr_segments.
ChirpSegment
(stimRec, channelRec, segmentRec)[source]¶ Bases:
ipfx.x_to_nwb.hr_segments.Segment
Methods
applyAmplitudeScale
(self, amplitude)Scale the amplitude so that we get the correct units. calculateNumberOfPoints
(self, duration)Return the number of points of this segment. createArray
(self, sweep)Return a numpy array with the stimset data. doStepping
(self, sweepNo)Apply the delta modes the given number of times (once per sweep) getAmplitude
(self, channelRec, segmentRec)Extract the value of the amplitude from the ChannelRecordStimulus and the StimSegmentRecord. hasXDelta
(self)Return true if delta mode is active for the x dimension. hasYDelta
(self)Return true if delta mode is active for the y dimension.
-
class
ipfx.x_to_nwb.hr_segments.
ConstantSegment
(stimRec, channelRec, segmentRec)[source]¶ Bases:
ipfx.x_to_nwb.hr_segments.Segment
Methods
applyAmplitudeScale
(self, amplitude)Scale the amplitude so that we get the correct units. calculateNumberOfPoints
(self, duration)Return the number of points of this segment. createArray
(self, sweep)Return a numpy array with the stimset data. doStepping
(self, sweepNo)Apply the delta modes the given number of times (once per sweep) getAmplitude
(self, channelRec, segmentRec)Extract the value of the amplitude from the ChannelRecordStimulus and the StimSegmentRecord. hasXDelta
(self)Return true if delta mode is active for the x dimension. hasYDelta
(self)Return true if delta mode is active for the y dimension.
-
class
ipfx.x_to_nwb.hr_segments.
RampSegment
(stimRec, channelRec, segmentRec)[source]¶ Bases:
ipfx.x_to_nwb.hr_segments.Segment
Methods
applyAmplitudeScale
(self, amplitude)Scale the amplitude so that we get the correct units. calculateNumberOfPoints
(self, duration)Return the number of points of this segment. createArray
(self, sweep)Return a numpy array with the stimset data. doStepping
(self, sweepNo)Apply the delta modes the given number of times (once per sweep) getAmplitude
(self, channelRec, segmentRec)Extract the value of the amplitude from the ChannelRecordStimulus and the StimSegmentRecord. hasXDelta
(self)Return true if delta mode is active for the x dimension. hasYDelta
(self)Return true if delta mode is active for the y dimension.
-
class
ipfx.x_to_nwb.hr_segments.
Segment
(stimRec, channelRec, segmentRec)[source]¶ Bases:
abc.ABC
Base class for all segment types. Derived class must implement createArray only.
The following segment types are supported: - Constant - Ramp - Square - Chirp
Support for the following types is missing: - Continous - Sine
Note: Only currently used segment options/modes/specialities are implemented.
Methods
applyAmplitudeScale
(self, amplitude)Scale the amplitude so that we get the correct units. calculateNumberOfPoints
(self, duration)Return the number of points of this segment. createArray
(self, sweep)Return a numpy array with the stimset data. doStepping
(self, sweepNo)Apply the delta modes the given number of times (once per sweep) getAmplitude
(self, channelRec, segmentRec)Extract the value of the amplitude from the ChannelRecordStimulus and the StimSegmentRecord. hasXDelta
(self)Return true if delta mode is active for the x dimension. hasYDelta
(self)Return true if delta mode is active for the y dimension. -
applyAmplitudeScale
(self, amplitude)[source]¶ Scale the amplitude so that we get the correct units. See also Segment.createArray.
-
createArray
(self, sweep)[source]¶ Return a numpy array with the stimset data.
Units are [mV] for voltage clamp and [pA] for current clamp.
-
-
class
ipfx.x_to_nwb.hr_segments.
SquareSegment
(stimRec, channelRec, segmentRec)[source]¶ Bases:
ipfx.x_to_nwb.hr_segments.Segment
Methods
applyAmplitudeScale
(self, amplitude)Scale the amplitude so that we get the correct units. calculateNumberOfPoints
(self, duration)Return the number of points of this segment. createArray
(self, sweep)Return a numpy array with the stimset data. doStepping
(self, sweepNo)Apply the delta modes the given number of times (once per sweep) getAmplitude
(self, channelRec, segmentRec)Extract the value of the amplitude from the ChannelRecordStimulus and the StimSegmentRecord. hasXDelta
(self)Return true if delta mode is active for the x dimension. hasYDelta
(self)Return true if delta mode is active for the y dimension.
ipfx.x_to_nwb.hr_stimsetgenerator module¶
ipfx.x_to_nwb.hr_struct module¶
-
class
ipfx.x_to_nwb.hr_struct.
Struct
(data, endian='<')[source]¶ Bases:
object
High-level wrapper around struct.Struct that makes it a bit easier to unpack large, nested structures.
- Unpacks to dictionary allowing fields to be retrieved by name
- Optionally massages field data on read
- Handles arrays and nested structures
fields must be a list of tuples like (name, format) or (name, format, function) where format must be a simple struct format string like ‘i’, ‘d’, ’32s’, or ‘4d’; or another Struct instance.
function may be either a function that filters the data for that field or None to exclude the field altogether.
If size is given, then an exception will be raised if the final struct size does not match the given size.
Example:
class MyStruct(Struct): field_info = [ ('char_field', 'c'), # single char ('char_array', '8c'), # list of 8 chars ('str_field', '8s', cstr), # C string of len 8 ('sub_struct', MyOtherStruct), # dict generated by s2.unpack ('filler', '32s', None), # ignored field ] required_size = 300 fh = open(fname, 'rb') data = MyStruct(fh)
Attributes: - field_info
- required_size
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
classmethod
array
(x)[source]¶ Return a new StructArray class of length x and using this struct as the array item type.
-
field_info
= None¶
-
required_size
= None¶
-
class
ipfx.x_to_nwb.hr_struct.
StructArray
(data, endian='<')[source]¶ Bases:
ipfx.x_to_nwb.hr_struct.Struct
Attributes: - array_size
- field_info
- item_struct
- required_size
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size -
array_size
= None¶
-
item_struct
= None¶
ipfx.x_to_nwb.hr_treenode module¶
Wrapper class around the native struct
-
class
ipfx.x_to_nwb.hr_treenode.
TreeNode
(fh, endianess, record_types, level_sizes, level=0)[source]¶ Bases:
ipfx.x_to_nwb.hr_struct.Struct
Struct that also represents a node in the tree.
Attributes: - field_info
- required_size
Methods
array
(x)Return a new StructArray class of length x and using this struct as the array item type. get_fields
(self)Recursively convert struct fields+values to nested dictionaries. size
Module contents¶
This package allows to create NeuroDataWithoutBorders v2 files from ABF and DAT files.
See Readme.md for more information.