diff --git a/script/RFscan/ShottkyScan.py b/script/RFscan/ShottkyScan.py new file mode 100644 index 0000000..b3079d5 --- /dev/null +++ b/script/RFscan/ShottkyScan.py @@ -0,0 +1,42 @@ +import ch.psi.pshell.epics.ControlledVariable as ControlledVariable + +if get_exec_pars().source == CommandSource.ui: + start = caget("SINEG01-RSYS:SET-SCAN-START") + stop = caget("SINEG01-RSYS:SET-SCAN-STOP") + step = caget("SINEG01-RSYS:SET-SCAN-STEP") + nb = caget("SINEG01-RSYS:SET-NUM-AVERAGE") + lat = caget("SINEG01-RSYS:SET-SCAN-WAIT-TIME") +else: + start = args[0] + stop = args[1] + step = args[2] + nb = int(args[3]) + lat = args[4] + + +phase = ControlledVariable("Phase", "SINEG01-RSYS:SET-VSUM-PHASE-SIM", "SINEG01-RSYS:GET-VSUM-PHASE-SIM") +phase.config.minValue =-45.0 +phase.config.maxValue = 360.0 +phase.config.resolution = 0.5 +phase.initialize() + +#st = Stream("ICTstream", dispatcher) +#q = st.addScalar("Charge", "SINEG01-DICT215:B1_CHARGE-SIM", 1, 0) +#st.initialize() +#st.start(True) +q = Channel("SINEG01-DICT215:B1_CHARGE-SIM", type = 'd', alias='ICT-Q') + +try: + qb = create_averager(q, nb, 0.100) + r = lscan(phase, (qb), start, stop, step, latency=lat) + rf_phase = r.getPositions(0) + charge = [val.mean for val in r.getReadable(0)] +finally: + phase.close() + q.close() + #st.close() + +# Here the user needs to pick a phase as reference phase (onset of charge emission) +phase_ref = 80.0 +phase_offset = - phase_ref +caput("SINEG01-RSYS:CALC-VSUM-PHASE-OFFSET", phase_offset)