From 32fb225aa01f78a807dd1d0749b96bb45a9fa8ab Mon Sep 17 00:00:00 2001 From: gac-x04sa Date: Fri, 12 Jan 2018 14:44:40 +0100 Subject: [PATCH] Startup --- config/plugins.properties | 1 + plugins/Pilatus.java | 90 ++++++++++++++++++++++++++++ script/scans/6mom.py | 120 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 211 insertions(+) create mode 100644 config/plugins.properties create mode 100644 plugins/Pilatus.java create mode 100644 script/scans/6mom.py diff --git a/config/plugins.properties b/config/plugins.properties new file mode 100644 index 0000000..32e2b9c --- /dev/null +++ b/config/plugins.properties @@ -0,0 +1 @@ +Pilatus.java=enabled diff --git a/plugins/Pilatus.java b/plugins/Pilatus.java new file mode 100644 index 0000000..24bdc93 --- /dev/null +++ b/plugins/Pilatus.java @@ -0,0 +1,90 @@ +import java.io.IOException; +import ch.psi.pshell.epics.AreaDetector; + +public class Pilatus extends AreaDetector{ + + public Pilatus(final String name, final String prefix){ + super(name, prefix); + } + + public void setPhiIncr(double value) throws IOException, InterruptedException{ + writeCtrl("PhiIncr", value); + } + + public double getPhiIncr() throws IOException, InterruptedException{ + return (Double) readCtrl("PhiIncr", Double.class); + } + + public void setChi(double value) throws IOException, InterruptedException{ + writeCtrl("Chi", value); + } + + public double getChi() throws IOException, InterruptedException{ + return (Double) readCtrl("Chi", Double.class); + } + + public void setOmega(double value) throws IOException, InterruptedException{ + writeCtrl("Omega", value); + } + + public double getOmega() throws IOException, InterruptedException{ + return (Double) readCtrl("Omega", Double.class); + } + + public void setStartAngle(double value) throws IOException, InterruptedException{ + writeCtrl("StartAngle", value); + } + + public double getStartAngle() throws IOException, InterruptedException{ + return (Double) readCtrl("StartAngle", Double.class); + } + + public void setOmegaIncr(double value) throws IOException, InterruptedException{ + writeCtrl("OmegaIncr", value); + } + + public double getOmegaIncr() throws IOException, InterruptedException{ + return (Double) readCtrl("OmegaIncr", Double.class); + } + + public void setAngleIncr(double value) throws IOException, InterruptedException{ + writeCtrl("AngleIncr", value); + } + + public double getAngleIncr() throws IOException, InterruptedException{ + return (Double) readCtrl("AngleIncr", Double.class); + } + + public void setKappa(double value) throws IOException, InterruptedException{ + writeCtrl("Kappa", value); + } + + public double getKappa() throws IOException, InterruptedException{ + return (Double) readCtrl("Kappa", Double.class); + } + + public void setPhi(double value) throws IOException, InterruptedException{ + writeCtrl("Phi", value); + } + + public double getPhi() throws IOException, InterruptedException{ + return (Double) readCtrl("Phi", Double.class); + } + + public void setFileNumber(double value) throws IOException, InterruptedException{ + writeCtrl("FileNumber", value); + } + + public double getFileNumber() throws IOException, InterruptedException{ + return (Double) readCtrl("FileNumber", Double.class); + } + + public void setFileName(double value) throws IOException, InterruptedException{ + writeCtrl("FileName", value); + } + + public double getFileName() throws IOException, InterruptedException{ + return (Double) readCtrl("FileName", Double.class); + } + +} diff --git a/script/scans/6mom.py b/script/scans/6mom.py new file mode 100644 index 0000000..0ac8b7f --- /dev/null +++ b/script/scans/6mom.py @@ -0,0 +1,120 @@ +# CHECKLIST FIRST +# sleep 2400 +startphi=-60 +endphi=120 # for DACs the middle is 57 +#startom=-34.9 +#endom=40.1 +time_step=4 +step=0.5 # in degrees +#fname='testing' +fname='MRc_01' # remember the run number + + + + + + + + + + + + + + + + + + + + + +#stepb=-0.5 # needed for the way back +#fnameb='CuBrPyz_6p3_04' # needed for the way back + + +filters=`caget -prec 16 X04SA-ES2-FI:TRANSM | cut -c20-36` +filt=`echo $filters '*1000000000'|bc` +echo $filt ' is the new value' +caput X04SA-ES2-PIL:cam1:FilterTransm $filt + + + +## THE FOLLOWING LINES IMPLEMENT AND CALCULATE SEVERAL PARAMETERS +time=`echo $time_step '-0.003' | bc` # calculates Exposure time +phitot=`echo $endphi '-' $startphi | bc` # calculates total omega span +images=`echo $phitot '/' $step|bc` # calculates number of images +step10000=`echo $step '*10000'|bc` # shell does not like floating +echo $step10000 ' step10000' +velo10000=`echo $step10000 '/' $time_step|bc` # " +velo=`echo $velo10000 '*0.0001'|bc` # calculates real angular velocity +check=`expr $velo10000 / 50001` # creates a check for max velocity +if [ $check = 0 ] +then +caput X04SA-ES2-SCD:ROY.VELO $velo # speed of the omega axis in deg/s +tottim=`echo $time_step '*' $images|bc` # calculates total time needed +tottime=`echo $tottim '+5'|bc` # adds 5 for safety +echo 'total time is '$tottime +echo 'now collecting '$fname + +# THE FOLLOWING LINES SEND COMMANDS TO THE CAMSERVER +caput X04SA-ES2-PIL:cam1:NumImages $images # number of images +caput X04SA-ES2-PIL:cam1:AcquireTime $time # Exposure time +caput X04SA-ES2-PIL:cam1:AcquirePeriod $time_step # Acquire period + + +### FORWARD ### +# PLEASE NOTE THE FOLLOWING HAS NOT YET BEEN UPDATED FOR AUTOMATIC ANGLES +caputq X04SA-ES2-PIL:cam1:Phi $startphi +caputq X04SA-ES2-PIL:cam1:PhiIncr $step +caputq X04SA-ES2-PIL:cam1:Chi 90 +caputq X04SA-ES2-PIL:cam1:ChiIncr 0.0 +caputq X04SA-ES2-PIL:cam1:Omega 57.05 # initial angle +caputq X04SA-ES2-PIL:cam1:StartAngle $startphi # might be redundant +caputq X04SA-ES2-PIL:cam1:OmegaIncr 0.0 # increment angle +caputq X04SA-ES2-PIL:cam1:AngleIncr $step # might be redundant +caputq X04SA-ES2-PIL:cam1:Kappa -134.76 # kappa +caputq X04SA-ES2-PIL:cam1:Phi 57.045 # phi +# PREPARE AND ACQUIRE +caputq X04SA-ES2-PIL:cam1:FileNumber 1 # always start with image 1 +sleep 1 +caputq X04SA-ES2-PIL:cam1:FileName $fname # filename +sleep 1 +caputq X04SA-ES2-SCD:ROY.VAL $endphi & # move the axis to ... +caputq X04SA-ES2-PIL:cam1:Acquire 1 +sleep $tottime + +### BACKWARD ### +# PLEASE NOTE THE FOLLOWING HAS NOT YET BEEN UPDATED FOR AUTOMATIC ANGLES +#caputq X04SA-ES2-PIL:cam1:Phi $endphi +#caputq X04SA-ES2-PIL:cam1:PhiIncr $stepb +#caputq X04SA-ES2-PIL:cam1:Chi 90 +#caputq X04SA-ES2-PIL:cam1:ChiIncr 0.0 +#caputq X04SA-ES2-PIL:cam1:Omega 57.05 # initial angle +#caputq X04SA-ES2-PIL:cam1:StartAngle $endphi # might be redundant +#caputq X04SA-ES2-PIL:cam1:OmegaIncr 0.0 # increment angle +#caputq X04SA-ES2-PIL:cam1:AngleIncr $stepb # might be redundant +#caputq X04SA-ES2-PIL:cam1:Kappa -134.76 # kappa +#caputq X04SA-ES2-PIL:cam1:Phi 57.045 # phi +## PREPARE AND ACQUIRE +#caputq X04SA-ES2-PIL:cam1:FileNumber 1 # always start with image 1 +#sleep 1 +#caputq X04SA-ES2-PIL:cam1:FileName $fnameb # filename +#sleep 1 +#caputq X04SA-ES2-SCD:ROY.VAL $startphi & # move the axis to ... +#caputq X04SA-ES2-PIL:cam1:Acquire 1 +#sleep $tottime + + +caputq X04SA-ES2-SCD:ROY.VELO 5.0 +sleep 1 +caputq X04SA-ES2-SCD:ROY.VAL $startphi +sleep 16 + +# THIS IS IN CASE THE MAX VELOCITY IS EXCEEDED +else +echo '' +echo 'WARNING' +echo 'too fast velocity calculated for the motor, please change' +echo '' +fi \ No newline at end of file