specparam.data.data.Data¶
- class specparam.data.data.Data(check_freqs=True, check_data=True, format='power')[source]¶
Object for managing data for spectral parameterization - for 1D data.
- Parameters:
- check_freqsbool
Whether to check the frequency values. If so, raises an error for uneven spacing.
- check_databool
Whether to check the spectral data. If so, raises an error for any NaN / Inf values.
- format{‘power’}
The representation format of the data.
Notes
All power values are stored internally in log10 scale.
- Attributes:
- checksdict
Specifiers for which aspects of the data to run checks on.
- freqs1d array
Frequency values for the spectral data.
- freq_rangelist of [float, float]
Frequency range of the spectral data, as [lowest_freq, highest_freq].
- freq_resfloat
Frequency resolution of the spectral data.
- power_spectrum1d array
Power values.
Methods
__init__([check_freqs, check_data, format])Initialize Data object.
add_data(freqs, power_spectrum[, freq_range])Add data (frequencies, and power spectrum values) to the current object.
add_meta_data(meta_data)Add data information into object from a SpectrumMetaData object.
Return check statuses of the current object.
Return data information from the current object.
plot([plt_log])Plot the power spectrum.
set_checks([check_freqs, check_data])Set check statuses, which control if an error is raised based on check on the inputs.
Attributes
Indicator for if the object contains data.
- add_data(freqs, power_spectrum, freq_range=None)[source]¶
Add data (frequencies, and power spectrum values) to the current object.
- Parameters:
- freqs1d array
Frequency values for the power spectrum, in linear space.
- power_spectrum1d array
Power spectrum values, which must be input in linear space.
- freq_rangelist of [float, float], optional
Frequency range to restrict power spectrum to. If not provided, keeps the entire range.
Notes
If called on an object with existing data it will be cleared by this method call.
- add_meta_data(meta_data)[source]¶
Add data information into object from a SpectrumMetaData object.
- Parameters:
- meta_dataSpectrumMetaData
A meta data object containing meta data information.
- get_checks()[source]¶
Return check statuses of the current object.
- Returns:
- ModelChecks
Object containing the check statuses from the current object.
- get_meta_data()[source]¶
Return data information from the current object.
- Returns:
- SpectrumMetaData
Object containing meta data from the current object.
- property has_data¶
Indicator for if the object contains data.