mirror of
https://github.com/nqrduck/nqrduck-spectrometer.git
synced 2024-11-09 12:30:01 +00:00
Flattened data arrays.
This commit is contained in:
parent
b93967666d
commit
44c7f9a408
1 changed files with 4 additions and 5 deletions
|
@ -31,7 +31,7 @@ class Measurement():
|
||||||
def to_json(self):
|
def to_json(self):
|
||||||
"""Converts the measurement to a json-compatible format."""
|
"""Converts the measurement to a json-compatible format."""
|
||||||
return {
|
return {
|
||||||
"tdx": [[x.real, x.imag] for x in self.tdx], # Convert complex numbers to list
|
"tdx": self.tdx.tolist(),
|
||||||
"tdy": [[x.real, x.imag] for x in self.tdy], # Convert complex numbers to list
|
"tdy": [[x.real, x.imag] for x in self.tdy], # Convert complex numbers to list
|
||||||
"target_frequency": self.target_frequency,
|
"target_frequency": self.target_frequency,
|
||||||
"IF_frequency": self.IF_frequency
|
"IF_frequency": self.IF_frequency
|
||||||
|
@ -40,13 +40,12 @@ class Measurement():
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_json(cls, json):
|
def from_json(cls, json):
|
||||||
"""Converts the json format to a measurement."""
|
"""Converts the json format to a measurement."""
|
||||||
tdx = np.array([complex(x[0], x[1]) for x in json["tdx"]])
|
|
||||||
tdy = np.array([complex(y[0], y[1]) for y in json["tdy"]])
|
tdy = np.array([complex(y[0], y[1]) for y in json["tdy"]])
|
||||||
return cls(
|
return cls(
|
||||||
tdx,
|
np.array(json["tdx"]),
|
||||||
tdy,
|
tdy,
|
||||||
json["target_frequency"],
|
target_frequency = json["target_frequency"],
|
||||||
json["IF_frequency"]
|
IF_frequency = json["IF_frequency"]
|
||||||
)
|
)
|
||||||
|
|
||||||
# Measurement data
|
# Measurement data
|
||||||
|
|
Loading…
Reference in a new issue