mirror of
https://github.com/nqrduck/nqrduck-spectrometer.git
synced 2024-12-22 08:17:49 +00:00
Added check for valid event duration.
This commit is contained in:
parent
a1bf3df72c
commit
05e8812204
2 changed files with 19 additions and 0 deletions
|
@ -60,6 +60,7 @@ class Function:
|
||||||
mpl_widget.canvas.ax.plot(xdf, ydf)
|
mpl_widget.canvas.ax.plot(xdf, ydf)
|
||||||
mpl_widget.canvas.ax.set_xlabel("Frequency in Hz")
|
mpl_widget.canvas.ax.set_xlabel("Frequency in Hz")
|
||||||
mpl_widget.canvas.ax.set_ylabel("Magnitude")
|
mpl_widget.canvas.ax.set_ylabel("Magnitude")
|
||||||
|
mpl_widget.canvas.ax.grid(True)
|
||||||
return mpl_widget
|
return mpl_widget
|
||||||
|
|
||||||
def time_domain_plot(self, pulse_length: float) -> MplWidget:
|
def time_domain_plot(self, pulse_length: float) -> MplWidget:
|
||||||
|
@ -68,6 +69,7 @@ class Function:
|
||||||
mpl_widget.canvas.ax.plot(td, self.evaluate(pulse_length))
|
mpl_widget.canvas.ax.plot(td, self.evaluate(pulse_length))
|
||||||
mpl_widget.canvas.ax.set_xlabel("Time in s")
|
mpl_widget.canvas.ax.set_xlabel("Time in s")
|
||||||
mpl_widget.canvas.ax.set_ylabel("Magnitude")
|
mpl_widget.canvas.ax.set_ylabel("Magnitude")
|
||||||
|
mpl_widget.canvas.ax.grid(True)
|
||||||
return mpl_widget
|
return mpl_widget
|
||||||
|
|
||||||
def get_pulse_amplitude(self, pulse_length: float) -> np.array:
|
def get_pulse_amplitude(self, pulse_length: float) -> np.array:
|
||||||
|
|
|
@ -62,6 +62,23 @@ class PulseSequence:
|
||||||
)
|
)
|
||||||
|
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
@property
|
||||||
|
def duration(self):
|
||||||
|
return self._duration
|
||||||
|
|
||||||
|
@duration.setter
|
||||||
|
def duration(self, duration : float):
|
||||||
|
# Duration needs to be a positive number
|
||||||
|
try:
|
||||||
|
duration = float(duration)
|
||||||
|
except ValueError:
|
||||||
|
raise ValueError("Duration needs to be a number")
|
||||||
|
if duration < 0:
|
||||||
|
raise ValueError("Duration needs to be a positive number")
|
||||||
|
|
||||||
|
self._duration = duration
|
||||||
|
|
||||||
|
|
||||||
def to_json(self):
|
def to_json(self):
|
||||||
"""Returns a dict with all the data in the pulse sequence
|
"""Returns a dict with all the data in the pulse sequence
|
||||||
|
|
Loading…
Reference in a new issue