mirror of
https://github.com/nqrduck/quackseq.git
synced 2024-11-21 13:32:25 +00:00
Linting.
This commit is contained in:
parent
a8c5a93ae5
commit
b0cfd270fe
5 changed files with 94 additions and 72 deletions
|
@ -44,9 +44,6 @@ extend-select = [
|
|||
"D", # pydocstyle
|
||||
]
|
||||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"__init__.py" = ["F401"]
|
||||
|
||||
[tool.ruff.lint.pydocstyle]
|
||||
convention = "google"
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ class Function:
|
|||
"""
|
||||
return {
|
||||
"name": self.name,
|
||||
"class" : self.__class__.__name__,
|
||||
"class": self.__class__.__name__,
|
||||
"parameters": [parameter.to_json() for parameter in self.parameters],
|
||||
"expression": str(self.expr),
|
||||
"resolution": self.resolution,
|
||||
|
|
|
@ -338,6 +338,7 @@ class T2StarFit(Fit):
|
|||
"""Initial guess for the T2* fit."""
|
||||
return [1, 1]
|
||||
|
||||
|
||||
class LorentzianFit(Fit):
|
||||
"""Lorentzian fit for measurement data."""
|
||||
|
||||
|
|
|
@ -10,7 +10,12 @@ import logging
|
|||
from numpy.core.multiarray import array as array
|
||||
|
||||
from quackseq.options import BooleanOption, FunctionOption, NumericOption, Option
|
||||
from quackseq.functions import RectFunction, SincFunction, GaussianFunction, CustomFunction
|
||||
from quackseq.functions import (
|
||||
RectFunction,
|
||||
SincFunction,
|
||||
GaussianFunction,
|
||||
CustomFunction,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -71,7 +76,6 @@ class PulseParameter:
|
|||
raise ValueError(f"Option with name {name} not found")
|
||||
|
||||
|
||||
|
||||
class TXPulse(PulseParameter):
|
||||
"""Basic TX Pulse Parameter. It includes options for the relative amplitude, the phase and the pulse shape.
|
||||
|
||||
|
@ -104,12 +108,22 @@ class TXPulse(PulseParameter):
|
|||
self.add_option(NumericOption(self.TX_PHASE, 0))
|
||||
self.add_option(
|
||||
NumericOption(
|
||||
self.N_PHASE_CYCLES, 1, is_float=False, min_value=1, max_value=360, slider=False
|
||||
self.N_PHASE_CYCLES,
|
||||
1,
|
||||
is_float=False,
|
||||
min_value=1,
|
||||
max_value=360,
|
||||
slider=False,
|
||||
)
|
||||
)
|
||||
self.add_option(
|
||||
NumericOption(
|
||||
self.PHASE_CYCLE_LEVEL, 0, is_float=False, min_value=0, max_value=10, slider=False
|
||||
self.PHASE_CYCLE_LEVEL,
|
||||
0,
|
||||
is_float=False,
|
||||
min_value=0,
|
||||
max_value=10,
|
||||
slider=False,
|
||||
)
|
||||
)
|
||||
self.add_option(
|
||||
|
@ -124,6 +138,7 @@ class TXPulse(PulseParameter):
|
|||
),
|
||||
)
|
||||
|
||||
|
||||
class RXReadout(PulseParameter):
|
||||
"""Basic PulseParameter for the RX Readout. It includes an option for the RX Readout state.
|
||||
|
||||
|
@ -144,6 +159,7 @@ class RXReadout(PulseParameter):
|
|||
super().__init__(name)
|
||||
self.add_option(BooleanOption(self.RX, False))
|
||||
|
||||
|
||||
class Gate(PulseParameter):
|
||||
"""Basic PulseParameter for the Gate. It includes an option for the Gate state.
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Helper used for signal processing."""
|
||||
|
||||
import logging
|
||||
from scipy.fft import fft, fftfreq, fftshift
|
||||
import numpy as np
|
||||
|
@ -6,11 +7,14 @@ import sympy
|
|||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class SignalProcessing:
|
||||
"""This class provides various signal processing methods that can then be used by nqrduck modules."""
|
||||
|
||||
@classmethod
|
||||
def fft(cls, tdx : np.array, tdy: np.array, freq_shift : float = 0, zero_padding = 1000) -> tuple[np.array, np.array]:
|
||||
def fft(
|
||||
cls, tdx: np.array, tdy: np.array, freq_shift: float = 0, zero_padding=1000
|
||||
) -> tuple[np.array, np.array]:
|
||||
"""This method calculates the FFT of the time domain data.
|
||||
|
||||
Args:
|
||||
|
@ -23,7 +27,7 @@ class SignalProcessing:
|
|||
np.array: Frequency domain x data in MHz.
|
||||
np.array: Frequency domain magnitude y data.
|
||||
"""
|
||||
dwell_time = (tdx[1] - tdx[0])
|
||||
dwell_time = tdx[1] - tdx[0]
|
||||
|
||||
N = len(tdx) + zero_padding
|
||||
|
||||
|
@ -43,7 +47,7 @@ class SignalProcessing:
|
|||
return xdf, ydf
|
||||
|
||||
@classmethod
|
||||
def baseline_correction(cls, fdx : np.array, fdy : np.array, order : int) -> np.array:
|
||||
def baseline_correction(cls, fdx: np.array, fdy: np.array, order: int) -> np.array:
|
||||
"""This method calculates the baseline correction of the frequency domain data.
|
||||
|
||||
Args:
|
||||
|
@ -57,7 +61,9 @@ class SignalProcessing:
|
|||
pass
|
||||
|
||||
@classmethod
|
||||
def apodization(cls, tdx : np.array, tdy : np.array, apodization_function : sympy.Expr) -> np.array:
|
||||
def apodization(
|
||||
cls, tdx: np.array, tdy: np.array, apodization_function: sympy.Expr
|
||||
) -> np.array:
|
||||
"""This method calculates the apodization of the time domain data.
|
||||
|
||||
Args:
|
||||
|
@ -72,7 +78,9 @@ class SignalProcessing:
|
|||
return tdy * weight
|
||||
|
||||
@classmethod
|
||||
def peak_picking(cls, fdx: np.array, fdy: np.array, threshold : float = 0.05) -> tuple[np.array, np.array]:
|
||||
def peak_picking(
|
||||
cls, fdx: np.array, fdy: np.array, threshold: float = 0.05
|
||||
) -> tuple[np.array, np.array]:
|
||||
"""This method calculates the peak picking of the frequency domain data.
|
||||
|
||||
Args:
|
||||
|
|
Loading…
Reference in a new issue