Generate XDS.INP: Difference between revisions

Jump to navigation Jump to search
rev 0.65 add Bruker Photonics II
(rev 0.65)
(rev 0.65 add Bruker Photonics II)
Line 1: Line 1:
This script generates XDS.INP based on a list of frame names supplied on the commandline. It currently works for MarCCD, ADSC, Pilatus and a few Rigaku detectors; since this is just a bash script, extension to other detectors is very easy.
This script generates XDS.INP based on a list of frame names supplied on the commandline. It currently works for MarCCD, ADSC, Pilatus, Eiger some Rigaku and one Bruker detector(s); since this is just a bash script, extension to other detectors is very easy.
 
The [[Eiger]] detector is not yet implemented in the script, but this will eventually come.


== Usage ==
== Usage ==
Line 83: Line 81:
# revision 0.64 . KD 16/06/2016 reverse phi @APS 19ID (reported by Wolfram Tempel)
# revision 0.64 . KD 16/06/2016 reverse phi @APS 19ID (reported by Wolfram Tempel)
# revision 0.65 . Keitaro 07/09/2016 Fix for "too many arguments" problem in ls
# revision 0.65 . Keitaro 07/09/2016 Fix for "too many arguments" problem in ls
REVISION="0.65 (07-Sep-2016)"
# revision 0.65 . KD 15/09/2016 Add Bruker Photonics II with .cbf frames
REVISION="0.66 (15-Sep-2016)"
#                                                                                                             
#                                                                                                             
# usage: e.g. generate_XDS.INP "/file/system/frms/mydata_1_???.img"                                                       
# usage: e.g. generate_XDS.INP "/file/system/frms/mydata_1_???.img"                                                       
Line 122: Line 121:
SENSOR_THICKNESS=0   
SENSOR_THICKNESS=0   
TRUSTED_REGION="0.0 1.2 ! partially use corners of detector (0 1.4143: use all pixels)"                                                                                           
TRUSTED_REGION="0.0 1.2 ! partially use corners of detector (0 1.4143: use all pixels)"                                                                                           
# default MINIMUM_NUMBER_OF_PIXELS_IN_A_SPOT
MNOPIAS=3
# default DIRECTION_OF_DETECTOR_X-AXIS
DIRECTION_OF_DETECTOR_X_AXIS="1 0 0"
# default FRACTION_OF_POLARIZATION
pol_frac=0.98


dname=`echo "$1" | xargs dirname`
dname=`echo "$1" | xargs dirname`
Line 191: Line 196:
  grep -q "^SOURCE_WAVELENGTH= *1" tmp2 && DET=dtrek
  grep -q "^SOURCE_WAVELENGTH= *1" tmp2 && DET=dtrek
  grep -q BEAM_CENTER_X tmp2      && DET=adsc                                 
  grep -q BEAM_CENTER_X tmp2      && DET=adsc                                 
  grep -q mar345 tmp2 && DET=MAR345                        
  grep -q mar345 tmp2 && DET=MAR345    
grep -q BRUKER tmp2 && grep -q CBF tmp2  && DET=Bruker-cbf                   
else
else
  h5dump -d "/entry/instrument/detector/description" $FIRSTFRAME | grep -i Eiger > /dev/null && DET=eiger
  h5dump -d "/entry/instrument/detector/description" $FIRSTFRAME | grep -i Eiger > /dev/null && DET=eiger
Line 535: Line 541:
  OSCILLATION_RANGE=`grep 'PHI' tmp2 | awk '{print $5-$3}'`     
  OSCILLATION_RANGE=`grep 'PHI' tmp2 | awk '{print $5-$3}'`     
  TRUSTED_REGION="0 0.99"         
  TRUSTED_REGION="0 0.99"         
elif [ "$DET" == "Bruker-cbf" ]; then
 
echo  "Data from a Bruker-cbf detector"
# conversion radian / degrees:
DEGTOR=57.2957795
# MINIMUM_NUMBER_OF_PIXELS_IN_A_SPOT:
MNOPIAS=6
# use complete detector including corners:
TRUSTED_REGION="0 1.42"       
# polarization
pol_frac=`awk '/polarizn_source_ratio/{print $2}' tmp2`
pol_frac=`echo "${pol_frac}+0.5" | bc -l`
OVERLOAD=`awk '/_array_intensities.overload/{print $2}' tmp2`
DETECTOR="BRUKER MINIMUM_VALID_PIXEL_VALUE=0 OVERLOAD=${OVERLOAD}"
NX=`awk '/X-Binary-Size-Fastest-Dimension/{print $2}' tmp2`
NY=`awk '/X-Binary-Size-Second-Dimension/{print $2}' tmp2`
QX=`awk '/ELEMENT_X ELEMENT_X/{print $4}' tmp2`
QY=`awk '/ELEMENT_Y ELEMENT_Y/{print $4}' tmp2`
# ORGX/Y-offsets relative to center of detector:
ORGX=`grep " 0 0 ? ? ?" tmp2 | awk '/ H /{print $2}'`
ORGY=`grep " 0 0 ? ? ?" tmp2 | awk '/ V /{print $2}'`
# total ORGX/Y
ORGX=`echo "scale=2; ${NX}/2+($ORGX/$QX)" | bc -l`
ORGY=`echo "scale=2; ${NY}/2-($ORGY/$QY)" | bc -l`
DETECTOR_DISTANCE=`grep "0 0 ? ? ?" tmp2 | awk '/DX /{print $2}'`
X_RAY_WAVELENGTH=`awk '/diffrn_radiation_wavelength.wavelength/{print $2}' tmp2`
OMEGA=`awk '/OMEGA \? \? \?/{print $5}' tmp2`
DELTAOMEGA=`awk '/OMEGA \? \? \?/{print $6}' tmp2`
PHI=`awk '/PHI \? \? \?/{print $5}' tmp2`
DELTAPHI=`awk '/PHI \? \? \?/{print $6}' tmp2`
KAPPA=`awk '/CHI \? \? \?/{print $5}' tmp2`
echo OMEGA DELTAOMEGA PHI DELTAPHI KAPPA= $OMEGA $DELTAOMEGA $PHI $DELTAPHI $KAPPA
# test whether the absolute value of deltaphi is > absolute value of deltaomega
if (( $(echo "${DELTAPHI}^2 > ${DELTAOMEGA}^2"|bc -l) )); then
    echo PHI scan
    R3=`echo "scale=7; s($KAPPA/$DEGTOR)*s($OMEGA/$DEGTOR)" | bc -l`
    R1=`echo "scale=7; s($KAPPA/$DEGTOR)*c($OMEGA/$DEGTOR)" | bc -l`
    R2=`echo "scale=7; c($KAPPA/$DEGTOR)          " | bc -l`
    rotation_axis="$R1 $R2 $R3"
    OSCILLATION_RANGE=${DELTAPHI}
# here we could check if DELTAPHI is <0, and if so, negate it and rotation_axis
else
    echo OMEGA scan
    rotation_axis="0 -1 0"
    OSCILLATION_RANGE=${DELTAOMEGA}
# here we could check if DELTAOMEGA is <0, and if so, negate it and rotation_axis
fi
# 2theta
  TWOTHETA=`awk '/TWOTHETA \? \? \?/{print $5}' tmp2`
  echo TWOTHETA=$TWOTHETA
  R1=`echo "scale=7; c($TWOTHETA/$DEGTOR)" | bc -l`
  R3=`echo "scale=7; s($TWOTHETA/$DEGTOR)" | bc -l`
  DIRECTION_OF_DETECTOR_X_AXIS="$R1 0 $R3"
# end of Bruker-cbf section
else
else
   echo should never come here
   echo should never come here
Line 584: Line 648:
VALUE_RANGE_FOR_TRUSTED_DETECTOR_PIXELS=6000. 30000. ! often 7000 or 8000 is ok
VALUE_RANGE_FOR_TRUSTED_DETECTOR_PIXELS=6000. 30000. ! often 7000 or 8000 is ok
STRONG_PIXEL=4          ! COLSPOT: only use strong reflections (default is 3)
STRONG_PIXEL=4          ! COLSPOT: only use strong reflections (default is 3)
MINIMUM_NUMBER_OF_PIXELS_IN_A_SPOT=3 ! default of 6 is sometimes too high
MINIMUM_NUMBER_OF_PIXELS_IN_A_SPOT=$MNOPIAS ! default of 6 is sometimes too high
! close spots/long cell axis: reduce SEPMIN and CLUSTER_RADIUS from their defaults of 6 and 3
! close spots/long cell axis: reduce SEPMIN and CLUSTER_RADIUS from their defaults of 6 and 3
! SEPMIN=4  CLUSTER_RADIUS=2 ! should be default for Pilatus and other detectors with low PSF
! SEPMIN=4  CLUSTER_RADIUS=2 ! should be default for Pilatus and other detectors with low PSF
Line 626: Line 690:
  else
  else
  cat >> XDS.INP << eof
  cat >> XDS.INP << eof
DIRECTION_OF_DETECTOR_X-AXIS=1 0 0
DIRECTION_OF_DETECTOR_X-AXIS=$DIRECTION_OF_DETECTOR_X_AXIS
DIRECTION_OF_DETECTOR_Y-AXIS=0 1 0
DIRECTION_OF_DETECTOR_Y-AXIS=0 1 0
eof
eof
Line 632: Line 696:
  cat >> XDS.INP << eof
  cat >> XDS.INP << eof
INCIDENT_BEAM_DIRECTION=0 0 1
INCIDENT_BEAM_DIRECTION=0 0 1
FRACTION_OF_POLARIZATION=0.98   ! better value is provided by beamline staff!
FRACTION_OF_POLARIZATION=${pol_frac}   ! better value is provided by beamline staff!
POLARIZATION_PLANE_NORMAL=0 1 0
POLARIZATION_PLANE_NORMAL=0 1 0
eof
eof
2,684

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu