|
21 | 21 | from plotpy.plot import PlotDialog |
22 | 22 | from plotpy.tools import EditPointTool |
23 | 23 | from qtpy import QtWidgets as QW |
24 | | -from sigima.objects import ExperimentalSignalParam as OrigExperimentalSignalParam |
| 24 | +from sigima.objects import CustomSignalParam as OrigCustomSignalParam |
25 | 25 | from sigima.objects import ( |
26 | 26 | Gauss2DParam, |
27 | 27 | ImageDatatypes, |
|
40 | 40 | from datalab.config import _ |
41 | 41 |
|
42 | 42 |
|
43 | | -class ExperimentalSignalParam(OrigExperimentalSignalParam): |
44 | | - """Parameters for experimental signal""" |
| 43 | +class CustomSignalParam(OrigCustomSignalParam): |
| 44 | + """Parameters for custom signal (e.g. manually defined experimental data)""" |
45 | 45 |
|
46 | 46 | def edit_curve(self, *args) -> None: # pylint: disable=unused-argument |
47 | | - """Edit experimental curve""" |
| 47 | + """Edit custom curve""" |
48 | 48 | win: PlotDialog = make.dialog( |
49 | 49 | wintitle=_("Select one point then press OK to accept"), |
50 | 50 | edit=True, |
51 | 51 | type="curve", |
52 | 52 | ) |
53 | 53 | edit_tool = win.manager.add_tool( |
54 | | - EditPointTool, title=_("Edit experimental curve") |
| 54 | + EditPointTool, title=_("Edit curve interactively") |
55 | 55 | ) |
56 | 56 | edit_tool.activate() |
57 | 57 | plot = win.manager.get_plot() |
@@ -95,24 +95,27 @@ def create_signal_gui( |
95 | 95 | Raises: |
96 | 96 | ValueError: if base_param is None and edit is False |
97 | 97 | """ |
98 | | - if isinstance(param, ExperimentalSignalParam): |
99 | | - param.setup_array(size=param.size, xmin=param.xmin, xmax=param.xmax) |
100 | | - if edit and not param.edit(parent=parent): |
101 | | - return None |
102 | | - signal = create_signal(param.title) |
103 | | - signal.xydata = param.xyarray.T |
104 | | - if signal.title == SIGNAL_DEFAULT_TITLE: |
105 | | - signal.title = f"experimental(npts={param.size})" |
106 | | - return signal |
107 | | - |
108 | 98 | if param is None: |
109 | 99 | param = NewSignalParam() |
110 | 100 | edit = True # Default to editing if no parameters provided |
111 | 101 |
|
| 102 | + if isinstance(param, OrigCustomSignalParam) and edit: |
| 103 | + p_init = NewSignalParam(_("Custom signal")) |
| 104 | + if not p_init.edit(parent=parent): |
| 105 | + return None |
| 106 | + param.setup_array(size=p_init.size, xmin=p_init.xmin, xmax=p_init.xmax) |
| 107 | + |
112 | 108 | if edit: |
113 | 109 | if not param.edit(parent=parent): |
114 | 110 | return None |
115 | 111 |
|
| 112 | + if isinstance(param, OrigCustomSignalParam): |
| 113 | + signal = create_signal(param.title) |
| 114 | + signal.xydata = param.xyarray.T |
| 115 | + if signal.title == SIGNAL_DEFAULT_TITLE: |
| 116 | + signal.title = f"custom(npts={param.size})" |
| 117 | + return signal |
| 118 | + |
116 | 119 | try: |
117 | 120 | signal = create_signal_headless(param) |
118 | 121 | except Exception as exc: # pylint: disable=broad-except |
|
0 commit comments