Generate XDS.INP: Difference between revisions

(→‎The script: revision 0.31)
Line 47: Line 47:
# revision 0.30 . Keitaro 3/2013 - for ADSC: write all possible beam center conventions in XDS.INP as comments
# revision 0.30 . Keitaro 3/2013 - for ADSC: write all possible beam center conventions in XDS.INP as comments
# revision 0.31 . Keitaro 3/2013 - add comment for reversed phi for SPring-8
# revision 0.31 . Keitaro 3/2013 - add comment for reversed phi for SPring-8
REVISION="0.31 (06-Mar-2013)"                                                                              
# revision 0.32 . Keitaro 3/2013 - add RAXIS support. only tested with RAXIS IV++ and VII.
REVISION="0.32 (15-Mar-2013)"
#                                                                                                             
#                                                                                                             
# usage: e.g. generate_XDS.INP "frms/mydata_1_???.img"                                                       
# usage: e.g. generate_XDS.INP "frms/mydata_1_???.img"                                                       
Line 112: Line 113:
grep -q PILATUS tmp2            && DET=pilatus                               
grep -q PILATUS tmp2            && DET=pilatus                               
grep -q BEAM_CENTER_X tmp2      && DET=adsc                                 
grep -q BEAM_CENTER_X tmp2      && DET=adsc                                 
head -n1 tmp2 | grep -q "^RAXIS" && DET=raxis
# identify other detector types in the same way (MAR IP would be straightforward)
# identify other detector types in the same way (MAR IP would be straightforward)


Line 242: Line 244:
       OSCILLATION_RANGE=`awk '/Angle/{print $2}' tmp2`
       OSCILLATION_RANGE=`awk '/Angle/{print $2}' tmp2`


elif [ "$DET" == "raxis" ]; then
  echo Data from a RAXIS detector
  DETECTOR="RAXIS MINIMUM_VALID_PIXEL_VALUE=0  OVERLOAD=2000000"
  #let SKIP=768
  #NX=$(od -t x -j $SKIP -N 4 $FIRSTFRAME |awk 'NR==1{print toupper($2)}'|perl -nle '@array= $_ =~/.{2}/g; print "ibase=16;obase=A;".join("",reverse @array)'|bc)
  NX=$(python -c 'import struct; f=open("'$FIRSTFRAME'","rb");f.seek(768);print "%.4d"%struct.unpack(">i",f.read(4))')
  NY=$(python -c 'import struct; f=open("'$FIRSTFRAME'","rb");f.seek(772);print "%.4d"%struct.unpack(">i",f.read(4))')
  DETECTOR_DISTANCE=$(python -c 'import struct; f=open("'$FIRSTFRAME'","rb");f.seek(344);print "-%.4f"%struct.unpack(">f",f.read(4))')
  ORGX=$(python -c 'import struct; f=open("'$FIRSTFRAME'","rb");f.seek(540);print "%.4f"%struct.unpack(">f",f.read(4))')
  ORGY=$(python -c 'import struct; f=open("'$FIRSTFRAME'","rb");f.seek(544);print "%.4f"%struct.unpack(">f",f.read(4))')
  OSCILLATION_RANGE=$(python -c 'import struct; f=open("'$FIRSTFRAME'","rb");f.seek(524);phis,phie=struct.unpack(">ff",f.read(8));print "%.4f"%(phie-phis)')
  QX=$(python -c 'import struct; f=open("'$FIRSTFRAME'","rb");f.seek(776);print "%.6f"%struct.unpack(">f",f.read(4))')
  QY=$(python -c 'import struct; f=open("'$FIRSTFRAME'","rb");f.seek(780);print "%.6f"%struct.unpack(">f",f.read(4))')
  X_RAY_WAVELENGTH=$(python -c 'import struct; f=open("'$FIRSTFRAME'","rb");f.seek(292);print "%.6f"%struct.unpack(">f",f.read(4))')
else
else
   echo should never come here
   echo should never come here
Line 303: Line 325:
! as about 32* what CORRECT.LP suggests (absorption of phosphor is much higher than that of silicon)
! as about 32* what CORRECT.LP suggests (absorption of phosphor is much higher than that of silicon)
NX= $NX NY= $NY  QX= $QX  QY= $QY ! to make CORRECT happy if frames are unavailable
NX= $NX NY= $NY  QX= $QX  QY= $QY ! to make CORRECT happy if frames are unavailable
eof
if [ "$DET" == "raxis" ]; then
cat >> XDS.INP << eof
DIRECTION_OF_DETECTOR_X-AXIS=1 0 0
DIRECTION_OF_DETECTOR_Y-AXIS=0 -1 0
INCIDENT_BEAM_DIRECTION=0 0 1
ROTATION_AXIS=0 1 0
!FRACTION_OF_POLARIZATION=0.98  ! uncomment if synchrotron
POLARIZATION_PLANE_NORMAL=1 0 0
eof
else
cat >> XDS.INP << eof
DIRECTION_OF_DETECTOR_X-AXIS=1 0 0
DIRECTION_OF_DETECTOR_X-AXIS=1 0 0
DIRECTION_OF_DETECTOR_Y-AXIS=0 1 0
DIRECTION_OF_DETECTOR_Y-AXIS=0 1 0
Line 309: Line 343:
FRACTION_OF_POLARIZATION=0.98  ! better value is provided by beamline staff!
FRACTION_OF_POLARIZATION=0.98  ! better value is provided by beamline staff!
POLARIZATION_PLANE_NORMAL=0 1 0
POLARIZATION_PLANE_NORMAL=0 1 0
eof
fi
cat >> XDS.INP << eof
!used by DEFPIX and CORRECT to exclude ice-reflections / ice rings - uncomment if necessary
!used by DEFPIX and CORRECT to exclude ice-reflections / ice rings - uncomment if necessary
!EXCLUDE_RESOLUTION_RANGE= 3.93 3.87 !ice-ring at 3.897 Angstrom
!EXCLUDE_RESOLUTION_RANGE= 3.93 3.87 !ice-ring at 3.897 Angstrom
33

edits