Added frequency domain data to measurement class.

This commit is contained in:
jupfi 2023-07-18 10:08:32 +02:00
parent abe47cf64f
commit 0ea47d16be

View file

@ -1,13 +1,23 @@
from nqrduck.helpers.signalprocessing import SignalProcessing as sp
class Measurement(): class Measurement():
"""This class defines how measurement data should look. """This class defines how measurement data should look.
It includes pulse parameters necessary for further signal processing. It includes pulse parameters necessary for further signal processing.
Every spectrometer should adhere to this data structure in order to be compatible with the rest of the nqrduck. Every spectrometer should adhere to this data structure in order to be compatible with the rest of the nqrduck.
Attributes:
tdx (np.array): Time axis for the x axis of the measurement data.
tdy (np.array): Time axis for the y axis of the measurement data.
target_frequency (float): Target frequency of the measurement.
xf (np.array): Frequency axis for the x axis of the measurement data.
yf (np.array): Frequency axis for the y axis of the measurement data.
""" """
def __init__(self, tdx, tdy, target_frequency) -> None: def __init__(self, tdx, tdy, target_frequency) -> None:
self.tdx = tdx self.tdx = tdx
self.tdy = tdy self.tdy = tdy
self.target_frequency = target_frequency self.target_frequency = target_frequency
self.fdx, self.fdy = sp.fft(tdx, tdy)
# Measurement data # Measurement data
@property @property
@ -28,6 +38,24 @@ class Measurement():
def tdy(self, value): def tdy(self, value):
self._tdy = value self._tdy = value
@property
def fdx(self):
"""Frequency axis for the x axis of the measurement data."""
return self._fdx
@fdx.setter
def fdx(self, value):
self._fdx = value
@property
def fdy(self):
"""Frequency axis for the y axis of the measurement data."""
return self._fdy
@fdy.setter
def fdy(self, value):
self._fdy = value
# Pulse parameters # Pulse parameters
@property @property
def target_frequency(self): def target_frequency(self):