diff --git a/script/HystScan.py b/script/HystScan.py index a4427e6..c6a0105 100644 --- a/script/HystScan.py +++ b/script/HystScan.py @@ -1,9 +1,10 @@ #Script imported from: Fe_hyst_plus.xml #Parameters -START_FIELD = -1.0 -END_FIELD = 1.0 +START_FIELD = 1.0 +END_FIELD = -1.0 ENERGIES = (707.90, 703.90) +RAMP_RATE = 2.0 #Pre-actions #cawait('ACOAU-ACCU:OP-MODE', 'Light Available', type = 's') @@ -13,18 +14,18 @@ sleep(1.0) #caput('X07MA-ID:ENERGY-OFFS', '-1.0') #cawait('X07MA-ID:DONE', 'DONE', type = 's') caputq('X07MA-PC:CSCALER.INPB', '1') -caputq('X07MA-PC-PS2:SET:DMD:RAMPRATE:TPM', '2.0') +caputq('X07MA-PC-PS2:SET:DMD:RAMPRATE:TPM', RAMP_RATE) #sleep(15.0) -set_preference(Preference.ENABLED_PLOTS, ['FieldRbk', 'tey_norm', 'trans_norm']) -set_preference(Preference.PLOT_TYPES, {'FieldRbk':1, 'tey_norm':1, 'trans_norm':1}) +set_preference(Preference.ENABLED_PLOTS, ['tey_norm', 'trans_norm']) +set_preference(Preference.PLOT_TYPES, {'tey_norm':1, 'trans_norm':1}) #TODO: #Option to have time scane for X #Separate 2 series in 1D plot #Plot differences of 2 plotsin tey_norm -scan = ManualScan(['index', 'Energy'], ['FieldRbk', 'TEY', 'I0', 'trans', 'polarization', 'polAngle', 'temperature', 'RingCurrent', 'fieldAnalogX', 'tey_norm', 'trans_norm']) +scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'trans', 'polarization', 'polAngle', 'temperature', 'RingCurrent', 'fieldAnalogX', 'tey_norm', 'trans_norm']) scan.start() #Stop condition @@ -58,7 +59,12 @@ fieldAnalogX = Channel('X07MA-ES1-AI:SIGNAL4', type = 'd') #Dimension 1 #RegionPositioner field #Region 1 pre-actions + print "Waiting for start field" +#WORKAROUND TO BUG IN DRIVER +if abs(fieldReadback.get() - START_FIELD) < 0.005: + caput('X07MA-PC-PS2:M:GO.A', START_FIELD + 0.01) + caput('X07MA-PC-PS2:M:GO.A', START_FIELD) print "Set end field" caputq('X07MA-PC-PS2:M:GO.A', END_FIELD) @@ -109,7 +115,7 @@ while(True): #TODO: Move, if needed, this import to the file header: import math trans_norm = detector3/detector2 - scan.append ([index, setpoint2], [index, readback2], [field_readback, detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, tey_norm, trans_norm]) + scan.append ([field_readback, setpoint2], [field_readback, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, tey_norm, trans_norm]) print "Field = " + str(fieldReadback.get())