changed plottable default, new resampled method

This commit is contained in:
2024-02-12 09:23:13 +01:00
parent f9beebf5c1
commit 2e7aa800fc

View File

@@ -1,7 +1,7 @@
from __future__ import annotations from __future__ import annotations
from dataclasses import dataclass, field from dataclasses import dataclass, field
from typing import Sequence from typing import Self, Sequence
import numpy as np import numpy as np
import scipy.signal as ss import scipy.signal as ss
@@ -90,7 +90,7 @@ class NoiseMeasurement:
wavelength: float | None = None, wavelength: float | None = None,
power: float | None = None, power: float | None = None,
left: int | None = None, left: int | None = None,
discard_nyquist: bool = False, discard_nyquist: bool = True,
) -> tuple[np.ndarray, np.ndarray]: ) -> tuple[np.ndarray, np.ndarray]:
""" """
Transforms the PSD in a way that makes it easy to plot Transforms the PSD in a way that makes it easy to plot
@@ -186,6 +186,9 @@ class NoiseMeasurement:
interp = np.interp(f, self.freq, self.psd, left=self.psd[0], right=self.psd[-1]) interp = np.interp(f, self.freq, self.psd, left=self.psd[0], right=self.psd[-1])
return f, interp return f, interp
def resampled(self, nf: int, dt: float | None = None, log_mode: bool = False) -> Self:
return self.__class__(*self.sample_spectrum(nf, dt, log_mode))
def time_series( def time_series(
self, self,
nf: int, nf: int,