Skip to content

Commit 0767130

Browse files
committed
Adding explanatory warnings to the backwards compatibility code instructing
users how to update existing configurations.
1 parent f138144 commit 0767130

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

labscript_devices/NI_DAQmx/blacs_tabs.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from blacs.device_base_class import DeviceTab
1818
from .utils import split_conn_AO, split_conn_DO
1919
from . import models
20+
import warnings
2021

2122

2223
class NI_DAQmxTab(DeviceTab):
@@ -44,8 +45,14 @@ def initialise_GUI(self):
4445
try:
4546
AI_chans = properties['AI_chans']
4647
except KeyError:
47-
# assume legacy behavior
48+
# new code being run on older model specification file
49+
# assume legacy behavior, warn user to update
4850
AI_chans = [f'ai{i:d}' for i in range(num_AI)]
51+
msg = """Connection table was compiled with old model specifications for {0}.
52+
Please recompile the connection table.
53+
"""
54+
warnings.warn(dedent(msg.format(properties['MAX_name'])), FutureWarning)
55+
4956
ports = properties['ports']
5057
num_CI = properties['num_CI']
5158

labscript_devices/NI_DAQmx/labscript_devices.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from labscript_utils import dedent
3131
from .utils import split_conn_DO, split_conn_AO, split_conn_AI
3232
import numpy as np
33+
import warnings
3334

3435
_ints = {8: np.uint8, 16: np.uint16, 32: np.uint32, 64: np.uint64}
3536

@@ -218,6 +219,12 @@ def __init__(
218219
if AI_term_cfg == None:
219220
# assume legacy configuration if none provided
220221
AI_term_cfg = {f'ai{i:d}': ['RSE'] for i in range(num_AI)}
222+
# warn user to update their local model specs
223+
msg = """Model specifications for {} needs to be updated.
224+
Please run the `get_capabilites.py` and `generate_subclasses.py`
225+
scripts or define the `AI_Term_Cfg` kwarg for your device.
226+
"""
227+
warnings.warn(dedent(msg.format(self.description)), FutureWarning)
221228
self.AI_chans = [key for key,val in AI_term_cfg.items() if self.AI_term in val]
222229
if not len(self.AI_chans):
223230
msg = """AI termination {0} not supported by this device."""

0 commit comments

Comments
 (0)