fix(data_viewer): use float64 for plotting to avoid castint from float64 to float32
This commit is contained in:
1 parent
5eba9dbc4c
commit
0173e0b9b9
1 file changed
+6
-6
@@ -190,11 +190,11 @@ class DataView(QWidget):
|
||||
|
||||
if is_2d:
|
||||
n_rows, _ = data.shape
|
||||
row_data = data[0].astype(np.float32)
|
||||
row_data = data[0].astype(np.float64)
|
||||
else:
|
||||
row_data = data.reshape(-1).astype(np.float32)
|
||||
row_data = data.reshape(-1).astype(np.float64)
|
||||
|
||||
x = np.arange(row_data.size, dtype=np.float32)
|
||||
x = np.arange(row_data.size, dtype=np.float64)
|
||||
|
||||
self.plot_widget = pg.PlotWidget()
|
||||
plot_item = self.plot_widget.getPlotItem()
|
||||
@@ -233,8 +233,8 @@ class DataView(QWidget):
|
||||
|
||||
def on_row_changed(row):
|
||||
current_row_label.setText(str(row))
|
||||
new_data = data[row].astype(np.float32)
|
||||
new_x = np.arange(new_data.size, dtype=np.float32)
|
||||
new_data = data[row].astype(np.float64)
|
||||
new_x = np.arange(new_data.size, dtype=np.float64)
|
||||
curve.setData(new_x, new_data)
|
||||
plot_item.enableAutoRange() # type: ignore[attr-defined]
|
||||
|
||||
@@ -382,7 +382,7 @@ class DataView(QWidget):
|
||||
for c in range(show_cols):
|
||||
val = flat[r, c]
|
||||
txt = (
|
||||
f"{val:.6g}"
|
||||
f"{val:.12g}"
|
||||
if is_float
|
||||
else f"{val:.4g}" if is_complex else str(val.decode()) if is_bytes else str(val)
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user