This changes counters into a class that will hold the information on the detectors, monitors and extra devices. Note that scalerd is always read in a scan. It's usage is somewhat similar to before:
In[1]: # This selects the "Ion Ch 4" as detector, and "Time" as monitor:
In[2]: counters('Ion Ch 4')
In[3]: # Changes monitor to 'Ion Ch 3':
In[4]: counters('Ion Ch 4', 'Ion Ch 3')
In[5]: # Both 'Ion Ch 5' and 'Ion Ch 4' as detectors, and 'Ion Ch 3' as monitor:
In[6]: counters(['Ion Ch 4', 'Ion Ch 5'], 'Ion Ch 3')
In[7]: # Vortex as detector. Note that this will automatically set 'Time'
In[8]: # as the monitor, regardless of what is entered:
In[9]: vortex = load_vortex('xspress', 4)
In[10]: counters(vortex)
In[11]: # This will still use 'Time' as monitor:
In[12]: counters(vortex, 'Ion Ch 3')
In[13]: # But you can mix scaler and other detectors:
In[14]: counters([vortex, 'Ion Ch 5'])
Now it also has a extra_devices attribute that can be used to store devices that will be read at every scan point by default:
In[15]: # This reads the sample temperature in the magnet at every scan point
In[16]: counters.extra_devices = [lakeshore_336.loop2]
But note that the scan will "trigger and read" these devices, so if that process is slow, it will make the scan longer.
Local scans
The lup, ascan, and qxscan have a detectors keyword argument that is None by default. So, if you don't assign a detectors, it will use those selected in counters:
In[17]: counters('Ion Ch 4') # Ion Ch 4 is the detector, Time is the monitor.
In[18]: scalerd.preset_monitor.put(1) # Change scalerd count time to 1 sec/point
In[19]: RE(lup(mag6t.tabx, -1, 1, 50)) # Scan with Ion Ch 4 as detector, and 1 sec/point
In[20]: RE(lup(mag6t.tabx, -1, 1, 50, 2)) # Scan with Ion Ch 4 as detector, and 2 sec/point
In[21]: vortex = load_vortex('xspress', 4) # Load vortex
In[22]: RE(lup(mag6t.tabx, -1, 1, 50, 2, detectors=[vortex])) # Scan with vortex as detector, and 2 sec/point
In[23]: counters(vortex)
In[24]: RE(lup(mag6t.tabx, -1, 1, 50, 2)) # Same as last one
In[25]: RE(lup(mag6t.tabx, -1, 1, 50, -2)) # Can't have negative time!
ValueError: count_time can be < 0 only if 'scalerd.monitor is not "Time".
In[26]: counters('Ion Ch 4', 'Ion Ch 3') # Ion Ch 4 is the detector, Ion Ch 3 is the monitor
In[27]: scalerd.preset_monitor.put(100) # Change scalerd count time to 100 counts in Ion Ch 3/point
In[28]: RE(lup(mag6t.tabx, -1, 1, 50)) # Scan with Ion Ch 4 as detector, and 100 counts in Ion Ch 3/point
In[29]: RE(lup(mag6t.tabx, -1, 1, 50, 2)) # It's fine to have a positive count, it will use time! 2 sec/point.
In[30]: RE(lup(mag6t.tabx, -1, 1, 50, -200)) # 200 counts in Ion Ch 3/point.
counters
This changes
counters
into a class that will hold the information on the detectors, monitors and extra devices. Note thatscalerd
is always read in a scan. It's usage is somewhat similar to before:Now it also has a
extra_devices
attribute that can be used to store devices that will be read at every scan point by default:But note that the scan will "trigger and read" these devices, so if that process is slow, it will make the scan longer.
Local scans
The
lup
,ascan
, andqxscan
have adetectors
keyword argument that isNone
by default. So, if you don't assign adetectors
, it will use those selected incounters
: