zero.data module¶
Data representation and manipulation
-
class
zero.data.
BaseFunction
(sources=None, sinks=None, series=None, plot_options=None)[source]¶ Bases:
object
Base function container.
A function represents data between one or many sources and sinks. These can be any type descending from
BaseElement
, though concrete subclasses may implement additional type constraints.Functions are designed to allow mathematical operations, such as multiplication by scalars or other functions. Concrete subclasses may implement additional constraints on allowed operations.
- Parameters
sources, sinks (list of
BaseElement
, optional) – The function’s sources and sinks. Defaults to empty lists.series (
Series
, optional) – The function’s data.plot_options (
dict
, optional) – Plot options, passed tomatplotlib.pyplot.plot()
.
-
equivalent
(other)[source]¶ Checks if the specified function has equivalent sources, sinks, labels and data.
-
property
frequencies
¶
-
property
label
¶
-
class
zero.data.
MultiNoiseDensity
(sources=None, series=None, constituents=None, label=None, **kwargs)[source]¶ Bases:
zero.data.NoiseDensityBase
Set of noise data series from multiple sources to a single sink
-
property
noise_names
¶
-
property
-
class
zero.data.
NoiseDensity
(source=None, **kwargs)[source]¶ Bases:
zero.data.SingleSourceFunction
,zero.data.NoiseDensityBase
Noise data series
-
property
element_type
¶
-
property
noise_name
¶
-
property
noise_type
¶
-
property
-
class
zero.data.
NoiseDensityBase
(sink=None, **kwargs)[source]¶ Bases:
zero.data.SingleSinkFunction
Function with a single noise spectral density.
-
series_equivalent
(other)[source]¶ Checks if the specified function has an equivalent series to this one.
-
property
spectral_density
¶
-
-
class
zero.data.
Reference
(frequencies, data, label=None, unit=None, **kwargs)[source]¶ Bases:
zero.data.BaseFunction
-
property
sink_unit
¶
-
property
-
class
zero.data.
Response
(source=None, **kwargs)[source]¶ Bases:
zero.data.SingleSourceFunction
,zero.data.SingleSinkFunction
Data set representing a response at a sink from a source.
-
property
complex_magnitude
¶
-
property
db_magnitude
¶ Magnitude scaled in units of decibel.
The response is power scaled such that the response is \(20 \log_{10} \left| x \right|\) where \(x\) is the complex response provided by
complex_magnitude
.
-
property
magnitude
¶ Absolute magnitude.
-
property
phase
¶ Phase in degrees.
-
series_equivalent
(other)[source]¶ Checks if the specified function has an equivalent series to this one.
-
property
unit_str
¶
-
property
-
class
zero.data.
Series
(x, y)[source]¶ Bases:
object
Data series
-
classmethod
from_mag_phase
(x, magnitude, phase=None, mag_scale=None, phase_scale=None)[source]¶ Create
Series
from magnitude and phase data.- Parameters
x (
np.array
) – The x vector.magnitude (
np.array
) – The magnitude. This magnitude’s scaling is determined by mag_scale.phase (
np.array
, optional) – The phase. If None, the magnitude is assumed to have zero phase.mag_scale (
str
, optional) – The magnitude scale. Defaults to absolute.phase_scale (
str
, optional) – The phase scale. Defaults to degrees.
- Returns
Series
– The series containing the data.- Raises
ValueError – If the specified magnitude or phase scale is unrecognised.
-
classmethod
from_re_im
(x, re, im)[source]¶ Create
Series
from real and imaginary parts.- Parameters
- Returns
Series
– The series containing the data.- Raises
ValueError – If either the real or imaginary part is complex.
-
classmethod
-
class
zero.data.
SingleSinkFunction
(sink=None, **kwargs)[source]¶ Bases:
zero.data.BaseFunction
Data set containing data for a single sink.
-
property
sink
¶
-
property
sink_unit
¶
-
property
-
class
zero.data.
SingleSourceFunction
(source=None, **kwargs)[source]¶ Bases:
zero.data.BaseFunction
Data set containing data for a single source.
-
property
source
¶
-
property
source_unit
¶
-
property