diff --git a/bec_widgets/widgets/plots/waveform1d.py b/bec_widgets/widgets/plots/waveform1d.py index c801d72d..8c3e0237 100644 --- a/bec_widgets/widgets/plots/waveform1d.py +++ b/bec_widgets/widgets/plots/waveform1d.py @@ -5,7 +5,7 @@ from typing import Literal, Optional, Any import numpy as np import pyqtgraph as pg -from pydantic import Field, BaseModel, field_validator, ValidationError +from pydantic import Field, BaseModel, ValidationError from pyqtgraph import mkBrush from qtpy import QtCore from qtpy.QtCore import Signal as pyqtSignal @@ -17,11 +17,6 @@ from bec_lib.scan_data import ScanData from bec_widgets.utils import Colors, ConnectionConfig, BECConnector, EntryValidator from bec_widgets.widgets.plots import BECPlotBase, WidgetConfig -try: - import pandas as pd -except ImportError: - pd = None - class SignalData(BaseModel): """The data configuration of a signal in the 1D waveform widget for x and y axis.""" @@ -703,10 +698,11 @@ class BECWaveform1D(BECPlotBase): for curve in self.curves: x_data, y_data = curve.get_data() - if output == "dict": - data[curve.name()] = {"x": x_data.tolist(), "y": y_data.tolist()} - elif output == "pandas" and pd is not None: - data[curve.name()] = pd.DataFrame({"x": x_data, "y": y_data}) + if x_data is not None or y_data is not None: + if output == "dict": + data[curve.name()] = {"x": x_data.tolist(), "y": y_data.tolist()} + elif output == "pandas" and pd is not None: + data[curve.name()] = pd.DataFrame({"x": x_data, "y": y_data}) if output == "pandas" and pd is not None: combined_data = pd.concat(