Cfg Class Reference¶
- class comtrade.Cfg(**kwargs)¶
Parses and stores Comtrade’s CFG data.
- Attributes:
analog_channelsReturn the analog channels list with complete channel description.
analog_countReturn the number of analog channels.
channels_countReturn the number of channels, total.
digital_channelsReturns the status channels bidimensional values list.
digital_countReturns the number of status channels.
frequencyReturn the measured line frequency in Hertz.
ftReturn the expected DAT file format.
nratesReturn the number of different sample rates within the DAT file.
rec_dev_idReturn the recording device id.
rev_yearReturn the COMTRADE revision year.
sample_ratesReturn a list with pairs describing the number of samples for a given sample rate.
start_timestampReturn the recording start time stamp as a datetime object.
station_nameReturn the recording device’s station name.
status_channelsReturn the status channels list with complete channel description.
status_countReturn the number of status channels.
time_baseReturn the time base.
timemultReturn the DAT time multiplier (Default = 1).
timestamp_criticalReturns whether the DAT file must contain non-zero timestamp values.
trigger_timestampReturn the trigger time stamp as a datetime object.
Methods
load(filepath, **user_kwargs)Load and read a CFG file contents.
read(cfg_lines)Read CFG-format data of a FileIO or StringIO object.
- property analog_channels: list¶
Return the analog channels list with complete channel description.
- property analog_count: int¶
Return the number of analog channels.
- property channels_count: int¶
Return the number of channels, total.
- property digital_channels: list¶
Returns the status channels bidimensional values list.
- property digital_count: int¶
Returns the number of status channels.
- property frequency: float¶
Return the measured line frequency in Hertz.
- property ft: str¶
Return the expected DAT file format.
- load(filepath, **user_kwargs)¶
Load and read a CFG file contents.
- property nrates: int¶
Return the number of different sample rates within the DAT file.
- read(cfg_lines)¶
Read CFG-format data of a FileIO or StringIO object.
- property rec_dev_id: str¶
Return the recording device id.
- property rev_year: int¶
Return the COMTRADE revision year.
- property sample_rates: list¶
Return a list with pairs describing the number of samples for a given sample rate.
- property start_timestamp: datetime¶
Return the recording start time stamp as a datetime object.
- property station_name: str¶
Return the recording device’s station name.
- property status_channels: list¶
Return the status channels list with complete channel description.
- property status_count: int¶
Return the number of status channels.
- property time_base: float¶
Return the time base.
- property timemult: float¶
Return the DAT time multiplier (Default = 1).
- property timestamp_critical: bool¶
Returns whether the DAT file must contain non-zero timestamp values.
- property trigger_timestamp: datetime¶
Return the trigger time stamp as a datetime object.
Comtrade Class Reference¶
- class comtrade.Comtrade(**kwargs)¶
Parses and stores Comtrade data.
- Attributes:
analogReturn the analog channel values bidimensional list.
analog_channel_idsReturns the analog channels name list.
analog_countReturn the number of analog channels.
analog_phasesReturns the analog phase name list.
cfgReturn the underlying CFG class instance.
channels_countReturn the number of channels, total.
digitalReturns the status channels bidimensional values list.
digital_channel_idsReturns the status channels name list.
digital_countReturns the number of status channels.
frequencyReturn the measured line frequency in Hertz.
ftReturn the expected DAT file format.
hdrReturn the HDR file contents.
infReturn the INF file contents.
rec_dev_idReturn the recording device id.
rev_yearReturn the COMTRADE revision year.
start_timestampReturn the recording start time stamp as a datetime object.
station_nameReturn the recording device’s station name.
statusReturn the status channel values bidimensional list.
status_channel_idsReturns the status channels name list.
status_countReturn the number of status channels.
status_phasesReturns the status phase name list.
timeReturn the time values list.
time_baseReturn the time base.
total_samplesReturn the total number of samples (per channel).
trigger_timeReturn relative trigger time in seconds.
trigger_timestampReturn the trigger time stamp as a datetime object.
Methods
Returns the CFG attributes summary string.
load(cfg_file[, dat_file])Load CFG, DAT, INF, and HDR files.
read(cfg_lines, dat_lines_or_bytes)Read CFG and DAT files contents.
- property analog: list¶
Return the analog channel values bidimensional list.
- property analog_channel_ids: list¶
Returns the analog channels name list.
- property analog_count: int¶
Return the number of analog channels.
- property analog_phases: list¶
Returns the analog phase name list.
- cfg_summary()¶
Returns the CFG attributes summary string.
- property channels_count: int¶
Return the number of channels, total.
- property digital: list¶
Returns the status channels bidimensional values list.
- property digital_channel_ids: list¶
Returns the status channels name list.
- property digital_count: int¶
Returns the number of status channels.
- property frequency: float¶
Return the measured line frequency in Hertz.
- property ft: str¶
Return the expected DAT file format.
- property hdr¶
Return the HDR file contents.
- property inf¶
Return the INF file contents.
- load(cfg_file, dat_file=None, **kwargs) None¶
Load CFG, DAT, INF, and HDR files. Each must be a FileIO or StringIO object. dat_file, inf_file, and hdr_file are optional (Default: None).
cfg_file is the cfg file path, including its extension. dat_file is optional, and may be set if the DAT file name differs from
the CFG file name.
Keyword arguments: inf_file – optional INF file path (Default = None) hdr_file – optional HDR file path (Default = None)
- read(cfg_lines, dat_lines_or_bytes) None¶
Read CFG and DAT files contents. Expects FileIO or StringIO objects.
- property rec_dev_id: str¶
Return the recording device id.
- property rev_year: int¶
Return the COMTRADE revision year.
- property start_timestamp¶
Return the recording start time stamp as a datetime object.
- property station_name: str¶
Return the recording device’s station name.
- property status: list¶
Return the status channel values bidimensional list.
- property status_channel_ids: list¶
Returns the status channels name list.
- property status_count: int¶
Return the number of status channels.
- property status_phases: list¶
Returns the status phase name list.
- property time: list¶
Return the time values list.
- property time_base: float¶
Return the time base.
- property total_samples: int¶
Return the total number of samples (per channel).
- property trigger_time: float¶
Return relative trigger time in seconds.
- property trigger_timestamp¶
Return the trigger time stamp as a datetime object.
Additional Package Functions¶
- comtrade.fill_with_zeros_to_the_right(number_str: str, width: int)¶