diff --git a/script/HystScanMult.py b/script/HystScanMult.py index 843e215..b88539d 100644 --- a/script/HystScanMult.py +++ b/script/HystScanMult.py @@ -93,4 +93,4 @@ for (START_FIELD, END_FIELD, RAMP_RATE) in RANGES: break index = index+1 - scan.end() +scan.end() diff --git a/script/HystScanStep.py b/script/HystScanStep.py new file mode 100644 index 0000000..d5cef54 --- /dev/null +++ b/script/HystScanStep.py @@ -0,0 +1,80 @@ +#Parameters +""" +FIELD = "Hx" +RANGES = [(-0.1, 0.1, 0,2),] +ENERGIES = (707.90, 703.90) +ENERGY_CHANGE_SLEEP = 0.5 +FIELD_CHANGE_SLEEP = 22.0 +MODE = 'CIRC +' +OFFSET = -1.0 +""" + + +FIELD_PRECISION = 0.01 +field = field_z if FIELD == "Hz" else field_x +field_setpoint = Channel (field.channelName, 'd') #Not using energy device to have a blocking write + +#Pre-actions +wait_beam() +if MODE is not None: + pol_mode.write(MODE) +if OFFSET is not None: + pol_offset.write(OFFSET) #caput('X07MA-ID:ENERGY-OFFS', OFFSET) + +pol_done.waitValue("DONE") + +scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'trans', 'polarization', 'polAngle', 'temperature', 'RingCurrent', 'fieldAnalogX', 'tey_norm'] , [0.0, 630.0], [0.1, 638.46], [44, 1]) +scan.start() + + +Energy = Channel('X07MA-PHS-E:GO.A', type = 'd') +EnergyReadback = Channel('X07MA-PGM:CERBK', type = 'd') + + +#Dimension 1 +#RegionPositioner field +setpoints = [] +for r in RANGES: + setpoints = setpoints + frange(r[0], r[1], r[2], True) +for setpoint1 in setpoints: + #PRObably not needed for newer HW + """ + if setpoint1 == 0.002: + caputq('X07MA-PC-PS2:SET:RAMP:TARGET', 'Zero') + sleep(6.0) + caputq('X07MA-PC-PS2:SET:RAMP:DIR', 'Forward') + sleep(6.0) + caputq('X07MA-PC-PS2:SET:RAMP:TARGET', 'Lower') + sleep(6.0) + caputq('X07MA-PC-PS2:SET:DMD:POINT:LOWER', '0.002') + sleep(15.0) + """ + field_setpoint.write(setpoint1) + readback1 = field.getPosition() + if abs(readback1 - setpoint1) > FIELD_PRECISION : # TODO: Check accuracy + raise Exception('Actor field could not be set to the value ' + str(setpoint1)) + sleep( FIELD_CHANGE_SLEEP ) # TODO: Settling time + #Dimension 2 + #ArrayPositioner Energy + for setpoint2 in ENERGIES: + Energy.put(setpoint2, timeout=None) # TODO: Set appropriate timeout + readback2 = EnergyReadback.get() + if abs(readback2 - setpoint2) > 0.1 : # TODO: Check accuracy + raise Exception('Actor Energy could not be set to the value ' + str(setpoint2)) + sleep( ENERGY_CHANGE_SLEEP ) # Settling time + + detector1 = signal_tey.read() #TEY.get() + detector2 = signal_i0.read() #I0.get() + detector3 = signal_trans.read() #trans.get() + detector4 = float(pol_mode.getPositions().index(pol_mode.readback.read())) #polarization.get() + detector5 = pol_angle.read() #polAngle.get() + detector6 = temperature.read() #temperature.get() + detector7 = current.read() + detector8 = signal_field_analog_x.read() # fieldAnalogX.get() + c = detector1 + d = detector2 + tey_norm = detector1/detector2 + + scan.append ([setpoint1, setpoint2], [readback1, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, tey_norm]) + +scan.end()