PowerSpectrum

lumicks.pylake.force_calibration.power_spectrum.PowerSpectrum

class PowerSpectrum(data, sample_rate, unit='V', window_seconds=None)

Power spectrum data for a time series.

frequency

Frequency values for the power spectrum. [Hz]

Type

numpy.ndarray

power

Power values for the power spectrum (typically in V^2/Hz).

Type

numpy.ndarray

sample_rate

The sampling rate for the original data. [Hz]

Type

float

total_duration

The total duration of the original data. [seconds]

Type

float

downsampled_by(factor, reduce=<function mean>) lumicks.pylake.force_calibration.power_spectrum.PowerSpectrum

Returns a spectrum downsampled by a given factor.

in_range(frequency_min, frequency_max) lumicks.pylake.force_calibration.power_spectrum.PowerSpectrum

Returns part of the power spectrum within a given frequency range.

plot(**kwargs)

Plot power spectrum

Parameters

**kwargs – Forwarded to matplotlib.pyplot.plot().

with_spectrum(power, num_points_per_block=1) lumicks.pylake.force_calibration.power_spectrum.PowerSpectrum

Return a copy with a different spectrum

Parameters
  • power (numpy.ndarray) – Vector of power spectral values

  • num_points_per_block (int) – Number of points per block used to obtain power spectral values.

Returns

power_spectrum – Power spectrum with new spectral density values.

Return type

PowerSpectrum

Raises

ValueError – If the power spectrum provided has a different length from the current one.