Skip to content

Allow scalar monitor#1221

Merged
sergey-yaroslavtsev merged 2 commits into
masterfrom
single_value_monitor
Jun 24, 2026
Merged

Allow scalar monitor#1221
sergey-yaroslavtsev merged 2 commits into
masterfrom
single_value_monitor

Conversation

@sergey-yaroslavtsev

Copy link
Copy Markdown
Collaborator

Closes #1218
convert scalar to numpy array (with a single value, no need to extend to len(ydata))
do not strip ydata if monitor is scalar
explicitly handle scalar monitor for single monitor selection (in multi monitor selection it is already handled)
fix a small issue for multi monitor - before start iterating all monitors should have len > 0 not only first one
delete few lines which were related to Python2

Comment thread src/PyMca5/PyMcaCore/NexusDataSource.py Outdated
Comment thread src/PyMca5/PyMcaGui/pymca/ScanWindow.py Outdated
mvalue = dataObject.m[0][0]
if mvalue == 0:
raise ValueError("Do not divide by zero")
mdata = numpy.array([mvalue])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant but does seem to work unexpectedly. I would remove it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. mdata = numpy.array([mvalue]) is useless.
But now I am not sure this part of code is reachable at all... it is not for HDF5 but for SPS. Have no idea if there monitor could be scalar. Probably? or should this block to be removed?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep it.

@sergey-yaroslavtsev sergey-yaroslavtsev merged commit 13c5098 into master Jun 24, 2026
10 checks passed
@sergey-yaroslavtsev sergey-yaroslavtsev deleted the single_value_monitor branch June 24, 2026 17:48
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

Successfully merging this pull request may close these issues.

0d (single value) monitor signals

2 participants