Generate XDS.INP: Difference between revisions

Jump to navigation Jump to search
use od instead of catmar/mccd_xdsparams.pl
No edit summary
(use od instead of catmar/mccd_xdsparams.pl)
Line 7: Line 7:


# purpose: generate XDS.INP
# purpose: generate XDS.INP
# revision 0.03 . Kay Diederichs 2/2010
# revision 0.03 . Kay Diederichs 2/2010  
# revision 0.04 . Kay Diederichs 4/2010 - include alternative ORGX, ORGY calculations for ADSC
# revision 0.04 . Kay Diederichs 4/2010 - include alternative ORGX, ORGY calculations for ADSC
# revision 0.05 . Kay Diederichs 5/2010 - grep for "Corrected" in addition to "marccd"; needed for BESSY
# revision 0.05 . Kay Diederichs 5/2010 - grep for "Corrected" in addition to "marccd"; needed for BESSY  
# revision 0.06 . KD 6/2010 - add UNTRUSTED_RECTANGLE and UNTRUSTED_ELLIPSE; use `whereis catmar` and so on
# revision 0.06 . KD 6/2010 - add UNTRUSTED_RECTANGLE and UNTRUSTED_ELLIPSE; use `whereis catmar` and so on  
# revision 0.07 . KD 6/2010 - decide about ORGX/Y info in MAR header being pixels or mm; other fixes
# revision 0.07 . KD 6/2010 - decide about ORGX/Y info in MAR header being pixels or mm; other fixes
# revision 0.08 . KD 6/2010 - fixes for Pilatus 6M
# revision 0.08 . KD 6/2010 - fixes for Pilatus 6M
# revision 0.09 . KD 6/2010 - get rid of requirement for mccd_xdsparams.pl and/or catmar by using "od"
# revision 0.09 . KD 6/2010 - get rid of requirement for mccd_xdsparams.pl and/or catmar; rather use "od"
# tested with some datasets from ALS, SSRL, SLS and ESRF; only MarCCD, ADSC/SMV, PILATUS 6M detectors;
# tested with some datasets from ALS, SSRL, SLS and ESRF; only MARCCD, ADSC/SMV, PILATUS 6M detectors;  
# for other detectors, values marked with XXX must be manually filled in.
# for other detectors, values marked with XXX must be manually filled in.
#
#
Line 21: Line 21:
# the ? are wildcards for the frame numbers.
# the ? are wildcards for the frame numbers.
#
#
# requirement for external programs(s):
# two external programs that can read MAR headers:
# - for MARCCD detectors the "catmar" binary (which can be downloaded from http://www.marresearch.com/download.html) must be in $PATH
# - for MARCCD detectors the "catmar" binary (which can be downloaded from http://www.marresearch.com/download.html)  
# - alternatively, the [[mccd_xdsparams.pl]] script (see http://strucbio.biologie.uni-konstanz.de/xdswiki/index.php/Mccd_xdsparams.pl ) may be used (courtesy of Ana Gonzalez).
# - the [[mccd_xdsparams.pl]] script (see http://strucbio.biologie.uni-konstanz.de/xdswiki/index.php/Mccd_xdsparams.pl )  
#
#  
# limitations:
# limitations:
# - frame numbers are assumed to start with 1 and run consecutively
# - frame numbers are assumed to start with 1 and run consecutively
#
#  
# known problems:
# known problems:
# - for ADSC detectors, there are at least three ways to obtain ORGX and ORGY values from the header (see below);
# - for ADSC detectors, there are at least three ways to obtain ORGX and ORGY values from the header (see below);
Line 78: Line 78:
# 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)


# parse ASCII header of first frame (except for MARCCD, which therefore requires catmar)
# parse ASCII header of first frame


if [ "$DET" == "XXX" ]; then
if [ "$DET" == "XXX" ]; then
Line 87: Line 87:
elif [ "$DET" == "mccd" ]; then
elif [ "$DET" == "mccd" ]; then


   DETECTOR="CCDCHESS MINIMUM_VALID_PIXEL_VALUE= 1 OVERLOAD= 65000"
   DETECTOR="CCDCHESS MINIMUM_VALID_PIXEL_VALUE= 1 OVERLOAD= 65500"
  CATMAR=`whereis -b catmar`
  if [ "$CATMAR" != "catmar:" ]; then


      # inspect frame header and get rid of blanks:
  # use first frame of dataset to obtain parameters
      catmar `head -1 tmp1` | sed s/\ //g > tmp2
  MARFRAME=`head -1 tmp1`


      # find X_RAY_WAVELENGTH:
  # offsets are documented; values can be find in mccd_xdsparams.pl script
      X_RAY_WAVELENGTH=`grep Wavelength tmp2 | sed s/Wavelength.Ang]=//`
  let SKIP=1024+80
  NX=$(od -t dI --skip-bytes=$SKIP --read-bytes=4 $MARFRAME | head -1 | awk '{print $2}')
  let SKIP=$SKIP+4
  NY=$(od -t dI --skip-bytes=$SKIP --read-bytes=4 $MARFRAME | head -1 | awk '{print $2}')


      # find QX, ORGX and ORGY:
  let SKIP=1024+256+128+256
      QX=`grep Pixelsizex tmp2 | sed s/Pixelsizex=//`
  DETECTOR_DISTANCE=$(od -t dI --skip-bytes=$SKIP --read-bytes=4 $MARFRAME | head -1 | awk '{print $2}')
      QX=`echo "scale=10; $QX/1000000" |bc -l `
  DETECTOR_DISTANCE=`echo "scale=3; $DETECTOR_DISTANCE/1000" | bc -l`
      NX=`grep pixelsin1line tmp2 | sed s/#pixelsin1line=//`
   
  let SKIP=$SKIP+4
  ORGX=$(od -t dI --skip-bytes=$SKIP --read-bytes=4 $MARFRAME | head -1 | awk '{print $2}')
  ORGX=`echo "scale=2; $ORGX/1000" | bc -l `
  let SKIP=$SKIP+4
  ORGY=$(od -t dI --skip-bytes=$SKIP --read-bytes=4 $MARFRAME | head -1 | awk '{print $2}')
  ORGY=`echo "scale=2; $ORGY/1000" | bc -l `


      ORGX=`grep Centerx tmp2 | sed s/Centerx=//`
  let SKIP=1024+256+128+256+44
      ORGX=`echo "scale=1; ($ORGX+50)/1000" | bc -l `
  PHISTART=$(od -t dI --skip-bytes=$SKIP --read-bytes=4 $MARFRAME | head -1 | awk '{print $2}')
  let SKIP=1024+256+128+256+76
  PHIEND=$(od -t dI --skip-bytes=$SKIP --read-bytes=4 $MARFRAME | head -1 | awk '{print $2}')
  OSCILLATION_RANGE=`echo "scale=3; ($PHIEND-$PHISTART)/1000" | bc -l`
 
  let SKIP=1024+256+128+256+128+4
  QX=$(od -t dI --skip-bytes=$SKIP --read-bytes=4 $MARFRAME | head -1 | awk '{print $2}')
  QX=`echo "scale=10; $QX/1000000" |bc -l `
  let SKIP=$SKIP+4
  QY=$(od -t dI --skip-bytes=$SKIP --read-bytes=4 $MARFRAME | head -1 | awk '{print $2}')
  QY=`echo "scale=10; $QY/1000000" |bc -l `


      ORGY=`grep Centery tmp2 | sed s/Centery=//`
  let SKIP=1024+256+128+256+128+128+12
      ORGY=`echo "scale=1; ($ORGY+50)/1000" | bc -l `
  X_RAY_WAVELENGTH=$(od -t dI --skip-bytes=$SKIP --read-bytes=4 $MARFRAME | head -1 | awk '{print $2}')
  X_RAY_WAVELENGTH=`echo "scale=5; $X_RAY_WAVELENGTH/100000" | bc -l`


      # find DETECTOR_DISTANCE and OSCILLATION_RANGE:
      DETECTOR_DISTANCE=`grep Distance tmp2 | sed s/Distance.mm]=//`
      STARTING_PHI=`grep StartingPHI tmp2 | sed s/StartingPHI=//`
      ENDING_PHI=`grep EndingPHI tmp2 | sed s/EndingPHI=//`
      OSCILLATION_RANGE=`echo "scale=3; ($ENDING_PHI-$STARTING_PHI)/1000" | bc -l`
  else
      CATMAR=`whereis -b mccd_xdsparams.pl`
      if [ "$CATMAR" != "mccd_xdsparams:" ]; then
        mccd_xdsparams.pl -v `head -1 tmp1` > tmp2
        NX=`awk '/NX/{print $2}' tmp2`
        QX=`awk '/QX/{print $6}' tmp2`
        X_RAY_WAVELENGTH=`awk '/X-RAY_WAVELENGTH/{print $2}' tmp2`
        DETECTOR_DISTANCE=`awk '/DETECTOR_DISTANCE/{print $2}' tmp2`
        ORGX=`awk '/ORGX/{print $2}' tmp2`
        ORGY=`awk '/ORGY/{print $4}' tmp2`
        OSCILLATION_RANGE=`awk '/OSCILLATION_RANGE/{print $2}' tmp2`
      else
        echo "could not find catmar or mccd_xdsparams.pl - fill XXX values manually!"
      fi
  fi
# at most BLs, ORGX and ORGY are in pixels, but sometimes in mm ... guess:
# at most BLs, ORGX and ORGY are in pixels, but sometimes in mm ... guess:
   NXBYFOUR=`echo "scale=0; $NX/4" | bc -l `
   NXBYFOUR=`echo "scale=0; $NX/4" | bc -l `
   ORGXINT=`echo "scale=0; $ORGX/1" | bc -l `
   ORGXINT=`echo "scale=0; $ORGX/1" | bc -l `
   if [ $ORGXINT -lt $NXBYFOUR ]; then
   if [ $ORGXINT -lt $NXBYFOUR ]; then
#    echo ORGX ORGY QX = $ORGX $ORGY $QX
     ORGX=`echo "scale=1; $ORGX/$QX" | bc -l`
     ORGX=`echo "scale=1; $ORGX/$QX" | bc -l`
     ORGY=`echo "scale=1; $ORGY/$QX" | bc -l`
     ORGY=`echo "scale=1; $ORGY/$QY" | bc -l`
     echo MARCCD detector: header ORGX, ORGY seem to be in mm ... converting to pixels
     echo MARCCD detector: header ORGX, ORGY seem to be in mm ... converting to pixels
   else
   else
Line 155: Line 151:
       BEAM_CENTER_X=`grep BEAM_CENTER_X tmp2 | sed s/BEAM_CENTER_X=//`
       BEAM_CENTER_X=`grep BEAM_CENTER_X tmp2 | sed s/BEAM_CENTER_X=//`
       BEAM_CENTER_Y=`grep BEAM_CENTER_Y tmp2 | sed s/BEAM_CENTER_Y=//`
       BEAM_CENTER_Y=`grep BEAM_CENTER_Y tmp2 | sed s/BEAM_CENTER_Y=//`
# fix 2010-04-26 - tell user about possible ORGX, ORGY alternatives -
# fix 2010-04-26 - tell user about possible ORGX, ORGY alternatives -
# at ESRF and ... (pls fill in!) the following should be used:
# at ESRF and ... (pls fill in!) the following should be used:
       ORGX=`echo "scale=1; $BEAM_CENTER_Y/$QX" | bc -l `
       ORGX=`echo "scale=1; $BEAM_CENTER_Y/$QX" | bc -l `
       ORGY=`echo "scale=1; $BEAM_CENTER_X/$QX" | bc -l `
       ORGY=`echo "scale=1; $BEAM_CENTER_X/$QX" | bc -l `
       echo ATTENTION: at ESRF BLs use: ORGX=$ORGX ORGY=$ORGY
       echo ATTENTION: at ESRF BLs use: ORGX=$ORGX ORGY=$ORGY  
# this 2nd alternative convention should be used at the following beamlines (pls complete the list): ALS 5.0.3, ...
# this 2nd alternative convention should be used at the following beamlines (pls complete the list): ALS 5.0.3, ...
       ORGX=`echo "scale=1; $NX-$BEAM_CENTER_X/$QX" | bc -l `
       ORGX=`echo "scale=1; $NX-$BEAM_CENTER_X/$QX" | bc -l `
       ORGY=`echo "scale=1; $BEAM_CENTER_Y/$QX" | bc -l `
       ORGY=`echo "scale=1; $BEAM_CENTER_Y/$QX" | bc -l `
       echo ATTENTION: at e.g. ALS 5.0.3 use: ORGX=$ORGX ORGY=$ORGY
       echo ATTENTION: at e.g. ALS 5.0.3 use: ORGX=$ORGX ORGY=$ORGY  
# this 3rd alternative convention should be used at the following beamlines (pls complete the list): ALS 8.2.2, ...
# this 3rd alternative convention should be used at the following beamlines (pls complete the list): ALS 8.2.2, ...  
       ORGX=`echo "scale=1; $BEAM_CENTER_X/$QX" | bc -l `
       ORGX=`echo "scale=1; $BEAM_CENTER_X/$QX" | bc -l `
       ORGY=`echo "scale=1; $NX-$BEAM_CENTER_Y/$QX" | bc -l `
       ORGY=`echo "scale=1; $NX-$BEAM_CENTER_Y/$QX" | bc -l `
Line 210: Line 206:
X-RAY_WAVELENGTH= $X_RAY_WAVELENGTH
X-RAY_WAVELENGTH= $X_RAY_WAVELENGTH
NAME_TEMPLATE_OF_DATA_FRAMES=$NAME_TEMPLATE_OF_DATA_FRAMES
NAME_TEMPLATE_OF_DATA_FRAMES=$NAME_TEMPLATE_OF_DATA_FRAMES
! REFERENCE_DATA_SET=xxx/XDS_ASCII.HKL ! e.g. to ensure consistent indexing
! REFERENCE_DATA_SET=xxx/XDS_ASCII.HKL ! e.g. to ensure consistent indexing
DATA_RANGE=1 $DATA_RANGE
DATA_RANGE=1 $DATA_RANGE
SPOT_RANGE=1 $SPOT_RANGE
SPOT_RANGE=1 $SPOT_RANGE
Line 238: Line 234:
MINIMUM_ZETA=0.05        ! integrate close to the Lorentz zone; 0.15 is default
MINIMUM_ZETA=0.05        ! integrate close to the Lorentz zone; 0.15 is default
STRONG_PIXEL=6          ! COLSPOT: only use strong reflections (default is 3)
STRONG_PIXEL=6          ! COLSPOT: only use strong reflections (default is 3)
REFINE(INTEGRATE)=CELL BEAM ORIENTATION ! AXIS DISTANCE
REFINE(INTEGRATE)=CELL BEAM ORIENTATION ! AXIS DISTANCE  


! parameters specifically for this detector and beamline:
! parameters specifically for this detector and beamline:
Line 252: Line 248:
echo XDS.INP is ready for use. The file has only the most important keywords.
echo XDS.INP is ready for use. The file has only the most important keywords.
echo After running xds, inspect at least BKGPIX.cbf and FRAME.cbf with XDS-Viewer!
echo After running xds, inspect at least BKGPIX.cbf and FRAME.cbf with XDS-Viewer!
rm tmp1 tmp2
rm -f tmp1 tmp2  


</pre>
</pre>
2,684

edits

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

Navigation menu