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

BUG: ScalerCH.select_channels() selects channel with no name text #869

Closed
prjemian opened this issue May 28, 2020 · 3 comments · Fixed by #887
Closed

BUG: ScalerCH.select_channels() selects channel with no name text #869

prjemian opened this issue May 28, 2020 · 3 comments · Fixed by #887
Assignees
Labels

Comments

@prjemian
Copy link
Contributor

prjemian commented May 28, 2020

In BCDA-APS/use_bluesky#56, the name field of the first channel of the scaler was left blank in EPICS. The select_channels() code failed to handle this properly. Even when that name was set after the bluesky session started, select_channels() code still failed to handle this properly. If the channel had a name before bluesky connected to the scaler, then select_channels() code works properly.

Also, now is a good time to make the chan_names argument into a kwarg with default of None or []. Do that enhancement in a separate issue (#870).

@prjemian
Copy link
Contributor Author

Further investigation with ophyd 1.5.1

test program

#!/usr/bin/env python

import ophyd
print(f"ophyd version: {ophyd.__version__}")

from ophyd.scaler import ScalerCH
from apstools.utils import device_read2table

scaler = ScalerCH("sky:scaler1", name="scaler")
scaler.wait_for_connection()

def procedure(text):
    scaler.channels.chan01.chname.put(text)
    scaler.select_channels(None)
    scaler.trigger()
    device_read2table(scaler)

procedure("")
procedure("clock")

output

(bluesky_2020_5) mintadmin@mint-vm:~$ ./scaler_869.py 
ophyd version: 1.5.1
=========== ===== ==========================
name        value timestamp                 
=========== ===== ==========================
            0.0   2020-07-20 23:40:59.445615
I0          0.0   2020-07-20 23:40:59.445615
scint       0.0   2020-07-20 23:40:59.445615
diode       0.0   2020-07-20 23:40:59.445615
I0Mon       0.0   2020-07-20 23:40:59.445615
ROI1        0.0   2020-07-20 23:40:59.445615
ROI2        0.0   2020-07-20 23:40:59.445615
scaler_time 0.0   2020-07-20 23:40:59.445615
=========== ===== ==========================

=========== ===== ==========================
name        value timestamp                 
=========== ===== ==========================
clock       0.0   2020-07-20 23:41:22.215437
I0          0.0   2020-07-20 23:41:22.215437
scint       0.0   2020-07-20 23:41:22.215437
diode       0.0   2020-07-20 23:41:22.215437
I0Mon       0.0   2020-07-20 23:41:22.215437
ROI1        0.0   2020-07-20 23:41:22.215437
ROI2        0.0   2020-07-20 23:41:22.215437
scaler_time 0.0   2020-07-20 23:41:22.215437
=========== ===== ==========================

Summary, when the first channel name is blank in EPICS, then select_channels() fails to remove that channel. When it is set, select_channels() works properly.

@prjemian
Copy link
Contributor Author

Note if the second channel name is also blank, it is removed each time. Only the first channel name has this problem.

@prjemian
Copy link
Contributor Author

Since scaler_time is always reported, then this line is not needed:

read_attrs = ['chan01'] # always include time

replace it with: read_attrs = []

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

Successfully merging a pull request may close this issue.

1 participant