Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warnings are displayed for blocks with empty tables #47

Open
dmgav opened this issue Sep 14, 2023 · 1 comment
Open

Warnings are displayed for blocks with empty tables #47

dmgav opened this issue Sep 14, 2023 · 1 comment

Comments

@dmgav
Copy link
Contributor

dmgav commented Sep 14, 2023

A series of warnings is displayed by the IOC each time a user switches between designs using GUI. The warnings are printed for the blocks with empty tables (in this test SEQ2 and PGEN2):

Traceback (most recent call last):
  File "/nsls2/users/dgavrilov/repos/PandABlocks-ioc/src/pandablocks_ioc/_tables.py", line 678, in _update_scalar
    scalar_val = waveform_data[index]
IndexError: index 0 is out of bounds for axis 0 with size 0
WARNING:Index 0 of record SEQ2:TABLE:TRIGGER is out of bounds.
Traceback (most recent call last):
  File "/nsls2/users/dgavrilov/repos/PandABlocks-ioc/src/pandablocks_ioc/_tables.py", line 678, in _update_scalar
    scalar_val = waveform_data[index]
IndexError: index 0 is out of bounds for axis 0 with size 0
WARNING:Index 0 of record SEQ2:TABLE:POSITION is out of bounds.
Traceback (most recent call last):
  File "/nsls2/users/dgavrilov/repos/PandABlocks-ioc/src/pandablocks_ioc/_tables.py", line 678, in _update_scalar
    scalar_val = waveform_data[index]
IndexError: index 0 is out of bounds for axis 0 with size 0
WARNING:Index 0 of record SEQ2:TABLE:TIME1 is out of bounds.
Traceback (most recent call last):
  File "/nsls2/users/dgavrilov/repos/PandABlocks-ioc/src/pandablocks_ioc/_tables.py", line 678, in _update_scalar
    scalar_val = waveform_data[index]
IndexError: index 0 is out of bounds for axis 0 with size 0
WARNING:Index 0 of record SEQ2:TABLE:OUTA1 is out of bounds.
Traceback (most recent call last):
  File "/nsls2/users/dgavrilov/repos/PandABlocks-ioc/src/pandablocks_ioc/_tables.py", line 678, in _update_scalar
    scalar_val = waveform_data[index]
IndexError: index 0 is out of bounds for axis 0 with size 0
WARNING:Index 0 of record SEQ2:TABLE:OUTB1 is out of bounds.
Traceback (most recent call last):
  File "/nsls2/users/dgavrilov/repos/PandABlocks-ioc/src/pandablocks_ioc/_tables.py", line 678, in _update_scalar
    scalar_val = waveform_data[index]
IndexError: index 0 is out of bounds for axis 0 with size 0
WARNING:Index 0 of record SEQ2:TABLE:OUTC1 is out of bounds.
Traceback (most recent call last):
  File "/nsls2/users/dgavrilov/repos/PandABlocks-ioc/src/pandablocks_ioc/_tables.py", line 678, in _update_scalar
    scalar_val = waveform_data[index]
IndexError: index 0 is out of bounds for axis 0 with size 0
WARNING:Index 0 of record SEQ2:TABLE:OUTD1 is out of bounds.
Traceback (most recent call last):
  File "/nsls2/users/dgavrilov/repos/PandABlocks-ioc/src/pandablocks_ioc/_tables.py", line 678, in _update_scalar
    scalar_val = waveform_data[index]
IndexError: index 0 is out of bounds for axis 0 with size 0
WARNING:Index 0 of record SEQ2:TABLE:OUTE1 is out of bounds.
Traceback (most recent call last):
  File "/nsls2/users/dgavrilov/repos/PandABlocks-ioc/src/pandablocks_ioc/_tables.py", line 678, in _update_scalar
    scalar_val = waveform_data[index]
IndexError: index 0 is out of bounds for axis 0 with size 0
WARNING:Index 0 of record SEQ2:TABLE:OUTF1 is out of bounds.
Traceback (most recent call last):
  File "/nsls2/users/dgavrilov/repos/PandABlocks-ioc/src/pandablocks_ioc/_tables.py", line 678, in _update_scalar
    scalar_val = waveform_data[index]
IndexError: index 0 is out of bounds for axis 0 with size 0
WARNING:Index 0 of record SEQ2:TABLE:TIME2 is out of bounds.
Traceback (most recent call last):
  File "/nsls2/users/dgavrilov/repos/PandABlocks-ioc/src/pandablocks_ioc/_tables.py", line 678, in _update_scalar
    scalar_val = waveform_data[index]
IndexError: index 0 is out of bounds for axis 0 with size 0
WARNING:Index 0 of record SEQ2:TABLE:OUTA2 is out of bounds.
Traceback (most recent call last):
  File "/nsls2/users/dgavrilov/repos/PandABlocks-ioc/src/pandablocks_ioc/_tables.py", line 678, in _update_scalar
    scalar_val = waveform_data[index]
IndexError: index 0 is out of bounds for axis 0 with size 0
WARNING:Index 0 of record SEQ2:TABLE:OUTB2 is out of bounds.
Traceback (most recent call last):
  File "/nsls2/users/dgavrilov/repos/PandABlocks-ioc/src/pandablocks_ioc/_tables.py", line 678, in _update_scalar
    scalar_val = waveform_data[index]
IndexError: index 0 is out of bounds for axis 0 with size 0
WARNING:Index 0 of record SEQ2:TABLE:OUTC2 is out of bounds.
Traceback (most recent call last):
  File "/nsls2/users/dgavrilov/repos/PandABlocks-ioc/src/pandablocks_ioc/_tables.py", line 678, in _update_scalar
    scalar_val = waveform_data[index]
IndexError: index 0 is out of bounds for axis 0 with size 0
WARNING:Index 0 of record SEQ2:TABLE:OUTD2 is out of bounds.
Traceback (most recent call last):
  File "/nsls2/users/dgavrilov/repos/PandABlocks-ioc/src/pandablocks_ioc/_tables.py", line 678, in _update_scalar
    scalar_val = waveform_data[index]
IndexError: index 0 is out of bounds for axis 0 with size 0
WARNING:Index 0 of record SEQ2:TABLE:OUTE2 is out of bounds.
Traceback (most recent call last):
  File "/nsls2/users/dgavrilov/repos/PandABlocks-ioc/src/pandablocks_ioc/_tables.py", line 678, in _update_scalar
    scalar_val = waveform_data[index]
IndexError: index 0 is out of bounds for axis 0 with size 0
WARNING:Index 0 of record SEQ2:TABLE:OUTF2 is out of bounds.
Traceback (most recent call last):
  File "/nsls2/users/dgavrilov/repos/PandABlocks-ioc/src/pandablocks_ioc/_tables.py", line 678, in _update_scalar
    scalar_val = waveform_data[index]
IndexError: index 0 is out of bounds for axis 0 with size 0
WARNING:Index 0 of record PGEN2:TABLE:POSITION is out of bounds.
Traceback (most recent call last):
  File "/nsls2/users/dgavrilov/repos/PandABlocks-ioc/src/pandablocks_ioc/_tables.py", line 678, in _update_scalar
    scalar_val = waveform_data[index]
IndexError: index 0 is out of bounds for axis 0 with size 0
@dmgav
Copy link
Contributor Author

dmgav commented Sep 14, 2023

Possible solution: to quiet down the exception the case when len(waveform) == 0 should be processed separately by raising a dedicated exception or just by checking the condition and setting scalar_val=0 and sev to alarm.NO_ALARM or alarm.INVALID_ALARM without printing the error message.

try:
scalar_val = waveform_data[index]
if labels:
# mbbi/o records must use the numeric index
scalar_val = labels.index(scalar_val)
sev = alarm.NO_ALARM
except IndexError as e:
logging.warning(
f"Index {index} of record {waveform_record_name} is out of bounds.",
exc_info=e,
)
scalar_val = 0
sev = alarm.INVALID_ALARM
except ValueError as e:
logging.warning(
f"Value {scalar_val} of record {waveform_record_name} is not "
"a recognised value.",
exc_info=e,
)
scalar_val = 0
sev = alarm.INVALID_ALARM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant