From 6ce32c85ce084582c1a24c8a66a052d29d405121 Mon Sep 17 00:00:00 2001 From: sfop Date: Tue, 9 May 2017 14:52:21 +0200 Subject: [PATCH] Startup --- devices/CurrentCamera.properties | 12 +++--- devices/gain.properties | 8 ++++ script/Diagnostics/BlmGainScan.py | 70 +++++-------------------------- script/test/TestTimestamp.py | 50 ++++++++++++++++++++++ 4 files changed, 75 insertions(+), 65 deletions(-) create mode 100644 devices/gain.properties create mode 100644 script/test/TestTimestamp.py diff --git a/devices/CurrentCamera.properties b/devices/CurrentCamera.properties index 891da63..19b71ec 100644 --- a/devices/CurrentCamera.properties +++ b/devices/CurrentCamera.properties @@ -1,7 +1,7 @@ -#Tue May 09 10:15:56 CEST 2017 +#Tue May 09 14:37:55 CEST 2017 colormap=Flame colormapAutomatic=false -colormapMax=15000.0 +colormapMax=1000.0 colormapMin=0.0 flipHorizontally=false flipVertically=false @@ -21,9 +21,9 @@ rotation=0.0 rotationCrop=false scale=1.0 serverURL=localhost\:10000 -spatialCalOffsetX=-649.4689449397814 -spatialCalOffsetY=-522.5163272053469 -spatialCalScaleX=-8.737659608697616 -spatialCalScaleY=-8.83489815158259 +spatialCalOffsetX=-561.5040694398416 +spatialCalOffsetY=-561.5353189903899 +spatialCalScaleX=-8.510638213864555 +spatialCalScaleY=-8.23581701380606 spatialCalUnits=mm transpose=false diff --git a/devices/gain.properties b/devices/gain.properties new file mode 100644 index 0000000..2233327 --- /dev/null +++ b/devices/gain.properties @@ -0,0 +1,8 @@ +#Tue May 09 14:22:06 CEST 2017 +maxValue=NaN +minValue=NaN +offset=0.0 +precision=-1 +resolution=NaN +scale=1.0 +unit=null diff --git a/script/Diagnostics/BlmGainScan.py b/script/Diagnostics/BlmGainScan.py index 0f5d2a9..291f0b5 100644 --- a/script/Diagnostics/BlmGainScan.py +++ b/script/Diagnostics/BlmGainScan.py @@ -4,26 +4,16 @@ import ch.psi.pshell.epics.DiscretePositioner as DiscretePositioner #Arguments -SAMPLES = 10 -GAINS = ["SINDI02-DBLM084:M06-1-CH03-V-MM","SINDI02-DBLM084:M06-1-CH03-V-MM2",] -BLMS = ["SINDI02-DBLM025", "SINDI02-DBLM085", "S10DI01-DBLM045"] -ATTENUATORS = ["SINDI02-DBLM084:M06-1-ATT2-VAL", "SINDI02-DBLM084:M06-2-ATT2-VAL", "S10DI01-DBLM113:M06-1-ATT2-VAL"] +SAMPLES = 5 +BLMS = ["SINDI02-DBLM025"] RANGE = [0.5, 1.1] -STEP_SIZE = 0.01 -SETTLING_TIME = 0.5 +STEP_SIZE = 0.10 +SETTLING_TIME = 0.1 SIMULATION = True do_elog = True -gain_positioners = [] -for i in range(len(GAINS)): - gain_positioners.append( DummyPositioner("gain " + str(i+1)) if SIMULATION else Channel(GAINS[i], alias = "gain " + str(i+1))) - -attenuators = [] -for i in range(len(ATTENUATORS)): - att = DiscretePositioner("Att"+str(i+1), ATTENUATORS[i]) - att.initialize() - attenuators.append(att) +pos = DummyPositioner("gain") #Channel-based @@ -47,51 +37,13 @@ st.initialize() st.start() st.waitCacheChange(10000) #Wait stream be running before starting scan -""" -#Averaging -ablm1 = create_averager(blm1, SAMPLES, interval = -1) -ablm2 = create_averager(blm2, SAMPLES, interval = -1) -ablm2.setMonitored(True) -""" - -#Plot setup -setup_plotting( line_plots = line_plots) - - #Metadata -set_attribute("/", "Samples" , SAMPLES) -set_attribute("/", "BLM" , BLMS) -set_attribute("/", "Gain" , GAINS) -set_attribute("/", "Range" , RANGE) -set_attribute("/", "Attenuators" , ATTENUATORS) -set_attribute("/", "StepSize" , STEP_SIZE) -set_attribute("/", "SamplingTime" , SETTLING_TIME) - -for att in attenuators: - set_attribute("/", att.setpoint.channelName, att.read()) - +set_exec_pars(persist = False) try: - r=lscan(gain_positioners, sensors, [RANGE[0],] * len(gain_positioners), [RANGE[1],] * len(gain_positioners), [STEP_SIZE,] * len(gain_positioners), latency = SETTLING_TIME) + r=lscan(pos, sensors, RANGE[0], RANGE[1],STEP_SIZE, latency = SETTLING_TIME) + r=bscan(st, 10) + mscan(st, sensors, 10, -1) + finally: - st.close() - - -# save the entry in the logbook -if do_elog: - if get_option("Generated data file:\n" + get_exec_pars().path + "\n\n" + "Save to ELOG?", "YesNo") == "Yes": - gsa_log_msg = "Data file: " + get_exec_pars().path - gsa_log_msg = gsa_log_msg + "\nSamples = " + str(SAMPLES) - gsa_log_msg = gsa_log_msg + "\nBLM = " + str(BLMS) - gsa_log_msg = gsa_log_msg + "\nGain = " + str(GAINS) - gsa_log_msg = gsa_log_msg + "\nRange = " + str(RANGE) - gsa_log_msg = gsa_log_msg + "\nAttenuators = " + str(ATTENUATORS) - gsa_log_msg = gsa_log_msg + "\nStepSize = " + str(STEP_SIZE) - gsa_log_msg = gsa_log_msg + "\nSamplingTime = " + str(SETTLING_TIME) - - plots = get_plot_snapshots() - save=[] - for i in range(len(BLMS)): - save.append(plots[3*i]) - elog("Wire Scan", gsa_log_msg, save) - + st.close() diff --git a/script/test/TestTimestamp.py b/script/test/TestTimestamp.py new file mode 100644 index 0000000..11a6287 --- /dev/null +++ b/script/test/TestTimestamp.py @@ -0,0 +1,50 @@ +import ch.psi.pshell.epics.ChannelDouble as ChannelDouble +import ch.psi.pshell.bs.Scalar as Scalar +import ch.psi.pshell.epics.DiscretePositioner as DiscretePositioner + + +#Arguments +SAMPLES = 5 +BLMS = ["SINDI02-DBLM025"] +RANGE = [0.5, 1.1] +STEP_SIZE = 0.10 +SETTLING_TIME = 0.1 +SIMULATION = True +do_elog = True + + +pos = DummyPositioner("gain") + + +#Channel-based +blm1 = ChannelDouble("blm1", "SINDI02-DBLM025:B1_LOSS"); blm1.setMonitored(True); blm1.initialize() +blm2 = ChannelDouble("blm2", "SINDI02-DBLM085:B1_LOSS", -1, True); blm2.setMonitored(True); blm2.initialize() + +#Stream creation + +sensors = [] +line_plots = [] +st = Stream("pulse_id", dispatcher) +for i in range(len(BLMS)): + blm = Scalar("blm" + str(i+1), st, BLMS[i] + ":B1_LOSS", 10, 0) + av = create_averager(blm, SAMPLES, interval = -1) + av.setMonitored(i>0) + sensors.append(av) + sensors.append(av.stdev) + sensors.append(av.samples) + line_plots.append(av.samples) +st.initialize() +st.start() +st.waitCacheChange(10000) #Wait stream be running before starting scan + +#Metadata +#set_exec_pars(persist = False) +try: + r=lscan(pos, sensors, RANGE[0], RANGE[1],STEP_SIZE, latency = SETTLING_TIME) #PC timestamp + r=bscan(st, 10) #BS Timestamp + mscan(st, sensors, 10, -1) #BS Timestamp + mscan(blm1, blm1, 10, -1) #PC timestamp + mscan(blm2, blm2, 10, -1) #IOC timestamp (blm2 constructed with timestampChannel Flag) +finally: + st.close() +