BCDA-APS / use_bluesky

Tools to help APS use the Bluesky Framework (https://blueskyproject.io/)
8 stars 3 forks source link

Bluesky Tutorial Run Error, Lesson 1 #56

Closed qzhang234 closed 4 years ago

qzhang234 commented 4 years ago

I downloaded the newest version of the Bluesky lesson from Box (https://anl.box.com/s/34d4rqn6334j16iym38815c61tnxsrpt) and placed it at /home/beams10/8IDIUSER/lessons on 8idiuser@talc.

When I tried to run RE(bp.count([scaler])) in lesson1.ipynb, I got the following error, see run_error.txt

@prjemian any suggestions?

qzhang234 commented 4 years ago

@prjemian Also it seems like I don't have the permission to assign people to this issue yet

prjemian commented 4 years ago

It's OK to paste the full text of an error message into an issue. The attached .txt file must be downloaded and viewed in a separate tool and that's just more steps. If the error message gets really long, you can enclose in a dropdown section following this advice: https://gist.github.com/prjemian/06650476c965929d1fd487935e8ea352

The problem here is that a scaler channel with no name is still included as an active channel, even though the tutorial calls: scaler.select_channels(None).

The fix should be included in that call and it seems the fix is not there. I'll have to fix it in ophyd but for now, replace the cell (two cells after the scaler.wait_for_connection() that reads:

scaler.select_channels(None)
scaler.read()

with this content

from apstools.devices import use_EPICS_scaler_channels

scaler.select_channels(None)
use_EPICS_scaler_channels(scaler)
scaler.read()
prjemian commented 4 years ago

before the fix:

OrderedDict([('', {'value': 0.0, 'timestamp': 1589830782.781853}),
             ('scint', {'value': 7.0, 'timestamp': 1589830782.781853}),
             ('roi1', {'value': 8.0, 'timestamp': 1589830782.781853}),
             ('scaler_time', {'value': 1.6, 'timestamp': 1589830782.781853})])

after the fix

OrderedDict([('scint', {'value': 7.0, 'timestamp': 1589830782.781853}),
             ('roi1', {'value': 8.0, 'timestamp': 1589830782.781853}),
             ('scaler_time', {'value': 1.6, 'timestamp': 1589830782.781853})])
prjemian commented 4 years ago

And, until I fix the lesson, replace every instance of

scaler.select_channels(None)

with

# scaler.select_channels(None)
use_EPICS_scaler_channels(scaler)
prjemian commented 4 years ago

See https://github.com/bluesky/ophyd/issues/692 yet something funny happened on the to the release (https://github.com/bluesky/ophyd/issues/714) and it seems this still does not work as intended.

The error only shows up now since I just (last week) removed the call to apstools.devices.use_EPICS_scaler_channels() from the tutorials. That's all it took to expose there is still a fix needed for this in ophyd.

prjemian commented 4 years ago

On a different workstation, different installation of the framework, not seeing this error. The lesson1.ipynb notebook correctly removes the scaler channel with the blank name. Version difference?

Here's a view from the workstation with no problem: Clipboard01

prjemian commented 4 years ago

Here's the same view from workstation snow at your beam line:

Clipboard01

prjemian commented 4 years ago

Aha! On snow, channel 1 is not named where the other (successful) workstation has given name clock to channel 1. When channel 1 has a name, both workstations are successful using only scaler.select_channels(). When the notebook is started and channel 1 does not have a name, both workstations reported the same error as noted above.

prjemian commented 4 years ago

For now, no changes are needed in the notebook but give channel 1 (of the scaler) a name before you start the notebook. The name clock is appropriate.

caput sky:scaler1.NM1 clock

The underlying ophyd support needs a bug fix.

qzhang234 commented 4 years ago

I got another error message on use_EPICS_scaler_channels() on talc this time:

Screen Shot 2020-05-19 at 10 58 29 AM
prjemian commented 4 years ago

Toggle the comments back to read:

scaler.select_channels(None)
# use_EPICS_scaler_channels(scaler)
scaler.read()
prjemian commented 4 years ago

Once a BUG is filed with ophyd, this issue can be closed.

prjemian commented 4 years ago

https://github.com/bluesky/ophyd/issues/869