-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bringing bluesky development up to date
- Loading branch information
root
committed
Jan 19, 2017
1 parent
69c020f
commit 059f1a7
Showing
12 changed files
with
4,366 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
def wh_all(): | ||
wh_pos([mono_bragg,mono_pitch2,mono_roll2,mono_perp2]) | ||
wh_pos([mir_usx,mir_dsx,mir_usy,mir_dsyi,mir_dsyo,mir_bend]) | ||
wh_pos(s0) | ||
wh_pos(s1) | ||
wh_pos(s2) | ||
wh_pos(s3) | ||
wh_pos(s4) | ||
wh_pos(s5) | ||
wh_pos([bim3y,fs3y,bim4y,bim5y]) | ||
wh_pos([smx,smy,sth,schi,sphi,srot,strans]) | ||
wh_pos([camx,camy]) | ||
wh_pos([DETx,DETy,WAXSx,SAXSx,SAXSy]) | ||
wh_pos([bsx,bsy,bsphi]) | ||
wh_pos([armz,armx,armphi,army,armr]) | ||
|
||
|
||
def wh_offsets(): | ||
print('Direction: 0--Pos, 1--Neg\n') | ||
|
||
## mono | ||
wh_pos([mono_bragg,mono_pitch2,mono_roll2,mono_perp2]) | ||
print('mono_bragg: offset = %f, direction = %d' % (caget('XF:11BMA-OP{Mono:DMM-Ax:Bragg}Mtr.OFF'),caget('XF:11BMA-OP{Mono:DMM-Ax:Bragg}Mtr.DIR'))) | ||
print('mono_pitch2: offset = %f, direction = %d' % (caget('XF:11BMA-OP{Mono:DMM-Ax:P2}Mtr.OFF'),caget('XF:11BMA-OP{Mono:DMM-Ax:P2}Mtr.DIR'))) | ||
print('mono_roll2: offset = %f, direction = %d' % (caget('XF:11BMA-OP{Mono:DMM-Ax:R2}Mtr.OFF'),caget('XF:11BMA-OP{Mono:DMM-Ax:R2}Mtr.DIR'))) | ||
print('mono_perp2: offset = %f, direction = %d' % (caget('XF:11BMA-OP{Mono:DMM-Ax:Y2}Mtr.OFF'),caget('XF:11BMA-OP{Mono:DMM-Ax:Y2}Mtr.DIR'))) | ||
|
||
## mirror | ||
wh_pos([mir_usx,mir_dsx,mir_usy,mir_dsyi,mir_dsyo,mir_bend]) | ||
print('mir_usx: offset = %f, direction = %d' % (caget('XF:11BMA-OP{Mir:Tor-Ax:XU}Mtr.OFF'),caget('XF:11BMA-OP{Mir:Tor-Ax:XU}Mtr.DIR'))) | ||
print('mir_dsx: offset = %f, direction = %d' % (caget('XF:11BMA-OP{Mir:Tor-Ax:XD}Mtr.OFF'),caget('XF:11BMA-OP{Mir:Tor-Ax:XD}Mtr.DIR'))) | ||
print('mir_usy: offset = %f, direction = %d' % (caget('XF:11BMA-OP{Mir:Tor-Ax:YU}Mtr.OFF'),caget('XF:11BMA-OP{Mir:Tor-Ax:YU}Mtr.DIR'))) | ||
print('mir_dsyi: offset = %f, direction = %d' % (caget('XF:11BMA-OP{Mir:Tor-Ax:YDI}Mtr.OFF'),caget('XF:11BMA-OP{Mir:Tor-Ax:YDI}Mtr.DIR'))) | ||
print('mir_dsyo: offset = %f, direction = %d' % (caget('XF:11BMA-OP{Mir:Tor-Ax:YDO}Mtr.OFF'),caget('XF:11BMA-OP{Mir:Tor-Ax:YDO}Mtr.DIR'))) | ||
print('mir_bend: offset = %f, direction = %d' % (caget('XF:11BMA-OP{Mir:Tor-Ax:UB}Mtr.OFF'),caget('XF:11BMA-OP{Mir:Tor-Ax:UB}Mtr.DIR'))) | ||
|
||
## slits S0 | ||
wh_pos(s0) | ||
print('s0.tp: offset = %f, direction = %d' % (caget('XF:11BMA-OP{Slt:0-Ax:T}Mtr.OFF'),caget('XF:11BMA-OP{Slt:0-Ax:T}Mtr.DIR'))) | ||
print('s0.bt: offset = %f, direction = %d' % (caget('XF:11BMA-OP{Slt:0-Ax:B}Mtr.OFF'),caget('XF:11BMA-OP{Slt:0-Ax:B}Mtr.DIR'))) | ||
print('s0.ob: offset = %f, direction = %d' % (caget('XF:11BMA-OP{Slt:0-Ax:O}Mtr.OFF'),caget('XF:11BMA-OP{Slt:0-Ax:O}Mtr.DIR'))) | ||
print('s0.ib: offset = %f, direction = %d' % (caget('XF:11BMA-OP{Slt:0-Ax:I}Mtr.OFF'),caget('XF:11BMA-OP{Slt:0-Ax:I}Mtr.DIR'))) | ||
|
||
## slits S1 | ||
wh_pos(s1) | ||
print('s1.xc: offset = %f, direction = %d' % (caget('XF:11BMB-OP{Slt:1-Ax:XC}Mtr.OFF'),caget('XF:11BMB-OP{Slt:1-Ax:XC}Mtr.DIR'))) | ||
print('s1.xg: offset = %f, direction = %d' % (caget('XF:11BMB-OP{Slt:1-Ax:XG}Mtr.OFF'),caget('XF:11BMB-OP{Slt:1-Ax:XG}Mtr.DIR'))) | ||
print('s1.yc: offset = %f, direction = %d' % (caget('XF:11BMB-OP{Slt:1-Ax:YC}Mtr.OFF'),caget('XF:11BMB-OP{Slt:1-Ax:YC}Mtr.DIR'))) | ||
print('s1.yg: offset = %f, direction = %d' % (caget('XF:11BMB-OP{Slt:1-Ax:YG}Mtr.OFF'),caget('XF:11BMB-OP{Slt:1-Ax:YG}Mtr.DIR'))) | ||
|
||
## slits S2 | ||
wh_pos(s2) | ||
print('s2.xc: offset = %f, direction = %d' % (caget('XF:11BMB-OP{Slt:2-Ax:XC}Mtr.OFF'),caget('XF:11BMB-OP{Slt:2-Ax:XC}Mtr.DIR'))) | ||
print('s2.xg: offset = %f, direction = %d' % (caget('XF:11BMB-OP{Slt:2-Ax:XG}Mtr.OFF'),caget('XF:11BMB-OP{Slt:2-Ax:XG}Mtr.DIR'))) | ||
print('s2.yc: offset = %f, direction = %d' % (caget('XF:11BMB-OP{Slt:2-Ax:YC}Mtr.OFF'),caget('XF:11BMB-OP{Slt:2-Ax:YC}Mtr.DIR'))) | ||
print('s2.yg: offset = %f, direction = %d' % (caget('XF:11BMB-OP{Slt:2-Ax:YG}Mtr.OFF'),caget('XF:11BMB-OP{Slt:2-Ax:YG}Mtr.DIR'))) | ||
|
||
## slits S3 | ||
wh_pos(s3) | ||
print('s3.xc: offset = %f, direction = %d' % (caget('XF:11BMB-OP{Slt:3-Ax:XC}Mtr.OFF'),caget('XF:11BMB-OP{Slt:3-Ax:XC}Mtr.DIR'))) | ||
print('s3.xg: offset = %f, direction = %d' % (caget('XF:11BMB-OP{Slt:3-Ax:XG}Mtr.OFF'),caget('XF:11BMB-OP{Slt:3-Ax:XG}Mtr.DIR'))) | ||
print('s3.yc: offset = %f, direction = %d' % (caget('XF:11BMB-OP{Slt:3-Ax:YC}Mtr.OFF'),caget('XF:11BMB-OP{Slt:3-Ax:YC}Mtr.DIR'))) | ||
print('s3.yg: offset = %f, direction = %d' % (caget('XF:11BMB-OP{Slt:3-Ax:YG}Mtr.OFF'),caget('XF:11BMB-OP{Slt:3-Ax:YG}Mtr.DIR'))) | ||
|
||
## slits S4 | ||
wh_pos(s4) | ||
print('s4.xc: offset = %f, direction = %d' % (caget('XF:11BMB-OP{Slt:4-Ax:XC}Mtr.OFF'),caget('XF:11BMB-OP{Slt:4-Ax:XC}Mtr.DIR'))) | ||
print('s4.xg: offset = %f, direction = %d' % (caget('XF:11BMB-OP{Slt:4-Ax:XG}Mtr.OFF'),caget('XF:11BMB-OP{Slt:4-Ax:XG}Mtr.DIR'))) | ||
print('s4.yc: offset = %f, direction = %d' % (caget('XF:11BMB-OP{Slt:4-Ax:YC}Mtr.OFF'),caget('XF:11BMB-OP{Slt:4-Ax:YC}Mtr.DIR'))) | ||
print('s4.yg: offset = %f, direction = %d' % (caget('XF:11BMB-OP{Slt:4-Ax:YG}Mtr.OFF'),caget('XF:11BMB-OP{Slt:4-Ax:YG}Mtr.DIR'))) | ||
|
||
## slits S5 | ||
wh_pos(s5) | ||
print('s5.xc: offset = %f, direction = %d' % (caget('XF:11BMB-OP{Slt:5-Ax:XC}Mtr.OFF'),caget('XF:11BMB-OP{Slt:5-Ax:XC}Mtr.DIR'))) | ||
print('s5.xg: offset = %f, direction = %d' % (caget('XF:11BMB-OP{Slt:5-Ax:XG}Mtr.OFF'),caget('XF:11BMB-OP{Slt:5-Ax:XG}Mtr.DIR'))) | ||
print('s5.yc: offset = %f, direction = %d' % (caget('XF:11BMB-OP{Slt:5-Ax:YC}Mtr.OFF'),caget('XF:11BMB-OP{Slt:5-Ax:YC}Mtr.DIR'))) | ||
print('s5.yg: offset = %f, direction = %d' % (caget('XF:11BMB-OP{Slt:5-Ax:YG}Mtr.OFF'),caget('XF:11BMB-OP{Slt:5-Ax:YG}Mtr.DIR'))) | ||
|
||
|
||
## diagnostic stages | ||
wh_pos([bim3y,fs3y,bim4y,bim5y]) | ||
print('bim3y: offset = %f, direction = %d' % (caget('XF:11BMB-BI{IM:3-Ax:Y}Mtr.OFF'),caget('XF:11BMB-BI{IM:3-Ax:Y}Mtr.DIR'))) | ||
print('fs3y: offset = %f, direction = %d' % (caget('XF:11BMB-BI{FS:3-Ax:Y}Mtr.OFF'),caget('XF:11BMB-BI{FS:3-Ax:Y}Mtr.DIR'))) | ||
print('bim4y: offset = %f, direction = %d' % (caget('XF:11BMB-BI{IM:4-Ax:Y}Mtr.OFF'),caget('XF:11BMB-BI{IM:4-Ax:Y}Mtr.DIR'))) | ||
print('bim5y: offset = %f, direction = %d' % (caget('XF:11BMB-BI{IM:5-Ax:Y}Mtr.OFF'),caget('XF:11BMB-BI{IM:5-Ax:Y}Mtr.DIR'))) | ||
|
||
|
||
## sample stages | ||
wh_pos([smx,smy,sth,schi,sphi,srot,strans]) | ||
print('smx: offset = %f, direction = %d' % (caget('XF:11BMB-ES{Chm:Smpl-Ax:X}Mtr.OFF'),caget('XF:11BMB-ES{Chm:Smpl-Ax:X}Mtr.DIR'))) | ||
print('smy: offset = %f, direction = %d' % (caget('XF:11BMB-ES{Chm:Smpl-Ax:Z}Mtr.OFF'),caget('XF:11BMB-ES{Chm:Smpl-Ax:Z}Mtr.DIR'))) | ||
print('sth: offset = %f, direction = %d' % (caget('XF:11BMB-ES{Chm:Smpl-Ax:theta}Mtr.OFF'),caget('XF:11BMB-ES{Chm:Smpl-Ax:theta}Mtr.DIR'))) | ||
print('schi: offset = %f, direction = %d' % (caget('XF:11BMB-ES{Chm:Smpl-Ax:chi}Mtr.OFF'),caget('XF:11BMB-ES{Chm:Smpl-Ax:chi}Mtr.DIR'))) | ||
print('sphi: offset = %f, direction = %d' % (caget('XF:11BMB-ES{Chm:Smpl-Ax:phi}Mtr.OFF'),caget('XF:11BMB-ES{Chm:Smpl-Ax:phi}Mtr.DIR'))) | ||
print('srot: offset = %f, direction = %d' % (caget('XF:11BMB-ES{SM:1-Ax:Srot}Mtr.OFF'),caget('XF:11BMB-ES{SM:1-Ax:Srot}Mtr.DIR'))) | ||
print('strans: offset = %f, direction = %d' % (caget('XF:11BMB-ES{SM:1-Ax:Strans}Mtr.OFF'),caget('XF:11BMB-ES{SM:1-Ax:Strans}Mtr.DIR'))) | ||
|
||
|
||
## camera | ||
wh_pos([camx,camy]) | ||
print('camx: offset = %f, direction = %d' % (caget('XF:11BMB-ES{Cam:OnAxis-Ax:X1}Mtr.OFF'),caget('XF:11BMB-ES{Cam:OnAxis-Ax:X1}Mtr.DIR'))) | ||
print('camy: offset = %f, direction = %d' % (caget('XF:11BMB-ES{Cam:OnAxis-Ax:Y1}Mtr.OFF'),caget('XF:11BMB-ES{Cam:OnAxis-Ax:Y1}Mtr.OFF'))) | ||
|
||
|
||
## detector stages | ||
wh_pos([DETx,DETy,WAXSx,SAXSx,SAXSy]) | ||
print('DETx: offset = %f, direction = %d' % (caget('XF:11BMB-ES{Det:Stg-Ax:X}Mtr.OFF'),caget('XF:11BMB-ES{Det:Stg-Ax:X}Mtr.DIR'))) | ||
print('DETy: offset = %f, direction = %d' % (caget('XF:11BMB-ES{Det:Stg-Ax:Y}Mtr.OFF'),caget('XF:11BMB-ES{Det:Stg-Ax:Y}Mtr.DIR'))) | ||
print('WAXSx: offset = %f, direction = %d' % (caget('XF:11BMB-ES{Det:WAXS-Ax:X}Mtr.OFF'),caget('XF:11BMB-ES{Det:WAXS-Ax:X}Mtr.DIR'))) | ||
print('SAXSx: offset = %f, direction = %d' % (caget('XF:11BMB-ES{Det:SAXS-Ax:X}Mtr.OFF'),caget('XF:11BMB-ES{Det:SAXS-Ax:X}Mtr.DIR'))) | ||
print('SAXSy: offset = %f, direction = %d' % (caget('XF:11BMB-ES{Det:SAXS-Ax:Y}Mtr.OFF'),caget('XF:11BMB-ES{Det:SAXS-Ax:Y}Mtr.DIR'))) | ||
|
||
|
||
## beamstop | ||
wh_pos([bsx,bsy,bsphi]) | ||
print('bsx: offset = %f, direction = %d' % (caget('XF:11BMB-ES{BS:SAXS-Ax:X}Mtr.OFF'),caget('XF:11BMB-ES{BS:SAXS-Ax:X}Mtr.DIR'))) | ||
print('bsy: offset = %f, direction = %d' % (caget('XF:11BMB-ES{BS:SAXS-Ax:Y}Mtr.OFF'),caget('XF:11BMB-ES{BS:SAXS-Ax:Y}Mtr.DIR'))) | ||
print('bsphi: offset = %f, direction = %d' % (caget('XF:11BMB-ES{BS:SAXS-Ax:phi}Mtr.OFF'),caget('XF:11BMB-ES{BS:SAXS-Ax:phi}Mtr.DIR'))) | ||
|
||
|
||
## sample exchanger | ||
wh_pos([armz,armx,armphi,army,armr]) | ||
print('armz: offset = %f, direction = %d' % (caget('XF:11BMB-ES{SM:1-Ax:Z}Mtr.OFF'),caget('XF:11BMB-ES{SM:1-Ax:Z}Mtr.DIR'))) | ||
print('armx: offset = %f, direction = %d' % (caget('XF:11BMB-ES{SM:1-Ax:X}Mtr.OFF'),caget('XF:11BMB-ES{SM:1-Ax:X}Mtr.DIR'))) | ||
print('armphi: offset = %f, direction = %d' % (caget('XF:11BMB-ES{SM:1-Ax:Yaw}Mtr.OFF'),caget('XF:11BMB-ES{SM:1-Ax:Yaw}Mtr.DIR'))) | ||
print('army: offset = %f, direction = %d' % (caget('XF:11BMB-ES{SM:1-Ax:Y}Mtr.OFF'),caget('XF:11BMB-ES{SM:1-Ax:Y}Mtr.DIR'))) | ||
print('armr: offset = %f, direction = %d' % (caget('XF:11BMB-ES{SM:1-Ax:ArmR}Mtr.OFF'),caget('XF:11BMB-ES{SM:1-Ax:ArmR}Mtr.DIR'))) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
|
||
|
||
##### Experimental shutters ##### | ||
# These shutters are controlled by sending a 5V pulse via QEM output on the Delta Tau controller MC06 | ||
# (the same unit that controls slits S5). Both the opening and closing of the shutter are triggered | ||
# by the rise of the pulse. | ||
# | ||
# Note: | ||
# - PV for the QEM output on MC06 is: | ||
# XF:11BMB-CT{MC:06}Asyn.AOUT | ||
# - This PV is located under Slit 5/Asyn --> asynRecord/More... --> asynOctet interface I/O --> ASCII | ||
# - 'M112=1' sets the state to high | ||
# - 'M112=0' sets the state to low | ||
# - 'M111=1' launches the change in state | ||
# - A sleep time of ~2 ms between successive caput commands is needed to get proper response; 1 ms is too short | ||
##### | ||
|
||
#global xshutter_state | ||
xshutter_state=0 ## TODO: read the shutter state and set this accordingly | ||
|
||
## Open shutter | ||
def xshutter_trigger(): | ||
sleep_time = 0.005 | ||
caput('XF:11BMB-CT{MC:06}Asyn.AOUT','M112=1') | ||
sleep(sleep_time) | ||
caput('XF:11BMB-CT{MC:06}Asyn.AOUT','M111=1') | ||
sleep(sleep_time) | ||
caput('XF:11BMB-CT{MC:06}Asyn.AOUT','M112=0') | ||
sleep(sleep_time) | ||
caput('XF:11BMB-CT{MC:06}Asyn.AOUT','M111=1') | ||
|
||
|
||
def xshutter(inout,q=0): | ||
global xshutter_state | ||
|
||
if inout=='o' or inout=='open' or inout==1: | ||
if xshutter_state==0: | ||
xshutter_trigger() | ||
xshutter_state = 1 | ||
if q==0: | ||
print('Experimental shutter opened') | ||
return(xshutter_state) | ||
elif xshutter_state==1: | ||
print('Experimental shutter is already open; no changes made') | ||
else: | ||
print('xshutter_state is neither 0 nor 1; no changes made') | ||
|
||
if inout=='c' or inout=='close' or inout==0: | ||
if xshutter_state==1: | ||
xshutter_trigger() | ||
xshutter_state = 0 | ||
if q==0: | ||
print('Experimental shutter closed') | ||
return(xshutter_state) | ||
elif xshutter_state==0: | ||
print('Experimental shutter is already closed; no changes made') | ||
else: | ||
print('xshutter_state is neither 0 nor 1; no changes made') | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
def xp_set(seconds): | ||
# sleep_time=0.002 | ||
caput('XF:11BMB-ES{Det:SAXS}:cam1:AcquireTime',seconds) | ||
# sleep(sleep_time) | ||
caput('XF:11BMB-ES{Det:SAXS}:cam1:AcquirePeriod',seconds+0.1) | ||
|
||
def xp(seconds): | ||
sleep_time=0.1 | ||
caput('XF:11BMB-ES{Det:SAXS}:cam1:Acquire',1) | ||
sleep(seconds+sleep_time) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,115 @@ | ||
import ophyd | ||
|
||
quad_electrometer1 = ophyd.EpicsSignalRO("XF:11BMA-BI{IM:1}EM180:Current1:MeanValue_RBV", name='quad_electrometer1') | ||
quad_electrometer2 = ophyd.EpicsSignalRO("XF:11BMA-BI{IM:1}EM180:Current2:MeanValue_RBV", name='quad_electrometer2') | ||
quad_electrometer3 = ophyd.EpicsSignalRO("XF:11BMA-BI{IM:1}EM180:Current3:MeanValue_RBV", name='quad_electrometer3') | ||
quad_electrometer4 = ophyd.EpicsSignalRO("XF:11BMA-BI{IM:1}EM180:Current4:MeanValue_RBV", name='quad_electrometer4') | ||
##### FOE ##### | ||
quad_electrometer1_1 = ophyd.EpicsSignalRO("XF:11BMA-BI{IM:1}EM180:Current1:MeanValue_RBV", name='quad_electrometer1_1') | ||
quad_electrometer1_2 = ophyd.EpicsSignalRO("XF:11BMA-BI{IM:1}EM180:Current2:MeanValue_RBV", name='quad_electrometer1_2') | ||
quad_electrometer1_3 = ophyd.EpicsSignalRO("XF:11BMA-BI{IM:1}EM180:Current3:MeanValue_RBV", name='quad_electrometer1_3') | ||
quad_electrometer1_4 = ophyd.EpicsSignalRO("XF:11BMA-BI{IM:1}EM180:Current4:MeanValue_RBV", name='quad_electrometer1_4') | ||
|
||
bim1 = ophyd.EpicsSignalRO("XF:11BMA-BI{IM:1}EM180:Current1:MeanValue_RBV", name='bim1') | ||
bim2 = ophyd.EpicsSignalRO("XF:11BMA-BI{IM:1}EM180:Current2:MeanValue_RBV", name='bim2') | ||
|
||
|
||
##### Endstation ##### | ||
## TODO: fix 'precision' and 'units' at EPICS level | ||
ion_chamber1 = ophyd.EpicsSignalRO("XF:11BMB-BI{IM:3}:IC1_MON", name='ion_chamber1') | ||
ion_chamber2 = ophyd.EpicsSignalRO("XF:11BMB-BI{IM:3}:IC2_MON", name='ion_chamber2') | ||
ion_chamber3 = ophyd.EpicsSignalRO("XF:11BMB-BI{IM:3}:IC3_MON", name='ion_chamber3') | ||
ion_chamber4 = ophyd.EpicsSignalRO("XF:11BMB-BI{IM:3}:IC4_MON", name='ion_chamber4') | ||
|
||
|
||
class ScaleSignal(ophyd.signal.DerivedSignal): | ||
def __init__(self, *args, factor, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
self._factor = factor | ||
def inverse(self, value): | ||
return self._factor * value | ||
def forward(self, value): | ||
return value / self._factor | ||
def describe(self): | ||
desc = super().describe() | ||
wd = desc[self.name] | ||
wd['derived_type'] = 'ScaleSignal' | ||
wd['factor'] = self._factor | ||
return desc | ||
|
||
scaled_ic1 = ScaleSignal(ion_chamber1, factor=1e9, name='scaled_ic1') | ||
scaled_ic2 = ScaleSignal(ion_chamber2, factor=1e9, name='scaled_ic2') | ||
scaled_ic3 = ScaleSignal(ion_chamber3, factor=1e9, name='scaled_ic3') | ||
scaled_ic4 = ScaleSignal(ion_chamber4, factor=1e9, name='scaled_ic4') | ||
|
||
|
||
quad_electrometer2_1 = ophyd.EpicsSignalRO("XF:11BMB-BI{IM:2}EM180:Current1:MeanValue_RBV", name='quad_electrometer2_1') | ||
quad_electrometer2_2 = ophyd.EpicsSignalRO("XF:11BMB-BI{IM:2}EM180:Current2:MeanValue_RBV", name='quad_electrometer2_2') | ||
quad_electrometer2_3 = ophyd.EpicsSignalRO("XF:11BMB-BI{IM:2}EM180:Current3:MeanValue_RBV", name='quad_electrometer2_3') | ||
quad_electrometer2_4 = ophyd.EpicsSignalRO("XF:11BMB-BI{IM:2}EM180:Current4:MeanValue_RBV", name='quad_electrometer2_4') | ||
|
||
|
||
# bim6 is the monitor after the sample (called dsmon on X9) | ||
# The monitor sits on an arm on the DET system, so it can be moved with DETx and DETy | ||
#bim6 = ophyd.EpicsSignalRO("XF:11BMB-BI{IM:2}EM180:Current1:MeanValue_RBV", name='bim6') | ||
class EpicsSignalROWait(ophyd.EpicsSignalRO): | ||
'''Customized version of EpicsSignal that has a 'wait_time' in the 'read()' | ||
function. This can be used for signals that need some time to settle before | ||
a value is read.''' | ||
|
||
def __init__(self, *args, wait_time=None, **kwargs): | ||
|
||
if wait_time is not None: | ||
self._wait_time = wait_time | ||
else: | ||
self._wait_time = 0 | ||
|
||
super().__init__(*args, **kwargs) | ||
|
||
def read(self, *args, **kwargs): | ||
|
||
#print('waiting {} s'.format(self._wait_time)) | ||
sleep(self._wait_time) | ||
return super().read(*args, **kwargs) | ||
|
||
|
||
bim6 = EpicsSignalROWait("XF:11BMB-BI{IM:2}EM180:Current1:MeanValue_RBV", wait_time=1, name='bim6') | ||
|
||
class EpicsSignalROIntegrate(ophyd.EpicsSignalRO): | ||
'''Customized version of EpicsSignal that has manually integrates (averages | ||
a few values). This can be used for signals that are otherwise too erratic.''' | ||
|
||
def __init__(self, *args, wait_time=None, integrate_num=1, integrate_delay=0.01, **kwargs): | ||
|
||
if wait_time is not None: | ||
self._wait_time = wait_time | ||
else: | ||
self._wait_time = 0 | ||
|
||
self._integrate_num = integrate_num | ||
self._integrate_delay = integrate_delay | ||
|
||
super().__init__(*args, **kwargs) | ||
|
||
|
||
def read(self, *args, **kwargs): | ||
|
||
#print('waiting {} s'.format(self._wait_time)) | ||
sleep(self._wait_time) | ||
|
||
value = 0.0 | ||
num = 0.0 | ||
for i in range(self._integrate_num): | ||
value_current = super().read(*args, **kwargs)[self.name]['value'] | ||
#print(value_current) | ||
value += value_current | ||
num += 1.0 | ||
sleep(self._integrate_delay) | ||
|
||
value /= num | ||
|
||
ret = super().read(*args, **kwargs) | ||
ret[self.name]['value'] = value | ||
|
||
return ret | ||
|
||
|
||
bim6_integrating = EpicsSignalROIntegrate("XF:11BMB-BI{IM:2}EM180:Current1:MeanValue_RBV", wait_time=0.5, integrate_num=8, integrate_delay=0.1, name='bim6') | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from functools import partial | ||
from pyOlog import SimpleOlogClient | ||
from bluesky.callbacks.olog import logbook_cb_factory | ||
|
||
# Set up the logbook. This configures bluesky's summaries of | ||
# data acquisition (scan type, ID, etc.). | ||
|
||
LOGBOOKS = ['Data Acquisition'] # list of logbook names to publish to | ||
simple_olog_client = SimpleOlogClient() | ||
generic_logbook_func = simple_olog_client.log | ||
configured_logbook_func = partial(generic_logbook_func, logbooks=LOGBOOKS) | ||
|
||
cb = logbook_cb_factory(configured_logbook_func) | ||
RE.subscribe('start', cb) |
Oops, something went wrong.