Winter shutdown
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
#Tue Nov 29 09:43:05 CET 2016
|
||||
#Wed Jan 18 15:39:16 CET 2017
|
||||
autoSaveScanData=true
|
||||
createSessionFiles=false
|
||||
dataLayout=table
|
||||
dataLayout=ch.psi.fda.LayoutFDA
|
||||
dataPath={data}/{year}_{month}/{date}
|
||||
dataProvider=txt
|
||||
dataProvider=ch.psi.fda.ProviderFDA
|
||||
dataScanFlushRecords=true
|
||||
dataScanPreserveTypes=false
|
||||
dataScanReleaseRecords=false
|
||||
dataServerPort=-1
|
||||
devicePoolFile={config}/devices.properties
|
||||
deviceUpdateStrategyFile={config}/update.properties
|
||||
|
||||
@@ -20,6 +20,7 @@ ramp_rate_x_ips=ch.psi.pshell.epics.ControlledVariable|X07MA-ES1-IPS:FRAMP X07MA
|
||||
sample_hor=ch.psi.pshell.epics.Motor|X07MA-ES1-MAG:TRZ1|||
|
||||
sample_vert=ch.psi.pshell.epics.Motor|X07MA-ES1-MAG:TRY1|||
|
||||
sample_rot=ch.psi.pshell.epics.Motor|X07MA-ES1-MAG:ROY1|||
|
||||
au_mesh=ch.psi.pshell.epics.Motor|X07MA-OP-IO1:TR1|||
|
||||
needle=ch.psi.pshell.epics.ProcessVariable|X07MA-PC-TC:DMD:LOOP2:MANUAL|||
|
||||
temperature=ch.psi.pshell.epics.ChannelDouble|X07MA-PC-TC:DMD:LOOP1:SETPOINT|||
|
||||
temperature_readback=ch.psi.pshell.epics.ChannelDouble|X07MA-PC-TC:STS:T1|Read||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#Wed Jan 18 15:01:23 CET 2017
|
||||
defaultSpeed=1.0
|
||||
estbilizationDelay=0
|
||||
hasEnable=false
|
||||
homingType=None
|
||||
maxSpeed=NaN
|
||||
maxValue=250.0
|
||||
minSpeed=0.1
|
||||
minValue=-250.0
|
||||
offset=0.0
|
||||
precision=6
|
||||
resolution=3.0E-4
|
||||
scale=1.0
|
||||
unit=mm
|
||||
+12
-1
@@ -1,4 +1,4 @@
|
||||
#Mon Aug 24 09:08:53 CEST 2015
|
||||
#Thu Dec 22 16:38:19 CET 2016
|
||||
colormap=Temperature
|
||||
colormapAutomatic=true
|
||||
colormapMax=255.0
|
||||
@@ -13,5 +13,16 @@ pollingBackground=false
|
||||
pollingInterval=0
|
||||
rescaleFactor=1.0
|
||||
rescaleOffset=0.0
|
||||
roiHeight=-1
|
||||
roiWidth=-1
|
||||
roiX=0
|
||||
roiY=0
|
||||
rotation=0.0
|
||||
rotationCrop=false
|
||||
scale=1.0
|
||||
spatialCalOffsetX=NaN
|
||||
spatialCalOffsetY=NaN
|
||||
spatialCalScaleX=NaN
|
||||
spatialCalScaleY=NaN
|
||||
spatialCalUnits=mm
|
||||
transpose=false
|
||||
|
||||
+12
-1
@@ -1,4 +1,4 @@
|
||||
#Mon Aug 24 09:08:53 CEST 2015
|
||||
#Thu Dec 22 16:38:19 CET 2016
|
||||
colormap=Grayscale
|
||||
colormapAutomatic=true
|
||||
colormapMax=255.0
|
||||
@@ -13,5 +13,16 @@ pollingBackground=false
|
||||
pollingInterval=0
|
||||
rescaleFactor=1.0
|
||||
rescaleOffset=0.0
|
||||
roiHeight=-1
|
||||
roiWidth=-1
|
||||
roiX=0
|
||||
roiY=0
|
||||
rotation=0.0
|
||||
rotationCrop=false
|
||||
scale=1.0
|
||||
spatialCalOffsetX=NaN
|
||||
spatialCalOffsetY=NaN
|
||||
spatialCalScaleX=NaN
|
||||
spatialCalScaleY=NaN
|
||||
spatialCalUnits=mm
|
||||
transpose=false
|
||||
|
||||
@@ -19,6 +19,7 @@ import ch.psi.pshell.ui.Panel;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.io.File;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -58,7 +59,7 @@ public class EnergyScan extends Panel {
|
||||
}
|
||||
|
||||
Path getConfigFile() {
|
||||
return Paths.get(getController().getSetup().getConfigPath(), "energy_scan.properties");
|
||||
return Paths.get(getContext().getSetup().getConfigPath(), "energy_scan.properties");
|
||||
}
|
||||
|
||||
enum Mode {
|
||||
@@ -122,7 +123,7 @@ public class EnergyScan extends Panel {
|
||||
} else {
|
||||
mode = "lin_" + String.format("%1.0f", (Double) spinnerAlpha.getValue());
|
||||
}
|
||||
path = getController().getSetup().expandPath(path);
|
||||
path = getContext().getSetup().expandPath(path);
|
||||
path = path.replaceAll("\\{el\\}", String.valueOf(comboSetup.getSelectedItem()));
|
||||
path = path.replaceAll("\\{mode\\}", mode);
|
||||
return path;
|
||||
@@ -611,7 +612,10 @@ public class EnergyScan extends Panel {
|
||||
|
||||
private void buttonAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAbortActionPerformed
|
||||
batch = null;
|
||||
abort();
|
||||
try {
|
||||
abort();
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
}//GEN-LAST:event_buttonAbortActionPerformed
|
||||
|
||||
private void comboSetupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboSetupActionPerformed
|
||||
|
||||
@@ -66,7 +66,7 @@ public class HystScan extends Panel {
|
||||
}
|
||||
|
||||
Path getConfigFile() {
|
||||
return Paths.get(getController().getSetup().getConfigPath(), "energy_scan.properties");
|
||||
return Paths.get(getContext().getSetup().getConfigPath(), "energy_scan.properties");
|
||||
}
|
||||
|
||||
void loadConfig() {
|
||||
@@ -93,7 +93,7 @@ public class HystScan extends Panel {
|
||||
} else { //if (comboMode.getSelectedIndex() == 1) {
|
||||
mode = "minus";
|
||||
}
|
||||
path = getController().getSetup().expandPath(path);
|
||||
path = getContext().getSetup().expandPath(path);
|
||||
path = path.replaceAll("\\{el\\}", String.valueOf(comboSetup.getSelectedItem()));
|
||||
path = path.replaceAll("\\{mode\\}", mode);
|
||||
return path;
|
||||
@@ -593,7 +593,10 @@ public class HystScan extends Panel {
|
||||
}//GEN-LAST:event_buttonExecuteActionPerformed
|
||||
|
||||
private void buttonAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAbortActionPerformed
|
||||
abort();
|
||||
try {
|
||||
abort();
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
}//GEN-LAST:event_buttonAbortActionPerformed
|
||||
|
||||
private void buttonDefaultsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDefaultsActionPerformed
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
|
||||
*/
|
||||
|
||||
import ch.psi.pshell.core.Controller;
|
||||
import ch.psi.pshell.core.Context;
|
||||
import ch.psi.pshell.ui.Importer;
|
||||
import ch.psi.pshell.ui.Plugin;
|
||||
import ch.psi.utils.Str;
|
||||
@@ -52,7 +52,7 @@ public class importer implements Plugin {
|
||||
String getRanges(String fileName) throws Exception{
|
||||
File file = new File(fileName);
|
||||
if (!file.exists()){
|
||||
file = Paths.get(Controller.getInstance().getSetup().getScriptPath(), fileName).toFile();
|
||||
file = Paths.get(Context.getInstance().getSetup().getScriptPath(), fileName).toFile();
|
||||
if (!file.exists()){
|
||||
throw new Exception("Invalid ranges file: " + fileName);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
#set pol c- off 1.5
|
||||
#otf 760 840 3 delay 10
|
||||
#file Co3_plus
|
||||
#start
|
||||
set_pol_cminus(offset = 1.5)
|
||||
wait_beam()
|
||||
set_file('Co3_plus')
|
||||
otf(start=760, end=840, time=3, delay=10)
|
||||
|
||||
#set pol c- off 1.5
|
||||
#otf 760 840 6 delay 10
|
||||
#file Co6_plus
|
||||
#start
|
||||
set_pol_cminus(offset = 1.5)
|
||||
wait_beam()
|
||||
set_file('Co6_plus')
|
||||
otf(start=760, end=840, time=6, delay=10)
|
||||
|
||||
#set pol c- off 1.5
|
||||
#otf 760 840 10 delay 10
|
||||
#file Co10_plus
|
||||
#start
|
||||
set_pol_cminus(offset = 1.5)
|
||||
wait_beam()
|
||||
set_file('Co10_plus')
|
||||
otf(start=760, end=840, time=10, delay=10)
|
||||
|
||||
+43
-41
@@ -91,44 +91,46 @@ time.sleep(DELAY)
|
||||
|
||||
caput('START', '1')
|
||||
|
||||
log("Exit slit: "+ str(exit_slit.read()) + "; cff: " + str(cff.read()) + "; harm.: " + str(harmonic.read()) + "; FE: " + str(aperture.read() ) )
|
||||
log("Sample temperature: " + str(temperature_readback.read() ) )
|
||||
log("Sample coord. HOR; VERT; ROT: " + str(sample_hor.read()) + "; " + str(sample_vert.read()) + "; " + str(sample_rot.read()) )
|
||||
|
||||
waiting = True
|
||||
def plot_task():
|
||||
global waiting
|
||||
pos=count.take()
|
||||
start_plot()
|
||||
while waiting:
|
||||
if count.take() != pos:
|
||||
update_plot()
|
||||
pos = count.take()
|
||||
time.sleep(2.0)
|
||||
|
||||
ret = fork(plot_task)
|
||||
try:
|
||||
#Post-actions
|
||||
wait_channel('START', 'STOP', type = 's')
|
||||
time.sleep(2.0)
|
||||
print "Finished Energy scan"
|
||||
finally:
|
||||
waiting = False
|
||||
join(ret)
|
||||
|
||||
#File convertion
|
||||
newName = folder + time.strftime("%Y%m%d_%H%M_", start) + FILE + "_0000.txt";
|
||||
name = getNewestFile()
|
||||
|
||||
if name == newest:#TODO: WHY WRITING AGAIN???
|
||||
|
||||
raise Exception("Data file not created")
|
||||
|
||||
if not os.path.isfile(name):
|
||||
raise Exception("Data file not found: " + name)
|
||||
|
||||
convert_file(name, newName)
|
||||
#plot_file(newName)
|
||||
print("Success")
|
||||
|
||||
|
||||
try:
|
||||
write_logs()
|
||||
|
||||
waiting = True
|
||||
def plot_task():
|
||||
global waiting
|
||||
pos=count.take()
|
||||
start_plot()
|
||||
while waiting:
|
||||
if count.take() != pos:
|
||||
update_plot()
|
||||
pos = count.take()
|
||||
time.sleep(2.0)
|
||||
|
||||
ret = fork(plot_task)
|
||||
try:
|
||||
#Post-actions
|
||||
wait_channel('START', 'STOP', type = 's')
|
||||
time.sleep(2.0)
|
||||
print "Finished Energy scan"
|
||||
finally:
|
||||
waiting = False
|
||||
join(ret)
|
||||
|
||||
#File convertion
|
||||
newName = folder + time.strftime("%Y%m%d_%H%M_", start) + FILE + "_0000.txt";
|
||||
name = getNewestFile()
|
||||
|
||||
if name == newest:#TODO: WHY WRITING AGAIN???
|
||||
|
||||
raise Exception("Data file not created")
|
||||
|
||||
if not os.path.isfile(name):
|
||||
raise Exception("Data file not found: " + name)
|
||||
|
||||
convert_file(name, newName)
|
||||
#plot_file(newName)
|
||||
print("Success")
|
||||
|
||||
except:
|
||||
while caget('START') == 'START':
|
||||
print("Aborting...")
|
||||
caput('START', '0')
|
||||
|
||||
+3
-6
@@ -11,7 +11,7 @@ OFFSET = -1.0
|
||||
"""
|
||||
|
||||
|
||||
iPS = True
|
||||
iPS = False
|
||||
|
||||
FIELD_PRECISION = 0.01
|
||||
field = field_z if FIELD == "Hz" else (field_x_ips if iPS else field_x )
|
||||
@@ -33,7 +33,7 @@ if RAMP_RATE is not None:
|
||||
|
||||
|
||||
if len(ENERGIES) ==2:
|
||||
# dif_series = plot([],"Dif", context="Dif")[0].getSeries(0)
|
||||
# dif_series = plot([],"Dif", get_context()="Dif")[0].getSeries(0)
|
||||
dif_series = plot([],"Dif")[0].getSeries(0)
|
||||
else:
|
||||
dif_series = None
|
||||
@@ -44,10 +44,7 @@ set_preference(Preference.PLOT_TYPES, {'tey_norm':1, 'trans_norm':1})
|
||||
scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'trans', 'polarization', 'polAngle', 'temperature', 'RingCurrent', 'fieldAnalogX', 'tey_norm','trans_norm'], [0.0, ENERGIES[0]], [0.0, ENERGIES[-1]], [0, len(ENERGIES)-1])
|
||||
scan.start()
|
||||
|
||||
log("Exit slit: "+ str(exit_slit.read()) + "; cff: " + str(cff.read()) )
|
||||
log( "Harm.: " + str(harmonic.read()) + "; FE: " + str(aperture.read() ) )
|
||||
log("Sample temperature: " + str(temperature_readback.read() ) )
|
||||
log("Sample coord. HOR; VERT; ROT: " + str(sample_hor.read()) + "; " + str(sample_vert.read()) + "; " + str(sample_rot.read()) )
|
||||
write_logs()
|
||||
|
||||
print "Waiting for start field"
|
||||
|
||||
|
||||
+62
-17
@@ -1,28 +1,40 @@
|
||||
###################################################################################################
|
||||
# Deployment specific global definitions - executed after startup.py
|
||||
###################################################################################################
|
||||
|
||||
import ch.psi.fda.ProcessorFDA as ProcessorFDA
|
||||
|
||||
def run_fda(file_name, arguments={}):
|
||||
"""
|
||||
Run FDA loop
|
||||
"""
|
||||
ProcessorFDA().execute(file_name,arguments)
|
||||
|
||||
import traceback
|
||||
|
||||
energy.setBlockingWrite(True)
|
||||
|
||||
|
||||
#The persistence strategy is overriden to adjust file names
|
||||
|
||||
#now using ch.psi.fda.LayoutFDA
|
||||
"""
|
||||
#The persistence strategy is overriden to adjust file names
|
||||
import ch.psi.pshell.data.LayoutTable
|
||||
class DataLayout( ch.psi.pshell.data.LayoutTable):
|
||||
def getLogFileName(self):
|
||||
return time.strftime('%Y%m%d_%H%M') + '_' + get_context().name + '_logs'
|
||||
return time.strftime('%Y%m%d_%H%M') + '_' + get_exec_pars().name + '_logs'
|
||||
|
||||
def getDatasetName(self, scan):
|
||||
print get_context().count
|
||||
data_file = time.strftime('%Y%m%d_%H%M') + '_' + get_context().name + '_' + str(get_context().count).zfill(4)
|
||||
print "Opened data file: " + get_context().path + "/" + data_file
|
||||
print get_exec_pars().count
|
||||
data_file = time.strftime('%Y%m%d_%H%M') + '_' + get_exec_pars().name + '_' + str(get_exec_pars().count).zfill(4)
|
||||
print "Opened data file: " + get_exec_pars().path + "/" + data_file
|
||||
return data_file
|
||||
controller.dataManager.setLayout(DataLayout())
|
||||
|
||||
get_context().dataManager.setLayout(DataLayout())
|
||||
"""
|
||||
|
||||
#Reading Energy Scan configuration file
|
||||
def getPars(element):
|
||||
f = open(controller.setup.getConfigPath() + '/energy_scan.properties')
|
||||
f = open(get_context().setup.getConfigPath() + '/energy_scan.properties')
|
||||
try:
|
||||
for line in f:
|
||||
tokens = line.split("=")
|
||||
@@ -154,7 +166,7 @@ def plot_file(file_name, title = None):
|
||||
# global FILENAME
|
||||
# if former == State.Busy:
|
||||
# FILENAME = None
|
||||
#controller.addListener(Listener()) #Old listeners are cleande in startup
|
||||
#get_context().addListener(Listener()) #Old listeners are cleande in startup
|
||||
|
||||
|
||||
###################################################################################################
|
||||
@@ -351,7 +363,7 @@ def wait_inj (value, delay=0.5):
|
||||
def set_file(file_name):
|
||||
"""
|
||||
"""
|
||||
set_context(name = file_name)
|
||||
set_exec_pars(name = file_name)
|
||||
|
||||
class pol_mod(Readable):
|
||||
def read(self):
|
||||
@@ -367,8 +379,8 @@ def otf(start, end, time, delay=0.0, mode = None, offset = None, alpha = None, n
|
||||
"""
|
||||
"""
|
||||
if name is None:
|
||||
name = get_context().name
|
||||
folder = controller.setup.expandPath("{year}_{month}/{date}");
|
||||
name = get_exec_pars().name
|
||||
folder = get_context().setup.expandPath("{year}_{month}/{date}");
|
||||
run("EnergyScan", {"E1":start, "E2":end, "TIME":time, "DELAY":float(delay), "MODE":mode, "OFFSET":(offset), "FOLDER":folder, "FILE":name, "ALPHA":alpha})
|
||||
|
||||
def hyst_cont(field, init_field, final_field, ramp_speed, energies):
|
||||
@@ -394,8 +406,10 @@ def hyst_step_mult(forward, ranges, ramp_speed, energies, energy_change_sleep =
|
||||
def scan_e(start, end, step, settling_time = 0, accumulation_time = None, name = None):
|
||||
"""
|
||||
"""
|
||||
if name is not None:
|
||||
set_context(name = name)
|
||||
#if name is not None:
|
||||
#set_exec_pars(name = name)
|
||||
if name is None:
|
||||
name = get_exec_pars().name
|
||||
#wait_beam()
|
||||
acc = Accumulator([signal_tey, signal_i0, signal_trans, tey_norm, trans_norm], accumulation_time)
|
||||
detectors = acc.getSensors() + [polmod, pol_angle, temperature, current]
|
||||
@@ -406,8 +420,8 @@ def scan_e_mult(ranges, settling_time = 0, accumulation_time = None, name = None
|
||||
"""
|
||||
"""
|
||||
if name is not None:
|
||||
set_context(name = name)
|
||||
# name = get_context().name
|
||||
set_exec_pars(name = name)
|
||||
# name = get_exec_pars().name
|
||||
acc = Accumulator([signal_tey, signal_i0, signal_trans, tey_norm, trans_norm], accumulation_time)
|
||||
detectors = acc.getSensors() + [polmod, pol_angle, temperature, current]
|
||||
set_preference(Preference.ENABLED_PLOTS, acc.getSensors())
|
||||
@@ -422,5 +436,36 @@ def scan_v(keithley,start, end, step):
|
||||
lscan(setpoint, readback, float(start), float(end), float(step), latency = 0.1)
|
||||
|
||||
|
||||
def set_hor(value):
|
||||
"""
|
||||
"""
|
||||
sample_hor.move(value)
|
||||
|
||||
def set_vert(value):
|
||||
"""
|
||||
"""
|
||||
sample_vert.move(value)
|
||||
|
||||
def set_rot(value):
|
||||
"""
|
||||
"""
|
||||
sample_rot.move(value)
|
||||
|
||||
|
||||
def set_au_mesh(value):
|
||||
"""
|
||||
"""
|
||||
au_mesh.move(value)
|
||||
|
||||
def write_logs():
|
||||
set_exec_pars(open = True) #Compensade bug on log function, which should open persistence context
|
||||
log("Exit slit: "+ str(exit_slit.read()))
|
||||
log("Cff: " + str(cff.read()))
|
||||
log("Harm: " + str(harmonic.read()))
|
||||
log("FE: " + str(aperture.read() ))
|
||||
log("Sample temperature: " + str(temperature_readback.read() ) )
|
||||
log("Sample coord. HOR; VERT; ROT: " + str(sample_hor.read()) + "; " + str(sample_vert.read()) + "; " + str(sample_rot.read()) )
|
||||
log("Gain sample: " + str(caget(keithleys["k1"][2])))
|
||||
log("Gain i0: " + str(caget(keithleys["k2"][2])))
|
||||
log("Gain diode: " + str(caget(keithleys["k3"][2])))
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ if RAMP_RATE is not None:
|
||||
|
||||
|
||||
if len(ENERGIES) ==2:
|
||||
# dif_series = plot([],"Dif", context="Dif")[0].getSeries(0)
|
||||
# dif_series = plot([],"Dif", title="Dif")[0].getSeries(0)
|
||||
dif_series = plot([],"Dif")[0].getSeries(0)
|
||||
else:
|
||||
dif_series = None
|
||||
|
||||
@@ -32,7 +32,7 @@ if RAMP_RATE is not None:
|
||||
|
||||
|
||||
if len(ENERGIES) ==2:
|
||||
# dif_series = plot([],"Dif", context="Dif")[0].getSeries(0)
|
||||
# dif_series = plot([],"Dif", title="Dif")[0].getSeries(0)
|
||||
dif_series = plot([],"Dif")[0].getSeries(0)
|
||||
else:
|
||||
dif_series = None
|
||||
|
||||
@@ -23,7 +23,7 @@ caputq('X07MA-PC-PS2:SET:DMD:RAMPRATE:TPM', RAMP_RATE)
|
||||
#sleep(15.0)
|
||||
|
||||
if len(ENERGIES) ==2:
|
||||
dif_series = plot([],"Dif", context="Dif")[0].getSeries(0)
|
||||
dif_series = plot([],"Dif", title="Dif")[0].getSeries(0)
|
||||
else:
|
||||
dif_series = None
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
#Execute a FDA script
|
||||
ProcessorFDA().execute("templates/scan_vertical.xml",{})
|
||||
|
||||
|
||||
#Alterando parametros
|
||||
#ProcessorFDA().execute("templates/scan_vertical.xml",{"vertical.Start":6.0, "vertical.End":8.0})
|
||||
Reference in New Issue
Block a user