Changed to decimals.

This commit is contained in:
jupfi 2023-07-29 18:07:34 +02:00
parent 3fe8cf487f
commit 6df745452b
2 changed files with 5 additions and 4 deletions

View file

@ -2,6 +2,7 @@ import logging
import json
import decimal
from PyQt6.QtCore import pyqtSlot
from nqrduck.helpers.serializer import DecimalEncoder
from nqrduck.module.module_controller import ModuleController
from nqrduck_spectrometer.pulsesequence import PulseSequence
@ -50,7 +51,7 @@ class PulseProgrammerController(ModuleController):
logger.debug("Saving pulse sequence to %s", path)
sequence = self.module.model.pulse_sequence.to_json()
with open(path, "w") as file:
file.write(json.dumps(sequence))
file.write(json.dumps(sequence, cls=DecimalEncoder))
def load_pulse_sequence(self, path):

View file

@ -426,9 +426,9 @@ class FunctionOptionWidget(QWidget):
def on_replot_button_clicked(self):
logger.debug("Replot button clicked")
# Update the resolution, start_x, end_x and expr lineedits
self.function_option.value.resolution = float(self.resolution_lineedit.text())
self.function_option.value.start_x = float(self.start_x_lineedit.text())
self.function_option.value.end_x = float(self.end_x_lineedit.text())
self.function_option.value.resolution = self.resolution_lineedit.text()
self.function_option.value.start_x = self.start_x_lineedit.text()
self.function_option.value.end_x = self.end_x_lineedit.text()
try:
self.function_option.value.expr = self.expr_lineedit.text()
except SyntaxError: