McsPyDataTools API Reference¶
McsPy¶
McsPy is a Python module/package to read, handle and operate on HDF5-based raw data files converted from recordings of devices of the Multi Channel Systems MCS GmbH.
copyright: |
|
---|---|
license: | see LICENSE for more details |
-
class
McsPy.
McsHdf5Protocols
[source]¶ Class of supported MCS-HDF5 protocol types and version ranges
Entry: (Protocol Type Name => Tuple of supported version range from (including) the first version entry up to (including) the second version entry)
-
classmethod
check_protocol_type_version
(protocol_type_name, version)[source]¶ Check if the given version of a protocol is supported by the implementation
Parameters: - protocol_type_name – name of the protocol that is tested
- version – version number that should be checked
Returns: is true if the given protocol and version is supported
-
classmethod
-
class
McsPy.
McsHdf5Types
[source]¶ Class of supported MCS-HDF5 file structure types and version ranges
Entry: (Protocol TypeID => Tuple of supported version range from (including) the first version entry up to (including) the second version entry)
-
classmethod
check_type_version
(typeID, version)[source]¶ Check if the given version of a type is supported by the implementation
Parameters: - protocol_type_name – name of the protocol that is tested
- version – version number that should be checked
Returns: is true if the given type and version is supported
-
classmethod
get_mcs_class_name
(typeID, version=None)[source]¶ Returns the McsPy class name, that corresponds to a given Mcs HDF5 file structure type. The function also checks if the requested class supports the Mcs HDF5 file structure type version
Parameters: - typeID – name of the type that is tested
- version – version number that should be checked
Returns: a McsCMOSMEA class if the given type and version is supported
-
classmethod
The ‘’McsData’’ module¶
-
class
McsPy.McsData.
RawData
(raw_data_path)[source]¶ This class holds the information of a complete MCS raw data file
-
recordings
¶ Access recordings
-
-
class
McsPy.McsData.
Recording
(recording_grp)[source]¶ Container class for one recording
Provides the content of the HDF5 Folder “Recording_x” in Python.
-
analog_streams
¶ Access all analog streams - collection of
AnalogStream
objects
-
frame_streams
¶ Access all frame streams - collection of
FrameStream
objects
-
event_streams
¶ Access event streams - collection of
EventStream
objects
-
segment_streams
¶ Access segment streams - - collection of
SegementStream
objects
-
timestamp_streams
¶ Access timestamp streams - collection of
TimestampStream
objects
-
duration_time
¶ Duration of the recording
-
Data-Stream-Structures containing the data¶
-
class
McsPy.McsData.
Stream
(stream_grp, info_type_name=None)[source]¶ Base class for all stream types
-
class
McsPy.McsData.
AnalogStream
(stream_grp)[source]¶ Container class for one analog stream of several channels. Description for each channel is provided by a channel-associated object of
ChannelInfo
Provides the content of the HDF5 Sub-folder “Stream_x” of “AnalogStream” in Python.
-
get_channel_in_range
(channel_id, idx_start, idx_end)[source]¶ Get the signal of the given channel over the curse of time and in its measured range.
Parameters: - channel_id – ID of the channel
- idx_start – index of the first sampled signal value that should be returned (0 <= idx_start < idx_end <= count samples)
- idx_end – index of the last sampled signal value that should be returned (0 <= idx_start < idx_end <= count samples)
Returns: Tuple (vector of the signal, unit of the values)
-
get_channel_sample_timestamps
(channel_id, idx_start, idx_end)[source]¶ Get the timestamps of the sampled values.
Parameters: - channel_id – ID of the channel
- idx_start – index of the first signal timestamp that should be returned (0 <= idx_start < idx_end <= count samples)
- idx_end – index of the last signal timestamp that should be returned (0 <= idx_start < idx_end <= count samples)
Returns: Tuple (vector of the timestamps, unit of the timestamps)
-
-
class
McsPy.McsData.
FrameStream
(stream_grp)[source]¶ Container class for one frame stream with different entities
Provides the content of the HDF5 Subfolder “Stream_x” of “FrameStream” in Python.
-
class
McsPy.McsData.
FrameEntity
(frame_entity_group, frame_info)[source]¶ Contains the stream of a specific frame entity. Meta-Information for this entity is available via an associated object of
FrameEntityInfo
Provides the content of the HDF5 Subfolder “Stream_x” of “FrameStream” and Subfolder “FrameDataEntity_x” in Python.
-
get_sensor_signal
(sensor_x, sensor_y, idx_start, idx_end)[source]¶ Get the signal of a single sensor over the curse of time and in its measured range.
Parameters: - sensor_x – x coordinate of the sensor
- sensor_y – y coordinate of the sensor
- idx_start – index of the first sampled frame that should be returned (0 <= idx_start < idx_end <= count frames)
- idx_end – index of the last sampled frame that should be returned (0 <= idx_start < idx_end <= count frames)
Returns: Tuple (vector of the signal, unit of the values)
-
get_frame_timestamps
(idx_start, idx_end)[source]¶ Get the timestamps of the sampled frames.
Parameters: - idx_start – index of the first sampled frame that should be returned (0 <= idx_start < idx_end <= count frames)
- idx_end – index of the last sampled frame that should be returned (0 <= idx_start < idx_end <= count frames)
Returns: Tuple (vector of the timestamps, unit of the timestamps)
-
-
class
McsPy.McsData.
EventStream
(stream_grp)[source]¶ Container class for one event stream with different entities
Provides the content of the HDF5 Subfolder “Stream_x” of “EventStream” in Python.
-
class
McsPy.McsData.
EventEntity
(event_data, event_info)[source]¶ Contains the event data of a specific entity. Meta-Information for this entity is available via an associated object of
EventEntityInfo
Maps data event entity content of the HDF5 Subfolder “Stream_x” of “EventStream” to Python structures.
-
count
¶ Number of contained events
-
get_events
(idx_start=None, idx_end=None)[source]¶ Get all n events of this entity of the given index range (idx_start <= idx < idx_end)
Parameters: - idx_start – start index of the range (including), if nothing is given -> 0
- idx_end – end index of the range (excluding, if nothing is given -> last index
Returns: Tuple of (2 x n matrix of timestamp (1. row) and duration (2. row), Used unit of time)
-
get_event_timestamps
(idx_start=None, idx_end=None)[source]¶ Get all n event timestamps of this entity of the given index range
Parameters: - idx_start – start index of the range, if nothing is given -> 0
- idx_end – end index of the range, if nothing is given -> last index
Returns: Tuple of (n-length array of timestamps, Used unit of time)
-
get_event_durations
(idx_start=None, idx_end=None)[source]¶ Get all n event durations of this entity of the given index range
Parameters: - idx_start – start index of the range, if nothing is given -> 0
- idx_end – end index of the range, if nothing is given -> last index
Returns: Tuple of (n-length array of duration, Used unit of time)
-
-
class
McsPy.McsData.
SegmentStream
(stream_grp)[source]¶ Container class for one segment stream of different segment entities
Provides the content of the HDF5 Subfolder “Stream_x” of “SegmentStream” in Python.
-
class
McsPy.McsData.
SegmentEntity
(segment_data, segment_ts, segment_info)[source]¶ Segment entity class, Meta-Information for this entity is available via an associated object of
SegmentEntityInfo
DataSybType != Average → Maps segement entity content of the HDF5 Subfolder “Stream_x” of “SegmentStream” to Python structures.-
segment_sample_count
¶ Number of contained samples of segments (2d) or multi-segments (3d)
-
segment_count
¶ Number of segments that are sampled for one time point (2d) -> 1 and (3d) -> n
-
get_segment_in_range
(segment_id, flat=False, idx_start=None, idx_end=None)[source]¶ Get the a/the segment signals in its measured range.
Parameters: - segment_id – id resp. number of the segment (0 if only one segment is present or the index inside the multi-segment collection)
- flat – true -> one-dimensional vector of the sequentially ordered segments, false -> k x n matrix of the n segments of k sample points
- idx_start – index of the first segment that should be returned (0 <= idx_start < idx_end <= count segments)
- idx_end – index of the last segment that should be returned (0 <= idx_start < idx_end <= count segments)
Returns: Tuple (of a flat vector of the sequentially ordered segments or a k x n matrix of the n segments of k sample points depending on the value of flat , and the unit of the values)
-
get_segment_sample_timestamps
(segment_id, flat=False, idx_start=None, idx_end=None)[source]¶ Get the timestamps of the sample points of the measured segment.
Parameters: - segment_id – id resp. number of the segment (0 if only one segment is present or the index inside the multi-segment collection)
- flat – true -> one-dimensional vector of the sequentially ordered segment timestamps, false -> k x n matrix of the k timestamps of n segments
- idx_start – index of the first segment for that timestamps should be returned (0 <= idx_start < idx_end <= count segments)
- idx_end – index of the last segment for that timestamps should be returned (0 <= idx_start < idx_end <= count segments)
Returns: Tuple (of a flat vector of the sequentially ordered segments or a k x n matrix of the n segments of k sample points depending on the value of flat , and the unit of the values)
-
-
class
McsPy.McsData.
AverageSegmentTuple
(mean, std_dev, time_tick_unit, signal_unit)¶ Named tuple that describe one or more average segments (mean, std_dev, time_tick_unit, signal_unit).
Note
mean
- mean signal valuesstd_dev
- standard deviation of the signal value (it is 0 if there was only one sample segment)time_tick_unit
- sampling interval with time unitsignal_unit
- measured unit of the signal
-
mean
¶ Alias for field number 0
-
signal_unit
¶ Alias for field number 3
-
std_dev
¶ Alias for field number 1
-
time_tick_unit
¶ Alias for field number 2
-
class
McsPy.McsData.
AverageSegmentEntity
(segment_average_data, segment_average_annotation, segment_info)[source]¶ Contains a number of signal segments that are calcualted as averages of number of segments occured in a given time range. Meta-Information for this entity is available via an associated object of
SegmentEntityInfo
DataSybType == Average → Maps segment entity content of the HDF5 DataSubType-Average: Subfolder “Stream_x” of “SegmentStream” to Python structures.
-
number_of_averages
¶ Number of average segments inside this average entity
-
sample_length
¶ Number of sample points of an average segment
-
time_ranges
()[source]¶ List of time range tuples for all contained average segments
Returns: List of tuple with start and end time point
-
time_range
(average_segment_idx)[source]¶ Get the time range for that the average segment was calculated
Parameters: average_segment_idx – index resp. number of the average segment Returns: Tuple with start and end time point
-
average_counts
()[source]¶ List of counts of samples for all contained average segments
Parameters: average_segment_idx – id resp. number of the average segment Returns: sample count
-
average_count
(average_segment_idx)[source]¶ Count of samples that were used to calculate the average
Parameters: average_segment_idx – id resp. number of the average segment Returns: sample count
-
get_scaled_average_segments
()[source]¶ Get all contained average segments in its measured physical range.
Returns: AverageSegmentTuple
containing the k x n matrices for mean and standard deviation of all contained average segments n with the associated sampling and measuring information
-
get_scaled_average_segment
(average_segment_idx)[source]¶ Get the selected average segment in its measured physical range.
Parameters: segment_idx – index resp. number of the average segment Returns: AverageSegmentTuple
containing the mean and standard deviation vector of the average segment with the associated sampling and measuring information
-
get_average_segments
()[source]¶ Get all contained average segments AD-offset in ADC values with its measuring conditions
Returns: AverageSegmentTuple
containing the mean and standard deviation vector of the average segment in ADC steps with sampling tick and ADC-Step definition
-
get_average_segment
(average_segment_idx)[source]¶ Get the AD-offset corrected average segment in ADC values with its measuring conditions
Parameters: segment_id – id resp. number of the segment Returns: AverageSegmentTuple
containing the k x n matrices for mean and standard deviation of all contained average segments in ADC steps with sampling tick and ADC-Step definition
-
-
class
McsPy.McsData.
TimeStampStream
(stream_grp)[source]¶ Container class for one timestamp stream with different entities
Provides the content of the HDF5 Subfolder “Stream_x” of “TimeStampStream” in Python.
-
class
McsPy.McsData.
TimeStampEntity
(timestamp_data, timestamp_info)[source]¶ Time-Stamp entity class, Meta-Information for this entity is available via an associated object of
TimestampEntityInfo
Maps data timestamp entity data of the HDF5 Subfolder “Stream_x” of “TimeStampStream” to Python structures.
-
count
¶ Number of contained timestamps
-
get_timestamps
(idx_start=None, idx_end=None)[source]¶ Get all n time stamps of this entity of the given index range (idx_start <= idx < idx_end)
Parameters: - idx_start – start index of the range (including), if nothing is given -> 0
- idx_end – end index of the range (excluding, if nothing is given -> last index
Returns: Tuple of (n-length array of timestamps, Used unit of time)
-
Info-Classes containing Meta-Information for the data¶
-
class
McsPy.McsData.
Info
(info_data)[source]¶ Base class of all info classes
Derived classes contain meta information for data structures and fields.
-
group_id
¶ Get the id of the group that the objects belongs to
-
label
¶ Label of this object
-
data_type
¶ Raw data type of this object
-
-
class
McsPy.McsData.
ChannelInfo
(info_version, info)[source]¶ Contains all describing meta data for one sampled channel
-
channel_id
¶ Get the ID of the channel
-
row_index
¶ Get the index of the row that contains the associated channel data inside the data matrix
-
adc_step
¶ Size and unit of one ADC step for this channel
-
version
¶ Version number of the Type-Definition
-
-
class
McsPy.McsData.
InfoSampledData
(info)[source]¶ Base class of all info classes for evenly sampled data
-
sampling_frequency
¶ Get the used sampling frequency in Hz
-
sampling_tick
¶ Get the used sampling tick
-
-
class
McsPy.McsData.
EventEntityInfo
(info_version, info)[source]¶ Contains all meta data for one event entity
-
id
¶ Event ID
-
raw_data_bytes
¶ Lenght of raw data in bytes
-
source_channel_ids
¶ ID’s of all channels that were involved in the event generation.
-
source_channel_labels
¶ Labels of the channels that were involved in the event generation.
-
version
¶ Version number of the Type-Definition
-
-
class
McsPy.McsData.
SegmentEntityInfo
(info_version, info, source_channel_infos)[source]¶ Contains all meta data for one segment entity
-
id
¶ Segment ID
-
pre_interval
¶ Interval [start of the segment <- defining event timestamp]
-
post_interval
¶ Interval [defining event timestamp -> end of the segment]
-
type
¶ Type of the segment like ‘Average’ or ‘Cutout’
-
count
¶ Count of segments inside the segment entity
-
version
¶ Version number of the Type-Definition
-
-
class
McsPy.McsData.
TimeStampEntityInfo
(info_version, info)[source]¶ Contains all meta data for one timestamp entity
-
id
¶ Timestamp entity ID
-
unit
¶ Unit in which the timestamps are measured
-
exponent
¶ Exponent for the unit in which the timestamps are measured
-
measuring_unit
¶ Unit in which the timestamp entity was measured
-
data_type
¶ DataType for the timestamps
-
source_channel_ids
¶ ID’s of all channels that were involved in the timestamp generation.
-
source_channel_labels
¶ Labels of the channels that were involved in the timestamp generation.
-
version
¶ Version number of the Type-Definition
-
The ‘’McsCMOS’’ module¶
McsCMOS¶
Wrapper and Helper to access MCS CMOS Data within H5 Files
copyright: |
|
---|---|
license: | see LICENSE for more details |