mirror of
https://github.com/nqrduck/nqrduck-measurement.git
synced 2024-12-22 23:57:51 +00:00
Moved apodization to measurement.
This commit is contained in:
parent
c9e3dd1f44
commit
775d6011f1
2 changed files with 3 additions and 36 deletions
|
@ -220,7 +220,7 @@ class MeasurementController(ModuleController):
|
|||
|
||||
logger.debug("Apodization function: %s", function)
|
||||
|
||||
apodized_measurement = dialog.apodization(function)
|
||||
apodized_measurement = measurement.apodization(function)
|
||||
|
||||
dialog.deleteLater()
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class Apodization(DuckFormBuilder):
|
|||
CustomFunction(),
|
||||
]
|
||||
|
||||
self.duration = Decimal((measurement.tdx[-1] - measurement.tdx[0]) * 1e-6)
|
||||
self.duration = (self.measurement.tdx[-1] - self.measurement.tdx[0]) * 1e-6
|
||||
|
||||
function_selection_field = DuckFormFunctionSelectionField(
|
||||
False, False, functions, self.duration, parent=parent, default_function=0
|
||||
|
@ -58,36 +58,3 @@ class Apodization(DuckFormBuilder):
|
|||
"""
|
||||
return self.get_values()[0]
|
||||
|
||||
def apodization(self, function : Function) -> None:
|
||||
"""Apply the apodization function to the measurement the object has been created to.
|
||||
|
||||
Args:
|
||||
function (Function): The apodization function.
|
||||
|
||||
Returns:
|
||||
Measurement: The apodized measurement.
|
||||
"""
|
||||
|
||||
# Get the y data weights from the function
|
||||
resolution = (
|
||||
self.measurement.tdx[1]
|
||||
- self.measurement.tdx[0]
|
||||
) * 1e-6
|
||||
|
||||
logger.debug("Resolution: %s", resolution)
|
||||
logger.debug("Resolution (Dec): %s", Decimal(resolution))
|
||||
|
||||
y_weight = function.get_pulse_amplitude(self.duration, Decimal(resolution))
|
||||
# Append the last value to the end of the array
|
||||
y_weight = np.append(y_weight, y_weight[-1])
|
||||
|
||||
tdy_measurement = self.measurement.tdy * y_weight
|
||||
|
||||
apodized_measurement = Measurement(
|
||||
self.measurement.tdx,
|
||||
tdy_measurement,
|
||||
target_frequency=self.measurement.target_frequency,
|
||||
IF_frequency=self.measurement.IF_frequency,
|
||||
)
|
||||
|
||||
return apodized_measurement
|
||||
|
|
Loading…
Reference in a new issue