<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.uni-konstanz.de/xds/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Karine</id>
	<title>XDSwiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.uni-konstanz.de/xds/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Karine"/>
	<link rel="alternate" type="text/html" href="https://wiki.uni-konstanz.de/xds/index.php/Special:Contributions/Karine"/>
	<updated>2026-04-17T19:59:56Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://wiki.uni-konstanz.de/xds/index.php?title=Generate_XDS.INP&amp;diff=3333</id>
		<title>Generate XDS.INP</title>
		<link rel="alternate" type="text/html" href="https://wiki.uni-konstanz.de/xds/index.php?title=Generate_XDS.INP&amp;diff=3333"/>
		<updated>2016-04-13T12:49:32Z</updated>

		<summary type="html">&lt;p&gt;Karine: /* System-wide or personal installation */ it is, I had a user today who had trouble using the script because of a missing license agreement&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;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.&lt;br /&gt;
&lt;br /&gt;
The [[Eiger]] detector is not yet implemented in the script, but this will eventually come.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
Usage is just (don&#039;t forget the quotation marks!):&lt;br /&gt;
 generate_XDS.INP &amp;quot;/home/myname/frms/mydata_1_???.img&amp;quot;&lt;br /&gt;
XDS [http://strucbio.biologie.uni-konstanz.de/~dikay/XDS_html_doc/html_doc/xds_parameters.html#NAME_TEMPLATE_OF_DATA_FRAMES= supports] bzip2-ed frames. Thus, when specifying the frame name parameter of the script, you should leave out any .bz2 extension.&lt;br /&gt;
&lt;br /&gt;
For improved interaction with [[XDSGUI]], it is advantageous to use an &#039;&#039;absolute&#039;&#039; filename - one that starts with a slash (&amp;quot;/&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
== The script ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash                                                                   &lt;br /&gt;
# purpose: generate XDS.INP                                                   &lt;br /&gt;
#                                                                             &lt;br /&gt;
# tested with some datasets from ALS, SSRL, SLS, ESRF, BESSY, SPring-8 and PF; only MAR, ADSC/SMV, PILATUS, RAXIS (in-house) detectors; &lt;br /&gt;
# for other detectors, values marked with XXX must be manually filled in.                                  &lt;br /&gt;
#                                                                                                          &lt;br /&gt;
# revision 0.03 . Kay Diederichs 2/2010                                                                    &lt;br /&gt;
# revision 0.04 . Kay Diederichs 4/2010 - include alternative ORGX, ORGY calculations for ADSC             &lt;br /&gt;
# revision 0.05 . Kay Diederichs 5/2010 - grep for &amp;quot;Corrected&amp;quot; in addition to &amp;quot;marccd&amp;quot;; needed for BESSY   &lt;br /&gt;
# revision 0.06 . KD 6/2010 - add UNTRUSTED_RECTANGLE and UNTRUSTED_ELLIPSE; use `whereis catmar` and so on &lt;br /&gt;
# revision 0.07 . KD 6/2010 - decide about ORGX/Y info in MAR header being pixels or mm; other fixes        &lt;br /&gt;
# revision 0.08 . KD 6/2010 - fixes for Pilatus 6M                                                          &lt;br /&gt;
# revision 0.09 . KD 6/2010 - get rid of requirement for mccd_xdsparams.pl and/or catmar; rather use &amp;quot;od&amp;quot;   &lt;br /&gt;
# revision 0.10 . Tim Gruene 7/2010 - set link &#039;images&#039; to image directory if path exceeds 72 characters    &lt;br /&gt;
# revision 0.11 . KD 7/2010 - for MarCCD: look for distance info at different byte position                 &lt;br /&gt;
# revision 0.12 . KD 7/2010 - fix for negative PHISTART                                                     &lt;br /&gt;
# revision 0.13 . KD 8/2010 - store correct NX NY QX QY in XDS.INP                                          &lt;br /&gt;
# revision 0.14 . KD 1/2011 - SENSOR_THICKNESS for Pilatus; MINIMUM_NUMBER_OF_PIXELS_IN_A_SPOT=3            &lt;br /&gt;
# revision 0.15 . KD 2/2011 - add comment for -ive sign of APS 19-ID and Australian Synchrotron rotation axis&lt;br /&gt;
# revision 0.16 . KD 3/2011 - SENSOR_THICKNESS=0.01 for ADSC and MarCCD. Add comment about SILICON=          &lt;br /&gt;
# revision 0.17 . KD 3/2011 - make it work for .bz2 frames; improve screen output                            &lt;br /&gt;
# revision 0.18 . KD 4/2011 - faster by doing &amp;quot;strings&amp;quot; only once; revert &amp;quot;images/${1##/*/}&amp;quot; &amp;quot;correction&amp;quot;    &lt;br /&gt;
# revision 0.19 . KD 6/2011 - bugfix for 0.18                                                                &lt;br /&gt;
# revision 0.20 . KD 7/2011 - redirect stderr of /bin/ls to /dev/null                                        &lt;br /&gt;
# revision 0.21 . KD 11/2011 - SEPMIN, CLUSTER_RADIUS hints; read NX NY from header (for Pilatus 2M)&lt;br /&gt;
# revision 0.22 . KD 12/2011 - Pilatus 2M UNTRUSTED_RECTANGLE lines, SENSOR_THICKNESS from header&lt;br /&gt;
# revision 0.23 . KD 1/2012 - add UNTRUSTED_QUADRILATERAL, remove MINIMUM_ZETA (0.05 is default now)&lt;br /&gt;
# revision 0.24 . KD 3/2012 - remove revision 0.10 since XDS now takes much longer paths&lt;br /&gt;
# revision 0.25 . KD 3/2012 - remove revision 0.22 for PSI Pilatus 2M; see http://www.globalphasing.com/autoproc/wiki/index.cgi?TroubleShootingKnownIssues&lt;br /&gt;
# revision 0.26 . KD 7/2012 - Mac-compatibility: replace od flags --skip-bytes= and --read-bytes= with -j and -N (thanks to Oliver Clarke for working this out!)&lt;br /&gt;
# revision 0.27 . KD 11/2012 - EXCLUDE_RESOLUTION_RANGE lines and generic Pilatus Flat_field test&lt;br /&gt;
# revision 0.28 . Keitaro 11/2012 - for MarCCD: read oscillation range from the position 1024+736 (fix for omega rotation)&lt;br /&gt;
# revision 0.29 . KD 1/2013 - include UNTRUSTED_RECTANGLEs for Pilatus 6M; never hurts but needed if the beamline software does not mark them with -2 or such&lt;br /&gt;
# revision 0.30 . Keitaro 3/2013 - for ADSC: write all possible beam center conventions in XDS.INP as comments&lt;br /&gt;
# revision 0.31 . Keitaro 3/2013 - add comment for reversed phi for SPring-8&lt;br /&gt;
# revision 0.32 . Keitaro 3/2013 - add RAXIS support. only tested with RAXIS IV++ and VII.&lt;br /&gt;
# revision 0.33 . Keitaro 5/2013 - automatically set ROTATION_AXIS=-1 0 0 for SPring-8 BL32XU/41XU/44XU beamlines based on detector serial numbers.&lt;br /&gt;
# revision 0.34 . Keitaro 5/2013 - recognize ADSC detectors in Photon Factory and choose correct beam center convention based on detector serial numbers.&lt;br /&gt;
# revision 0.35 . KD 6/2013 - reduce 7000 to 6000 for shadow detection; insert comment about *_RESOLUTION_RANGE lines&lt;br /&gt;
# revision 0.36 . KD 6/2013 - insert NUMBER_OF_PROFILE_GRID* lines for Pilatus (suggested by C.Vonrhein)&lt;br /&gt;
# revision 0.37 . Keitaro 10/2013 - fix for MX225HS detector on SPring-8 BL32XU (Ignore case when matching marccd in header); but cannot decide reverse-phi because of missing detector S/N&lt;br /&gt;
# revision 0.38 . KD 2/2014 - change defaults for REFINE(IDXREF) and REFINE(INTEGRATE) such that more stable results are obtained for difficult datasets&lt;br /&gt;
# revision 0.39 . Keitaro 4/2014 - automatically set ROTATION_AXIS=-1 0 0 for MX225HS at SPring-8 BL32XU.&lt;br /&gt;
# revision 0.40 . Jan Gebauer /KD 4/2014 - simple implementation of MAR345 detector&lt;br /&gt;
# revision 0.41 . recognize header starting with R-AXIS instead of RAXIS&lt;br /&gt;
# revision 0.42 . Keitaro 5/2014 automatically set ROTATION_AXIS=-1 0 0 for Q315 at SPring-8 BL38B1.&lt;br /&gt;
# revision 0.43 . Keitaro 5/2014 add experimental support of dTREK format (raxis_smv)&lt;br /&gt;
# revision 0.44 . Keitaro 5/2014 automatically set ROTATION_AXIS=-1 0 0 for PILATUS3 at SPring-8 BL41XU.&lt;br /&gt;
# revision 0.45 . KD cope with blanks in filenames&lt;br /&gt;
# revision 0.46 . Keitaro 6/2014 automatically set ROTATION_AXIS=-1 0 0 for Mar225 at SPring-8 BL26B2.&lt;br /&gt;
# revision 0.47 . Keitaro 7/2014 more generic dTREK format support (Saturn and RAXIS)&lt;br /&gt;
# revision 0.48 . Kip Guja 11/2014 add detector serial number for ALS 5.0.2 to beam center convention 1 &lt;br /&gt;
# revision 0.49 . Nobuhisa 2/2015 add  detector serial number for AichiSR BL2S1 to beam center convention 1&lt;br /&gt;
# revision 0.50 . KD 03/2015 workaround for Mar-1 change of parameter name &amp;quot;DISTANCE&amp;quot; to &amp;quot;POSITION&amp;quot; in REFINE(*) keywords&lt;br /&gt;
# revision 0.51 . Keitaro 03/2015 add .gz and .xz support and remove limitation - frame numbers can start with any.&lt;br /&gt;
# revision 0.52 . Keitaro 05/2015 fix ADSC beam center convention for SPring-8 and DET_SN acquisition for PILATUS (didn&#039;t work on Mac)&lt;br /&gt;
# revision 0.53 . KD add ADSC beam center convention for APS Argonne but only as commented line in XDS.INP (not detector serial no)&lt;br /&gt;
# revision 0.54 . KD add ADSC S/N 911 for APS Argonne, and fix spurious output arising from THETADISTANCE (?!)&lt;br /&gt;
# revision 0.55 . KD add ADSC S/N 446 for APS, and check w/ 12 datasets from data.sbgrid.org. No rule found: S/N 916 @ APS 24_ID_E !&lt;br /&gt;
# revision 0.56 . Keitaro 12/2015 show error message when user&#039;s input didn&#039;t match any files&lt;br /&gt;
# revision 0.57 . KD 12/2015 start to take care of vertical ROTATION_AXIS at Diamond I24 - for now only introduce comment&lt;br /&gt;
# revision 0.58 . Keitaro 01/2016 fix for dTREK image: take &#039;rotation axis&#039; information from header&lt;br /&gt;
# revision 0.59 . KD 04/04/2016 check for ADSC detector _after_ checking for dtrek detector, to correct wrong choice for https://zenodo.org/record/45756&lt;br /&gt;
# revision 0.60 . KD 04/04/2016 ADSC detector SN=458 at APS 19-ID has reverse phi (https://zenodo.org/record/45756)&lt;br /&gt;
# revision 0.61 . Keitaro 10/04/2016 Add Eiger hdf5 support (may be incomplete; UNTRUSTED_RECTANGLE=s not set) NEED h5dump.&lt;br /&gt;
# revision 0.62 . Keitaro 11/04/2016 Can give foo_master.h5 instead of foo_??????.h5.&lt;br /&gt;
# revision 0.63 . Keitaro 13/04/2016 Set UNTRUSTED_RECTANGLE=s for EIGER 9M.&lt;br /&gt;
REVISION=&amp;quot;0.63 (13-Apr-2016)&amp;quot;&lt;br /&gt;
#                                                                                                            &lt;br /&gt;
# usage: e.g. generate_XDS.INP &amp;quot;/file/system/frms/mydata_1_???.img&amp;quot;                                                       &lt;br /&gt;
# make sure to have the two quotation marks !                                                                &lt;br /&gt;
# the ? are wildcards for the frame numbers.                                                                 &lt;br /&gt;
#                                                                                                            &lt;br /&gt;
# known problems:                                                                                            &lt;br /&gt;
# - for ADSC detectors, there are at least three ways to obtain ORGX and ORGY values from the header (see below);&lt;br /&gt;
# - the same might be a problem for MAR headers, too (not sure about this) &lt;br /&gt;
# - on Mac OS X, Xcode (from http://developer.apple.com/tools/xcode) might be needed - not sure about this                               &lt;br /&gt;
#                                                                                                                &lt;br /&gt;
# notes for debugging of the script:                                                                             &lt;br /&gt;
# - add the -v option to the first line, to see where an error occurs                                            &lt;br /&gt;
# - comment out the removal of tmp1 and tmp2 in the last line                                                    &lt;br /&gt;
#                                                                                                                &lt;br /&gt;
# ====== Start of script ======                                                                                  &lt;br /&gt;
echo generate_XDS.INP version $REVISION . Obtain the latest version from                                         &lt;br /&gt;
echo http://strucbio.biologie.uni-konstanz.de/xdswiki/index.php/generate_XDS.INP                                 &lt;br /&gt;
if [ &amp;quot;$1&amp;quot; == &amp;quot;help&amp;quot; ] || [ &amp;quot;$1&amp;quot; == &amp;quot;-help&amp;quot; ] || [ &amp;quot;$1&amp;quot; == &amp;quot;-h&amp;quot; ]; then                                           &lt;br /&gt;
  echo usage: generate_XDS.INP \&amp;quot;/file/system/frms/mydata_1_???.img\&amp;quot;   \(_with_ the quotation marks!\)                       &lt;br /&gt;
  echo if the frames are compressed with bzip2, leave out the .bz2 extension!                                    &lt;br /&gt;
  exit                                                                                                           &lt;br /&gt;
fi                                                                                                               &lt;br /&gt;
#                                                                                                                &lt;br /&gt;
# defaults:                                                                                                      &lt;br /&gt;
#                                                                                                                &lt;br /&gt;
DETECTOR=&amp;quot;XXX MINIMUM_VALID_PIXEL_VALUE=XXX OVERLOAD=XXX&amp;quot;                                                        &lt;br /&gt;
REVERSE_PHI=&amp;quot;no&amp;quot;&lt;br /&gt;
ORGX=XXX                                                                                                         &lt;br /&gt;
ORGY=XXX                                                                                                         &lt;br /&gt;
DETECTOR_DISTANCE=XXX                                                                                            &lt;br /&gt;
OSCILLATION_RANGE=XXX                                                                                            &lt;br /&gt;
X_RAY_WAVELENGTH=XXX                                                                                             &lt;br /&gt;
QX=XXX                                                                                                           &lt;br /&gt;
QY=XXX                                                                                                           &lt;br /&gt;
NX=XXX                                                                                                           &lt;br /&gt;
NY=XXX                                                                                                           &lt;br /&gt;
SENSOR_THICKNESS=0   &lt;br /&gt;
TRUSTED_REGION=&amp;quot;0.0 1.2 ! partially use corners of detector (0 1.4143: use all pixels)&amp;quot;                                                                                           &lt;br /&gt;
# see how we are called:                                                                                         &lt;br /&gt;
NAME_TEMPLATE_OF_DATA_FRAMES=&amp;quot;$1&amp;quot;&lt;br /&gt;
# list frames matching the wildcards in NAME_TEMPLATE_OF_DATA_FRAMES&lt;br /&gt;
# don&#039;t accept the &amp;quot;direct beam&amp;quot; shot at SLS/Pilatus PX-I and PX-II &lt;br /&gt;
# cope with blanks in directory / file name&lt;br /&gt;
IFS=$&#039;\n&#039;&lt;br /&gt;
/bin/ls -C1 $1 $1.bz2 $1.gz $1.xz 2&amp;gt;/dev/null | egrep -v &amp;quot;_00000.cbf|_000.img&amp;quot; &amp;gt; tmp1&lt;br /&gt;
if [ ! -s tmp1 ]&lt;br /&gt;
then&lt;br /&gt;
 echo &amp;quot;Error! No files matched: $1&amp;quot;&lt;br /&gt;
 rm -f tmp1&lt;br /&gt;
 exit 1&lt;br /&gt;
fi&lt;br /&gt;
unset IFS&lt;br /&gt;
# we can continue - the frames are found&lt;br /&gt;
&lt;br /&gt;
if echo $NAME_TEMPLATE_OF_DATA_FRAMES | grep &#039;_master.h5$&#039; &amp;gt; /dev/null; then&lt;br /&gt;
 NAME_TEMPLATE_OF_DATA_FRAMES=`echo &amp;quot;$NAME_TEMPLATE_OF_DATA_FRAMES&amp;quot; | sed -e &#039;s/_master.h5$/_??????.h5/&#039;`&lt;br /&gt;
else&lt;br /&gt;
 # Find the first &#039;?&#039; position and the number of &#039;?&#039; to determine DATA_RANGE=.&lt;br /&gt;
 pos1=`echo &amp;quot;$1&amp;quot; | awk &#039;{print index($0, &amp;quot;?&amp;quot;)}&#039;`&lt;br /&gt;
 pos2=`echo &amp;quot;$1&amp;quot; | sed -e &amp;quot;s/[^\?]//g&amp;quot; | awk &#039;{print length+&#039;$pos1&#039; - 1&#039;}`&lt;br /&gt;
 data_first=`cat tmp1 | cut -b $pos1-$pos2 | head -n1|bc`&lt;br /&gt;
 data_last=`cat tmp1 | cut -b $pos1-$pos2 | tail -n1|bc`&lt;br /&gt;
 DATA_RANGE=&amp;quot;$data_first $data_last&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # set SPOT_RANGE to first half of DATA_RANGE&lt;br /&gt;
 data_num=`wc -l tmp1 | awk &#039;{print $1}&#039;`&lt;br /&gt;
 data_half=`echo &amp;quot;scale=0; $data_num/2&amp;quot; | bc -l`                        &lt;br /&gt;
 data_half=`echo &amp;quot;if ($data_half&amp;lt;=1) 1;if ($data_half&amp;gt;1) $data_half&amp;quot; | bc -l`&lt;br /&gt;
 spot_last=`echo &amp;quot;scale=0; $data_first+$data_half-1&amp;quot; | bc -l`&lt;br /&gt;
 SPOT_RANGE=&amp;quot;$data_first $spot_last&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
FIRSTFRAME=`head -1 tmp1`&lt;br /&gt;
echo $FIRSTFRAME | grep &amp;quot;\.h5$&amp;quot; &amp;amp;&amp;amp; is_h5=1 || is_h5=0&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$is_h5&amp;quot; == 1 ]; then&lt;br /&gt;
 nframes=`h5dump -A -g &amp;quot;/entry/data&amp;quot; $FIRSTFRAME | grep &amp;quot;DATASPACE  SIMPLE&amp;quot; | sed -e &amp;quot;s/,.*//&amp;quot; | awk &#039;{a+=$5}END{print a}&#039;`&lt;br /&gt;
 DATA_RANGE=&amp;quot;1 $nframes&amp;quot;&lt;br /&gt;
 SPOT_RANGE=&amp;quot;1 `echo &amp;quot;scale=0; ${nframes}/2&amp;quot;|bc -l`&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
echo DATA_RANGE=$DATA_RANGE&lt;br /&gt;
&lt;br /&gt;
# find out detector type&lt;br /&gt;
DET=XXX              &lt;br /&gt;
IFS=$&#039;\n&#039;    &lt;br /&gt;
echo $FIRSTFRAME | grep -q &#039;\.bz2$&#039; &amp;amp;&amp;amp; bzcat $FIRSTFRAME &amp;gt; tmp1 &amp;amp;&amp;amp; FIRSTFRAME=tmp1&lt;br /&gt;
# for mac/linux compatibility. zcat foo.gz doesn&#039;t work on mac.&lt;br /&gt;
echo $FIRSTFRAME | grep -q &#039;\.gz$&#039; &amp;amp;&amp;amp; zcat &amp;lt; $FIRSTFRAME &amp;gt; tmp1 &amp;amp;&amp;amp; FIRSTFRAME=tmp1&lt;br /&gt;
echo $FIRSTFRAME | grep -q &#039;\.xz$&#039; &amp;amp;&amp;amp; xzcat $FIRSTFRAME &amp;gt; tmp1 &amp;amp;&amp;amp; FIRSTFRAME=tmp1&lt;br /&gt;
&lt;br /&gt;
unset IFS&lt;br /&gt;
if [ &amp;quot;$is_h5&amp;quot; == 0 ]; then&lt;br /&gt;
 strings $FIRSTFRAME &amp;gt; tmp2   &lt;br /&gt;
 # TODO: whenever FIRSTFRAME is used below, it should be copied to tmp2 (using IFS as above), and tmp2 should be used instead&lt;br /&gt;
 # this was done for &amp;quot;mccd&amp;quot;, but still has to be done for the &amp;quot;raxis&amp;quot; detector types&lt;br /&gt;
 # the reason is that FIRSTFRAME may contain a blank, which makes some commands fail                                                &lt;br /&gt;
 egrep -qi &#039;marccd|Corrected&#039; tmp2 &amp;amp;&amp;amp; DET=mccd                                 &lt;br /&gt;
 grep -q PILATUS tmp2             &amp;amp;&amp;amp; DET=pilatus                              &lt;br /&gt;
 head -n1 tmp2 | grep -q &amp;quot;^RAXIS&amp;quot; &amp;amp;&amp;amp; DET=raxis&lt;br /&gt;
 head -n1 tmp2 | grep -q &amp;quot;^R-AXIS&amp;quot; &amp;amp;&amp;amp; DET=raxis&lt;br /&gt;
 grep -q &amp;quot;^SOURCE_WAVELENGTH= *1&amp;quot; tmp2 &amp;amp;&amp;amp; DET=dtrek&lt;br /&gt;
 grep -q BEAM_CENTER_X tmp2       &amp;amp;&amp;amp; DET=adsc                                 &lt;br /&gt;
 grep -q mar345 tmp2		 &amp;amp;&amp;amp; DET=MAR345                         &lt;br /&gt;
else&lt;br /&gt;
 h5dump -d &amp;quot;/entry/instrument/detector/description&amp;quot; $FIRSTFRAME | grep -i Eiger &amp;gt; /dev/null &amp;amp;&amp;amp; DET=eiger&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# identify other detector types in the same way &lt;br /&gt;
&lt;br /&gt;
# parse ASCII header of first frame&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$DET&amp;quot; == &amp;quot;XXX&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;this is not a MAR, ADSC/SMV or PILATUS detector - fill in XXX values manually!&amp;quot;&lt;br /&gt;
  DETECTOR=&amp;quot;XXX MINIMUM_VALID_PIXEL_VALUE=XXX OVERLOAD=XXX&amp;quot;                            &lt;br /&gt;
&lt;br /&gt;
# find parameters of first frame&lt;br /&gt;
elif [ &amp;quot;$DET&amp;quot; == &amp;quot;mccd&amp;quot; ]; then &lt;br /&gt;
  echo Data from a MarCCD detector&lt;br /&gt;
                                  &lt;br /&gt;
  DETECTOR=&amp;quot;CCDCHESS MINIMUM_VALID_PIXEL_VALUE= 1 OVERLOAD= 65500&amp;quot;&lt;br /&gt;
  SENSOR_THICKNESS=0.01                                           &lt;br /&gt;
  # use first frame of dataset to obtain parameters               &lt;br /&gt;
&lt;br /&gt;
  # Check detector serial number and recognize beamline for reversed-phi setting.&lt;br /&gt;
  # Known detectors for reversed-phi in SPring-8: 24: BL26B2 Mar225, 31: BL32XU MX225HE, 38: BL44XU MX225HE, 42: BL44XU MX300HE, 40: BL41XU MX225HE, 106: BL32XU MX225HS&lt;br /&gt;
  REVERSEPHI_SNs=&amp;quot;&lt;br /&gt;
24&lt;br /&gt;
31&lt;br /&gt;
38&lt;br /&gt;
40&lt;br /&gt;
42&lt;br /&gt;
106&lt;br /&gt;
&amp;quot;&lt;br /&gt;
  # get detector serial number and check if it is included in the list&lt;br /&gt;
  DET_SN=`grep &amp;quot;Detector Serial Number =&amp;quot; tmp2 | sed &amp;quot;s/Detector Serial Number = //&amp;quot;`&lt;br /&gt;
  if echo &amp;quot;${DET_SN}${REVERSEPHI_SNs}&amp;quot; | sort | uniq -d | grep [0-9] &amp;gt; /dev/null; then&lt;br /&gt;
    REVERSE_PHI=&amp;quot;yes&amp;quot;&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  # offsets are documented; values can be found in mccd_xdsparams.pl script&lt;br /&gt;
  IFS=$&#039;\n&#039;&lt;br /&gt;
  cp $FIRSTFRAME tmp2&lt;br /&gt;
  unset IFS&lt;br /&gt;
  let SKIP=1024+80                                                        &lt;br /&gt;
  NX=$(od -t dI -j $SKIP -N 4 tmp2 | head -1 | awk &#039;{print $2}&#039;)&lt;br /&gt;
  let SKIP=$SKIP+4                                                                         &lt;br /&gt;
  NY=$(od -t dI -j $SKIP -N 4 tmp2 | head -1 | awk &#039;{print $2}&#039;)&lt;br /&gt;
&lt;br /&gt;
  let SKIP=1720&lt;br /&gt;
  DETECTOR_DISTANCE=$(od -t dI -j $SKIP -N 4 tmp2 | head -1 | awk &#039;{print $2}&#039;)&lt;br /&gt;
  DETECTOR_DISTANCE=`echo &amp;quot;scale=3; $DETECTOR_DISTANCE/1000&amp;quot; | bc -l`                                     &lt;br /&gt;
                                                                                                          &lt;br /&gt;
  let SKIP=1024+256+128+256+4                                                                             &lt;br /&gt;
  ORGX=$(od -t dI -j $SKIP -N 4 tmp2 | head -1 | awk &#039;{print $2}&#039;)             &lt;br /&gt;
  ORGX=`echo &amp;quot;scale=2; $ORGX/1000&amp;quot; | bc -l `                                                              &lt;br /&gt;
  let SKIP=$SKIP+4                                                                                        &lt;br /&gt;
  ORGY=$(od -t dI -j $SKIP -N 4 tmp2 | head -1 | awk &#039;{print $2}&#039;)             &lt;br /&gt;
  ORGY=`echo &amp;quot;scale=2; $ORGY/1000&amp;quot; | bc -l `                                                              &lt;br /&gt;
# FIXME 25.5.2015: reverse ORGX and ORGY for BM14 @ ESRF (no serial number in header)&lt;br /&gt;
&lt;br /&gt;
  let SKIP=1024+736&lt;br /&gt;
  OSCILLATION_RANGE=$(od -t dI -j $SKIP -N 4 tmp2 | head -1 | awk &#039;{print $2}&#039;) &lt;br /&gt;
  OSCILLATION_RANGE=`echo &amp;quot;scale=3; $OSCILLATION_RANGE/1000&amp;quot; | bc -l`   &lt;br /&gt;
                                                                                                 &lt;br /&gt;
  let SKIP=1024+256+128+256+128+4                                                                &lt;br /&gt;
  QX=$(od -t dI -j $SKIP -N 4 tmp2 | head -1 | awk &#039;{print $2}&#039;)      &lt;br /&gt;
  QX=`echo &amp;quot;scale=10; $QX/1000000&amp;quot; |bc -l `                                                      &lt;br /&gt;
  let SKIP=$SKIP+4                                                                               &lt;br /&gt;
  QY=$(od -t dI -j $SKIP -N 4 tmp2 | head -1 | awk &#039;{print $2}&#039;)      &lt;br /&gt;
  QY=`echo &amp;quot;scale=10; $QY/1000000&amp;quot; |bc -l `                                                      &lt;br /&gt;
&lt;br /&gt;
  let SKIP=1024+256+128+256+128+128+12&lt;br /&gt;
  X_RAY_WAVELENGTH=$(od -t dI -j $SKIP -N 4 tmp2 | head -1 | awk &#039;{print $2}&#039;)&lt;br /&gt;
  X_RAY_WAVELENGTH=`echo &amp;quot;scale=5; $X_RAY_WAVELENGTH/100000&amp;quot; | bc -l`                                    &lt;br /&gt;
&lt;br /&gt;
# at most BLs, ORGX and ORGY are in pixels, but sometimes in mm ... guess:&lt;br /&gt;
  NXBYFOUR=`echo &amp;quot;scale=0; $NX/4&amp;quot; | bc -l `                               &lt;br /&gt;
  ORGXINT=`echo &amp;quot;scale=0; $ORGX/1&amp;quot; | bc -l `                              &lt;br /&gt;
  if [ $ORGXINT -lt $NXBYFOUR ]; then                                     &lt;br /&gt;
     ORGX=`echo &amp;quot;scale=1; $ORGX/$QX&amp;quot; | bc -l`                             &lt;br /&gt;
     ORGY=`echo &amp;quot;scale=1; $ORGY/$QY&amp;quot; | bc -l`                             &lt;br /&gt;
     echo MARCCD detector: header ORGX, ORGY seem to be in mm ... converting to pixels&lt;br /&gt;
  else                                                                                &lt;br /&gt;
     echo MARCCD detector: header ORGX, ORGY seem to be in pixel units                &lt;br /&gt;
  fi                                                                                  &lt;br /&gt;
&lt;br /&gt;
elif [ &amp;quot;$DET&amp;quot; == &amp;quot;adsc&amp;quot; ]; then&lt;br /&gt;
&lt;br /&gt;
  DETECTOR=&amp;quot;ADSC MINIMUM_VALID_PIXEL_VALUE= 1 OVERLOAD= 65000&amp;quot;&lt;br /&gt;
  echo Data from ADSC detector. Obtaining ORGX, ORGY depends on beamline setup:&lt;br /&gt;
  SENSOR_THICKNESS=0.01                                                        &lt;br /&gt;
  sed s/\;// tmp2 &amp;gt; tmp1                                                       &lt;br /&gt;
  mv tmp1 tmp2                                                                 &lt;br /&gt;
&lt;br /&gt;
      # find X_RAY_WAVELENGTH:&lt;br /&gt;
      X_RAY_WAVELENGTH=`grep WAVELENGTH tmp2 | head -1 | sed s/WAVELENGTH=//`&lt;br /&gt;
&lt;br /&gt;
      # find NX, QX, ORGX and ORGY:&lt;br /&gt;
      NX=`grep SIZE1 tmp2 | tail -1 | sed s/SIZE1=//`&lt;br /&gt;
      QX=`grep PIXEL_SIZE tmp2 | sed s/PIXEL_SIZE=//`&lt;br /&gt;
# FIXME - next 2 lines should be done properly, from header&lt;br /&gt;
      NY=$NX                                               &lt;br /&gt;
      QY=$QX                                               &lt;br /&gt;
      BEAM_CENTER_X=`grep BEAM_CENTER_X tmp2 | sed s/BEAM_CENTER_X=//`&lt;br /&gt;
      BEAM_CENTER_Y=`grep BEAM_CENTER_Y tmp2 | sed s/BEAM_CENTER_Y=//`&lt;br /&gt;
# fix 2010-04-26 - tell user about possible ORGX, ORGY alternatives -  &lt;br /&gt;
      COMMENT_ORGXY=&amp;quot;&lt;br /&gt;
! Following are possible beam center interpretations for ADSC detectors&amp;quot;&lt;br /&gt;
# at ESRF, PF, ALS 5.0.2 and ... (pls fill in!) the following should be used:         &lt;br /&gt;
      ORGX1=`echo &amp;quot;scale=1; $BEAM_CENTER_Y/$QX&amp;quot; | bc -l`&lt;br /&gt;
      ORGY1=`echo &amp;quot;scale=1; $BEAM_CENTER_X/$QX&amp;quot; | bc -l`&lt;br /&gt;
      echo - at ESRF, PF, APS Argonne BLs use: ORGX=$ORGX1 ORGY=$ORGY1                    &lt;br /&gt;
      COMMENT_ORGXY=&amp;quot;${COMMENT_ORGXY}&lt;br /&gt;
! ORGX= $ORGX1 ORGY= $ORGY1 ! For ESRF, PF, APS Argonne ...&amp;quot;&lt;br /&gt;
# this 2nd alternative convention should be used at the following beamlines (pls complete the list): ALS 5.0.3, ...&lt;br /&gt;
      ORGX2=`echo &amp;quot;scale=1; $NX-$BEAM_CENTER_X/$QX&amp;quot; | bc -l `&lt;br /&gt;
      ORGY2=`echo &amp;quot;scale=1; $BEAM_CENTER_Y/$QX&amp;quot; | bc -l `&lt;br /&gt;
      echo - at e.g. ALS 5.0.3 use: ORGX=$ORGX2 ORGY=$ORGY2                                                          &lt;br /&gt;
      COMMENT_ORGXY=&amp;quot;${COMMENT_ORGXY}&lt;br /&gt;
! ORGX= $ORGX2 ORGY= $ORGY2 ! For ALS 5.0.3,..&amp;quot;&lt;br /&gt;
# this 3rd alternative convention should be used at the following beamlines (pls complete the list): ALS 8.2.2, ... &lt;br /&gt;
# this alternative is written into the generated XDS.INP ! You have to correct this manually in XDS.INP, or adjust this script.&lt;br /&gt;
      ORGX3=`echo &amp;quot;scale=1; $BEAM_CENTER_X/$QX&amp;quot; | bc -l `&lt;br /&gt;
      ORGY3=`echo &amp;quot;scale=1; $NX-$BEAM_CENTER_Y/$QX&amp;quot; | bc -l `&lt;br /&gt;
      echo - at e.g. ALS 8.2.2 use: ORGX=$ORGX3 ORGY=$ORGY3 - this is written to XDS.INP if beamline is not detected&lt;br /&gt;
      COMMENT_ORGXY=&amp;quot;${COMMENT_ORGXY}&lt;br /&gt;
! ORGX= $ORGX3 ORGY= $ORGY3 ! For ALS 8.2.2,..&amp;quot;&lt;br /&gt;
# this 4th alternative convention should be used at the following beamlines (pls complete the list): SPring-8, ...&lt;br /&gt;
      ORGX4=`echo &amp;quot;scale=1; $BEAM_CENTER_X/$QX&amp;quot; | bc -l `&lt;br /&gt;
      ORGY4=`echo &amp;quot;scale=1; $BEAM_CENTER_Y/$QX&amp;quot; | bc -l `&lt;br /&gt;
      echo - at e.g. SPring-8 use: ORGX=$ORGX4 ORGY=$ORGY4 &lt;br /&gt;
      COMMENT_ORGXY=&amp;quot;${COMMENT_ORGXY}&lt;br /&gt;
! ORGX= $ORGX4 ORGY= $ORGY4 ! For SPring-8,..&amp;quot;&lt;br /&gt;
&lt;br /&gt;
      # Decision of beam center convention based on detector serial numbers.&lt;br /&gt;
      DET_SN=`grep DETECTOR_SN tmp2 | sed -e &amp;quot;s/DETECTOR_SN=//&amp;quot;`&lt;br /&gt;
      # For convention 1; Known PF detectors = 449: NW12A Q210, 472: NE3A Q270, 474: BL17A Q270, 912: BL5A Q315, 923: ALS BL5.0.2 Q315, 933: AichiSR BL2S1 Q315&lt;br /&gt;
      ORG1_SNs=&amp;quot;&lt;br /&gt;
449&lt;br /&gt;
472&lt;br /&gt;
474&lt;br /&gt;
912&lt;br /&gt;
923&lt;br /&gt;
933&lt;br /&gt;
911&lt;br /&gt;
446&lt;br /&gt;
&amp;quot;&lt;br /&gt;
      ORG4_SNs=&amp;quot;&lt;br /&gt;
915&lt;br /&gt;
&amp;quot;&lt;br /&gt;
      if echo &amp;quot;${DET_SN}${ORG1_SNs}&amp;quot; | sort | uniq -d | grep [0-9] &amp;gt; /dev/null; then&lt;br /&gt;
       ORGX=$ORGX1&lt;br /&gt;
       ORGY=$ORGY1&lt;br /&gt;
      elif echo &amp;quot;${DET_SN}${ORG4_SNs}&amp;quot; | sort | uniq -d | grep [0-9] &amp;gt; /dev/null; then&lt;br /&gt;
       ORGX=$ORGX4&lt;br /&gt;
       ORGY=$ORGY4&lt;br /&gt;
      else&lt;br /&gt;
       ORGX=$ORGX3&lt;br /&gt;
       ORGY=$ORGY3&lt;br /&gt;
      fi&lt;br /&gt;
&lt;br /&gt;
      # Check detector serial number and recognize beamline for reversed-phi setting.&lt;br /&gt;
      # Known detectors for reversed-phi in SPring-8: 915: BL38B1 Q315; APS 19-ID: 458&lt;br /&gt;
      REVERSEPHI_SNs=&amp;quot;&lt;br /&gt;
915&lt;br /&gt;
458&lt;br /&gt;
&amp;quot;&lt;br /&gt;
      if echo &amp;quot;${DET_SN}${REVERSEPHI_SNs}&amp;quot; | sort | uniq -d | grep [0-9] &amp;gt; /dev/null; then&lt;br /&gt;
        REVERSE_PHI=&amp;quot;yes&amp;quot;&lt;br /&gt;
      fi&lt;br /&gt;
&lt;br /&gt;
      # find DETECTOR_DISTANCE and OSCILLATION_RANGE:                                                                                &lt;br /&gt;
      DETECTOR_DISTANCE=`grep ^DISTANCE tmp2 | sed s/DISTANCE=//`                                                                     &lt;br /&gt;
      OSCILLATION_RANGE=`grep OSC_RANGE tmp2 | sed s/OSC_RANGE=//`                                                                   &lt;br /&gt;
&lt;br /&gt;
elif [ &amp;quot;$DET&amp;quot; == &amp;quot;pilatus&amp;quot; ]; then&lt;br /&gt;
  DETECTOR=&amp;quot;PILATUS MINIMUM_VALID_PIXEL_VALUE=0 OVERLOAD= 1048576  !PILATUS&amp;quot;&lt;br /&gt;
  QX=0.172 QY=0.172                                                         &lt;br /&gt;
  echo Data from a Pilatus detector                                         &lt;br /&gt;
  sed s/#// tmp2 &amp;gt; tmp1                                                     &lt;br /&gt;
  mv tmp1 tmp2                                                              &lt;br /&gt;
&lt;br /&gt;
      # find SENSOR_THICKNESS:&lt;br /&gt;
      SENSOR_THICKNESS=`grep thickness tmp2 | sed -e s/&#039;Silicon sensor, thickness&#039;// | awk &#039;{print $1*1000}&#039;`&lt;br /&gt;
      # find X_RAY_WAVELENGTH:                                                                               &lt;br /&gt;
      X_RAY_WAVELENGTH=`grep Wavelength tmp2 | sed -e s/Wavelength// -e s/A// | awk &#039;{print $1}&#039;`            &lt;br /&gt;
&lt;br /&gt;
      # find NX and NY; 2463/2527 is 6M, 1475/1679 is 2M&lt;br /&gt;
      NX=`grep X-Binary-Size-Fastest-Dimension tmp2 | awk &#039;{print $2}&#039;`&lt;br /&gt;
      NY=`grep X-Binary-Size-Second-Dimension tmp2 | awk &#039;{print $2}&#039;` &lt;br /&gt;
&lt;br /&gt;
      # find ORGX and ORGY:&lt;br /&gt;
      ORGX=`grep Beam_xy tmp2 | sed -e s/\(// -e s/\)// -e s/\,// | awk &#039;{print $2}&#039;`&lt;br /&gt;
      ORGY=`grep Beam_xy tmp2 | sed -e s/\(// -e s/\)// -e s/\,// | awk &#039;{print $3}&#039;`&lt;br /&gt;
&lt;br /&gt;
      # find DETECTOR_DISTANCE and OSCILLATION_RANGE:&lt;br /&gt;
      DETECTOR_DISTANCE=`awk &#039;/distance/{print $2}&#039; tmp2`&lt;br /&gt;
      DETECTOR_DISTANCE=`echo &amp;quot;$DETECTOR_DISTANCE*1000&amp;quot; | bc -l`&lt;br /&gt;
&lt;br /&gt;
      OSCILLATION_RANGE=`awk &#039;/Angle/{print $2}&#039; tmp2`&lt;br /&gt;
&lt;br /&gt;
      # get detector serial number and check if it is included in the list&lt;br /&gt;
      # Known detectors for reversed-phi in SPring-8: BL41XU PILATUS3 6M 60-0125&lt;br /&gt;
      DET_SN=`grep &amp;quot;Detector:&amp;quot; tmp2 | sed &amp;quot;s/^.*Detector: *//&amp;quot;`&lt;br /&gt;
      REVERSEPHI_SNs=&amp;quot;&lt;br /&gt;
PILATUS3 6M, S/N 60-0125&lt;br /&gt;
&amp;quot;&lt;br /&gt;
      if echo &amp;quot;${DET_SN}${REVERSEPHI_SNs}&amp;quot; | sort | uniq -d | grep [0-9] &amp;gt; /dev/null; then&lt;br /&gt;
        REVERSE_PHI=&amp;quot;yes&amp;quot;&lt;br /&gt;
      fi&lt;br /&gt;
&lt;br /&gt;
elif [ &amp;quot;$DET&amp;quot; == &amp;quot;eiger&amp;quot; ]; then&lt;br /&gt;
  OVERLOAD=`h5dump -d &amp;quot;/entry/instrument/detector/detectorSpecific/countrate_correction_count_cutoff&amp;quot; $FIRSTFRAME | awk &#039;/\(0\):/{print $2}&#039; `&lt;br /&gt;
  DETECTOR=&amp;quot;EIGER MINIMUM_VALID_PIXEL_VALUE=0 OVERLOAD= $OVERLOAD  !EIGER&amp;quot;&lt;br /&gt;
  QX=`h5dump -d &amp;quot;/entry/instrument/detector/x_pixel_size&amp;quot; $FIRSTFRAME | awk &#039;/\(0\): [0-9]/{print $2*1000}&#039;`&lt;br /&gt;
  QY=`h5dump -d &amp;quot;/entry/instrument/detector/y_pixel_size&amp;quot; $FIRSTFRAME | awk &#039;/\(0\): [0-9]/{print $2*1000}&#039;`&lt;br /&gt;
&lt;br /&gt;
  echo Data from a Eiger hdf5&lt;br /&gt;
      SENSOR_THICKNESS=`h5dump -d &amp;quot;/entry/instrument/detector/sensor_thickness&amp;quot; $FIRSTFRAME | awk &#039;/\(0\): [0-9]/{print $2*1000}&#039;`&lt;br /&gt;
      X_RAY_WAVELENGTH=`h5dump -d &amp;quot;/entry/instrument/beam/incident_wavelength&amp;quot; $FIRSTFRAME | awk &#039;/\(0\): [0-9]/{print $2}&#039;`&lt;br /&gt;
&lt;br /&gt;
      NX=`h5dump -d &amp;quot;/entry/instrument/detector/detectorSpecific/x_pixels_in_detector&amp;quot; $FIRSTFRAME | awk &#039;/\(0\): [0-9]/{print $2}&#039;`&lt;br /&gt;
      NY=`h5dump -d &amp;quot;/entry/instrument/detector/detectorSpecific/y_pixels_in_detector&amp;quot; $FIRSTFRAME | awk &#039;/\(0\): [0-9]/{print $2}&#039;`&lt;br /&gt;
&lt;br /&gt;
      # find ORGX and ORGY:&lt;br /&gt;
      ORGX=`h5dump -d &amp;quot;/entry/instrument/detector/beam_center_x&amp;quot; $FIRSTFRAME | awk &#039;/\(0\): [0-9]/{print $2}&#039;`&lt;br /&gt;
      ORGY=`h5dump -d &amp;quot;/entry/instrument/detector/beam_center_y&amp;quot; $FIRSTFRAME | awk &#039;/\(0\): [0-9]/{print $2}&#039;`&lt;br /&gt;
&lt;br /&gt;
      # find DETECTOR_DISTANCE and OSCILLATION_RANGE:&lt;br /&gt;
      DETECTOR_DISTANCE=`h5dump -d &amp;quot;/entry/instrument/detector/detector_distance&amp;quot; $FIRSTFRAME | awk &#039;/\(0\): [0-9]/{print $2*1000}&#039;`&lt;br /&gt;
      OSCILLATION_RANGE=`h5dump -d &amp;quot;/entry/sample/goniometer/omega_range_average&amp;quot; $FIRSTFRAME | awk &#039;/\(0\): [0-9]/{print $2}&#039;`&lt;br /&gt;
&lt;br /&gt;
      # If rotation vector set (NeXus)&lt;br /&gt;
      rotation_axis=`h5dump -a &amp;quot;/entry/sample/transformations/omega/vector&amp;quot; $FIRSTFRAME | grep &amp;quot;(0):&amp;quot; | sed -e &amp;quot;s/^.*://; s/,//g&amp;quot;`&lt;br /&gt;
  &lt;br /&gt;
elif [ &amp;quot;$DET&amp;quot; == &amp;quot;raxis&amp;quot; ]; then&lt;br /&gt;
  echo Data from a RAXIS detector&lt;br /&gt;
&lt;br /&gt;
  DETECTOR=&amp;quot;RAXIS MINIMUM_VALID_PIXEL_VALUE=0  OVERLOAD=2000000&amp;quot;&lt;br /&gt;
  #let SKIP=768&lt;br /&gt;
  #NX=$(od -t x -j $SKIP -N 4 $FIRSTFRAME |awk &#039;NR==1{print toupper($2)}&#039;|perl -nle &#039;@array= $_ =~/.{2}/g; print &amp;quot;ibase=16;obase=A;&amp;quot;.join(&amp;quot;&amp;quot;,reverse @array)&#039;|bc)&lt;br /&gt;
  NX=$(python -c &#039;import struct; f=open(&amp;quot;&#039;$FIRSTFRAME&#039;&amp;quot;,&amp;quot;rb&amp;quot;);f.seek(768);print &amp;quot;%.4d&amp;quot;%struct.unpack(&amp;quot;&amp;gt;i&amp;quot;,f.read(4))&#039;)&lt;br /&gt;
  NY=$(python -c &#039;import struct; f=open(&amp;quot;&#039;$FIRSTFRAME&#039;&amp;quot;,&amp;quot;rb&amp;quot;);f.seek(772);print &amp;quot;%.4d&amp;quot;%struct.unpack(&amp;quot;&amp;gt;i&amp;quot;,f.read(4))&#039;)&lt;br /&gt;
&lt;br /&gt;
  DETECTOR_DISTANCE=$(python -c &#039;import struct; f=open(&amp;quot;&#039;$FIRSTFRAME&#039;&amp;quot;,&amp;quot;rb&amp;quot;);f.seek(344);print &amp;quot;-%.4f&amp;quot;%struct.unpack(&amp;quot;&amp;gt;f&amp;quot;,f.read(4))&#039;)&lt;br /&gt;
&lt;br /&gt;
  ORGX=$(python -c &#039;import struct; f=open(&amp;quot;&#039;$FIRSTFRAME&#039;&amp;quot;,&amp;quot;rb&amp;quot;);f.seek(540);print &amp;quot;%.4f&amp;quot;%struct.unpack(&amp;quot;&amp;gt;f&amp;quot;,f.read(4))&#039;)&lt;br /&gt;
  ORGY=$(python -c &#039;import struct; f=open(&amp;quot;&#039;$FIRSTFRAME&#039;&amp;quot;,&amp;quot;rb&amp;quot;);f.seek(544);print &amp;quot;%.4f&amp;quot;%struct.unpack(&amp;quot;&amp;gt;f&amp;quot;,f.read(4))&#039;)&lt;br /&gt;
&lt;br /&gt;
  OSCILLATION_RANGE=$(python -c &#039;import struct; f=open(&amp;quot;&#039;$FIRSTFRAME&#039;&amp;quot;,&amp;quot;rb&amp;quot;);f.seek(524);phis,phie=struct.unpack(&amp;quot;&amp;gt;ff&amp;quot;,f.read(8));print &amp;quot;%.4f&amp;quot;%(phie-phis)&#039;)&lt;br /&gt;
&lt;br /&gt;
  QX=$(python -c &#039;import struct; f=open(&amp;quot;&#039;$FIRSTFRAME&#039;&amp;quot;,&amp;quot;rb&amp;quot;);f.seek(776);print &amp;quot;%.6f&amp;quot;%struct.unpack(&amp;quot;&amp;gt;f&amp;quot;,f.read(4))&#039;)&lt;br /&gt;
  QY=$(python -c &#039;import struct; f=open(&amp;quot;&#039;$FIRSTFRAME&#039;&amp;quot;,&amp;quot;rb&amp;quot;);f.seek(780);print &amp;quot;%.6f&amp;quot;%struct.unpack(&amp;quot;&amp;gt;f&amp;quot;,f.read(4))&#039;)&lt;br /&gt;
&lt;br /&gt;
  X_RAY_WAVELENGTH=$(python -c &#039;import struct; f=open(&amp;quot;&#039;$FIRSTFRAME&#039;&amp;quot;,&amp;quot;rb&amp;quot;);f.seek(292);print &amp;quot;%.6f&amp;quot;%struct.unpack(&amp;quot;&amp;gt;f&amp;quot;,f.read(4))&#039;)&lt;br /&gt;
&lt;br /&gt;
elif [ &amp;quot;$DET&amp;quot; == &amp;quot;dtrek&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;Data from a RAXIS or Saturn detector with dTREK format&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  sed s/\;// tmp2 &amp;gt; tmp1&lt;br /&gt;
  mv tmp1 tmp2&lt;br /&gt;
&lt;br /&gt;
  dname=`grep &amp;quot;DETECTOR_NAMES=&amp;quot; tmp2 | sed -e &amp;quot;s/.*=//&amp;quot;`&lt;br /&gt;
&lt;br /&gt;
  if [ &amp;quot;$dname&amp;quot; == &amp;quot;CCD_&amp;quot; ]; then&lt;br /&gt;
    DETECTOR=&amp;quot;SATURN MINIMUM_VALID_PIXEL_VALUE=1&amp;quot;&lt;br /&gt;
    dtrek_det=&amp;quot;saturn&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # Find rotation axis. Warning: currently not support flipping (det(tmpmat)&amp;lt;0)&lt;br /&gt;
    # I&#039;m not sure this method is really valid - but at least mosflm seems to read this to determine rotation axis.&lt;br /&gt;
    tmpmat=(`grep ${dname}SPATIAL_DISTORTION_VECTORS= tmp2 | tail -1 | sed -e &amp;quot;s/.*=//&amp;quot;`)&lt;br /&gt;
    rotx=`echo &amp;quot;scale=6; -1.0*${tmpmat[0]}&amp;quot; | bc -l`&lt;br /&gt;
    roty=`echo &amp;quot;scale=6; -1.0*${tmpmat[1]}&amp;quot; | bc -l`&lt;br /&gt;
    rotation_axis=&amp;quot;$rotx $roty 0&amp;quot;&lt;br /&gt;
   if [ `echo &amp;quot;(${tmpmat[0]}*${tmpmat[3]}-(${tmpmat[1]}*${tmpmat[2]}))/1&amp;quot;|bc` -lt 0 ]; then&lt;br /&gt;
    echo &amp;quot;&amp;quot;&lt;br /&gt;
    echo &amp;quot;WARNING!! not-supported SPATIAL_DISTORTION_VECTORS header detected.&amp;quot;&lt;br /&gt;
    echo &amp;quot;Please report this to XDSwiki author.&amp;quot;&lt;br /&gt;
    echo &amp;quot;&amp;quot;&lt;br /&gt;
   fi&lt;br /&gt;
  else # should be RX_&lt;br /&gt;
    DETECTOR=&amp;quot;RAXIS MINIMUM_VALID_PIXEL_VALUE=0&amp;quot;&lt;br /&gt;
    dtrek_det=&amp;quot;raxis&amp;quot;&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  # find OVERLOAD&lt;br /&gt;
  SATURATED_VALUE=`grep SATURATED_VALUE tmp2 | head -1 | sed s/SATURATED_VALUE=//`&lt;br /&gt;
  DETECTOR=&amp;quot;${DETECTOR}  OVERLOAD=${SATURATED_VALUE}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  # find X_RAY_WAVELENGTH:&lt;br /&gt;
  X_RAY_WAVELENGTH=(`grep SOURCE_WAVELENGTH tmp2 | head -1 | sed s/SOURCE_WAVELENGTH=//`)&lt;br /&gt;
  X_RAY_WAVELENGTH=${X_RAY_WAVELENGTH[1]}&lt;br /&gt;
&lt;br /&gt;
  # find NX,NY,QX,QY&lt;br /&gt;
  # NX,NY should be read from *_DETECTOR_DIMENSIONS?&lt;br /&gt;
  NX=`grep SIZE1 tmp2 | tail -1 | sed s/SIZE1=//`&lt;br /&gt;
  NY=`grep SIZE2 tmp2 | tail -1 | sed s/SIZE2=//`&lt;br /&gt;
  DET_SIZE=(`grep ${dname}DETECTOR_SIZE tmp2 | tail -1 | sed s/.*_DETECTOR_SIZE=//`)&lt;br /&gt;
  QX=`echo &amp;quot;scale=6; ${DET_SIZE[0]} / $NX&amp;quot; | bc -l`&lt;br /&gt;
  QY=`echo &amp;quot;scale=6; ${DET_SIZE[1]} / $NY&amp;quot; | bc -l`&lt;br /&gt;
&lt;br /&gt;
  # find ORGX, ORGY&lt;br /&gt;
  SPATIAL_DISTORTION_INFO=(`grep ${dname}SPATIAL_DISTORTION_INFO tmp2 | tail -1 | sed s/.*_SPATIAL_DISTORTION_INFO=//`)&lt;br /&gt;
  ORGX=${SPATIAL_DISTORTION_INFO[0]}&lt;br /&gt;
  ORGY=${SPATIAL_DISTORTION_INFO[1]}&lt;br /&gt;
&lt;br /&gt;
  # find DETECTOR_DISTANCE &lt;br /&gt;
  GONIO_NAMES=(`grep ${dname}GONIO_NAMES= tmp2 | tail -1 | sed s/.*_GONIO_NAMES=//`)&lt;br /&gt;
  GONIO_VALUES=(`grep ${dname}GONIO_VALUES= tmp2 | tail -1 | sed s/.*_GONIO_VALUES=//`)&lt;br /&gt;
  GONIO_UNITS=(`grep ${dname}GONIO_UNITS= tmp2 | tail -1 | sed s/.*_GONIO_UNITS=//`)&lt;br /&gt;
  for i in `seq 1 ${#GONIO_NAMES[*]}`&lt;br /&gt;
  do&lt;br /&gt;
   idx=$((i-1))&lt;br /&gt;
   if [ &amp;quot;${GONIO_NAMES[$idx]}&amp;quot; == &amp;quot;Distance&amp;quot; ]; then&lt;br /&gt;
    DETECTOR_DISTANCE=&amp;quot;-${GONIO_VALUES[$idx]}&amp;quot;&lt;br /&gt;
    # TODO: Check unit!! - ${GONIO_UNITS[$idx]}&lt;br /&gt;
   fi&lt;br /&gt;
  done&lt;br /&gt;
&lt;br /&gt;
  # find OSCILLATION_RANGE&lt;br /&gt;
  ROTATION=(`grep &amp;quot;^ROTATION=&amp;quot; tmp2 | tail -1 | sed s/ROTATION=//`)&lt;br /&gt;
  OSCILLATION_RANGE=${ROTATION[2]}&lt;br /&gt;
&lt;br /&gt;
elif [ &amp;quot;$DET&amp;quot; == &amp;quot;MAR345&amp;quot; ]; then&lt;br /&gt;
  &lt;br /&gt;
 echo  &amp;quot;Data from a Mar345 image plate detector&amp;quot;&lt;br /&gt;
 DETECTOR=&amp;quot;MAR345  MINIMUM_VALID_PIXEL_VALUE=0  OVERLOAD=130000&amp;quot;&lt;br /&gt;
 NX=`awk &#039;/FORMAT/{print $2}&#039; tmp2`&lt;br /&gt;
 NY=$NX&lt;br /&gt;
 QX=`awk &#039;/PIXEL/{print $3/1000.}&#039; tmp2`&lt;br /&gt;
 QY=`awk &#039;/PIXEL/{print $5/1000.}&#039; tmp2`&lt;br /&gt;
 if grep -q &#039;CENTER&#039; tmp2; then&lt;br /&gt;
   echo Beam center found.&lt;br /&gt;
   ORGX=`grep &#039;CENTER&#039; tmp2 | awk &#039;{print $3}&#039;`&lt;br /&gt;
   ORGY=`grep &#039;CENTER&#039; tmp2 | awk &#039;{print $5}&#039;`&lt;br /&gt;
 else&lt;br /&gt;
   echo No beam center was found. Setting beam center to the middle of the detector.&lt;br /&gt;
   ORGX=`echo $NX / 2 | bc`&lt;br /&gt;
   ORGY=`echo $NY / 2 | bc`&lt;br /&gt;
 fi&lt;br /&gt;
 DETECTOR_DISTANCE=`grep &#039;DISTANCE&#039; tmp2 | awk &#039;{print $2}&#039;`               &lt;br /&gt;
 X_RAY_WAVELENGTH=`grep &#039;WAVELENGTH&#039; tmp2 | awk &#039;{print $2}&#039;` &lt;br /&gt;
 OSCILLATION_RANGE=`grep &#039;PHI&#039; tmp2 | awk &#039;{print $5-$3}&#039;`    &lt;br /&gt;
 TRUSTED_REGION=&amp;quot;0 0.99&amp;quot;        &lt;br /&gt;
else&lt;br /&gt;
  echo should never come here&lt;br /&gt;
  exit 1                     &lt;br /&gt;
fi                           &lt;br /&gt;
&lt;br /&gt;
echo ORGX= $ORGX ORGY= $ORGY - check these values with adxv !&lt;br /&gt;
echo DETECTOR_DISTANCE= $DETECTOR_DISTANCE                   &lt;br /&gt;
echo OSCILLATION_RANGE= $OSCILLATION_RANGE                   &lt;br /&gt;
echo X-RAY_WAVELENGTH= $X_RAY_WAVELENGTH                     &lt;br /&gt;
&lt;br /&gt;
# now we know everything that is required to generate XDS.INP&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; XDS.INP &amp;lt;&amp;lt; eof&lt;br /&gt;
! written by generate_XDS.INP version $REVISION&lt;br /&gt;
JOB= XYCORR INIT COLSPOT IDXREF DEFPIX INTEGRATE CORRECT&lt;br /&gt;
ORGX= $ORGX ORGY= $ORGY  ! check these values with adxv !\&lt;br /&gt;
$COMMENT_ORGXY&lt;br /&gt;
DETECTOR_DISTANCE= $DETECTOR_DISTANCE                    &lt;br /&gt;
OSCILLATION_RANGE= $OSCILLATION_RANGE                    &lt;br /&gt;
X-RAY_WAVELENGTH= $X_RAY_WAVELENGTH                      &lt;br /&gt;
NAME_TEMPLATE_OF_DATA_FRAMES=$NAME_TEMPLATE_OF_DATA_FRAMES&lt;br /&gt;
! REFERENCE_DATA_SET=xxx/XDS_ASCII.HKL ! e.g. to ensure consistent indexing  &lt;br /&gt;
DATA_RANGE=$DATA_RANGE                                                     &lt;br /&gt;
SPOT_RANGE=$SPOT_RANGE                                                     &lt;br /&gt;
! BACKGROUND_RANGE=1 10 ! rather use defaults (first 5 degree of rotation)   &lt;br /&gt;
&lt;br /&gt;
SPACE_GROUP_NUMBER=0                   ! 0 if unknown&lt;br /&gt;
UNIT_CELL_CONSTANTS= 70 80 90 90 90 90 ! put correct values if known&lt;br /&gt;
INCLUDE_RESOLUTION_RANGE=50 0  ! after CORRECT, insert high resol limit; re-run CORRECT&lt;br /&gt;
! IDXREF now obeys INCLUDE_RESOLUTION_RANGE and EXCLUDE_RESOLUTION_RANGE to exclude ice-rings&lt;br /&gt;
&lt;br /&gt;
FRIEDEL&#039;S_LAW=FALSE     ! This acts only on the CORRECT step&lt;br /&gt;
! If the anom signal turns out to be, or is known to be, very low or absent,&lt;br /&gt;
! use FRIEDEL&#039;S_LAW=TRUE instead (or comment out the line); re-run CORRECT&lt;br /&gt;
&lt;br /&gt;
! remove the &amp;quot;!&amp;quot; in the following line:&lt;br /&gt;
! STRICT_ABSORPTION_CORRECTION=TRUE&lt;br /&gt;
! if the anomalous signal is strong: in that case, in CORRECT.LP the three&lt;br /&gt;
! &amp;quot;CHI^2-VALUE OF FIT OF CORRECTION FACTORS&amp;quot; values are significantly&amp;gt; 1, e.g. 1.5&lt;br /&gt;
!&lt;br /&gt;
! exclude (mask) untrusted areas of detector, e.g. beamstop shadow :&lt;br /&gt;
! UNTRUSTED_RECTANGLE= 1800 1950 2100 2150 ! x-min x-max y-min y-max ! repeat&lt;br /&gt;
! UNTRUSTED_ELLIPSE= 2034 2070 1850 2240 ! x-min x-max y-min y-max ! if needed&lt;br /&gt;
! UNTRUSTED_QUADRILATERAL= x1 y1 x2 y2 x3 y3 x4 y4 ! see documentation&lt;br /&gt;
!&lt;br /&gt;
! parameters with changes wrt default values:&lt;br /&gt;
TRUSTED_REGION=$TRUSTED_REGION&lt;br /&gt;
VALUE_RANGE_FOR_TRUSTED_DETECTOR_PIXELS=6000. 30000. ! often 7000 or 8000 is ok&lt;br /&gt;
STRONG_PIXEL=4           ! COLSPOT: only use strong reflections (default is 3)&lt;br /&gt;
MINIMUM_NUMBER_OF_PIXELS_IN_A_SPOT=3 ! default of 6 is sometimes too high&lt;br /&gt;
! close spots/long cell axis: reduce SEPMIN and CLUSTER_RADIUS from their defaults of 6 and 3&lt;br /&gt;
! SEPMIN=4  CLUSTER_RADIUS=2 ! should be default for Pilatus and other detectors with low PSF&lt;br /&gt;
! since XDS 01-MAR-2015, POSITION is used instead of DISTANCE. Older versions do it the other way round.&lt;br /&gt;
! nowadays headers are usually correct so refine DISTANCE/POSITION in INTEGRATE but not IDXREF&lt;br /&gt;
REFINE(IDXREF)=CELL BEAM ORIENTATION AXIS ! DISTANCE POSITION&lt;br /&gt;
REFINE(INTEGRATE)= DISTANCE POSITION BEAM ORIENTATION ! AXIS CELL&lt;br /&gt;
! REFINE(CORRECT)=CELL BEAM ORIENTATION AXIS DISTANCE POSITION ! Default is: refine everything&lt;br /&gt;
&lt;br /&gt;
! parameters specifically for this detector and beamline:&lt;br /&gt;
DETECTOR= $DETECTOR&lt;br /&gt;
SENSOR_THICKNESS= $SENSOR_THICKNESS&lt;br /&gt;
! attention CCD detectors: for very high resolution (better than 1A) make sure to specify SILICON&lt;br /&gt;
! as about 32* what CORRECT.LP suggests (absorption of phosphor is much higher than that of silicon).&lt;br /&gt;
! Better: read the article http://strucbio.biologie.uni-konstanz.de/xdswiki/index.php/SILICON .&lt;br /&gt;
NX= $NX NY= $NY  QX= $QX  QY= $QY ! to make CORRECT happy if frames are unavailable&lt;br /&gt;
&lt;br /&gt;
eof&lt;br /&gt;
if [ &amp;quot;$DET&amp;quot; == &amp;quot;raxis&amp;quot; -o &amp;quot;$dtrek_det&amp;quot; == &amp;quot;raxis&amp;quot; ]; then&lt;br /&gt;
 cat &amp;gt;&amp;gt; XDS.INP &amp;lt;&amp;lt; eof&lt;br /&gt;
DIRECTION_OF_DETECTOR_X-AXIS=1 0 0&lt;br /&gt;
DIRECTION_OF_DETECTOR_Y-AXIS=0 -1 0&lt;br /&gt;
INCIDENT_BEAM_DIRECTION=0 0 1&lt;br /&gt;
ROTATION_AXIS=0 1 0&lt;br /&gt;
!FRACTION_OF_POLARIZATION=0.98   ! uncomment if synchrotron&lt;br /&gt;
POLARIZATION_PLANE_NORMAL=1 0 0&lt;br /&gt;
eof&lt;br /&gt;
else&lt;br /&gt;
 if [ &amp;quot;$rotation_axis&amp;quot; != &amp;quot;&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;ROTATION_AXIS= $rotation_axis&amp;quot; &amp;gt;&amp;gt; XDS.INP&lt;br /&gt;
 elif [ &amp;quot;$REVERSE_PHI&amp;quot; == &amp;quot;no&amp;quot; ]; then&lt;br /&gt;
  echo &#039;ROTATION_AXIS=1 0 0  ! Australian Synchrotron, SERCAT ID-22 (?), APS 19-ID (?), ESRF BM30A, SPring-8, SSRF BL17U need -1 0 0. Diamond ID24 needs 0 -1 0&#039; &amp;gt;&amp;gt; XDS.INP&lt;br /&gt;
 else&lt;br /&gt;
  echo &#039;ROTATION_AXIS=-1 0 0  ! if this is wrong, please contact author.&#039; &amp;gt;&amp;gt; XDS.INP&lt;br /&gt;
 fi&lt;br /&gt;
 if [ &amp;quot;$dtrek_det&amp;quot; == &amp;quot;saturn&amp;quot; ]; then&lt;br /&gt;
 cat &amp;gt;&amp;gt; XDS.INP &amp;lt;&amp;lt; eof&lt;br /&gt;
DIRECTION_OF_DETECTOR_X-AXIS=-1 0 0&lt;br /&gt;
DIRECTION_OF_DETECTOR_Y-AXIS= 0 1 0&lt;br /&gt;
eof&lt;br /&gt;
 else&lt;br /&gt;
 cat &amp;gt;&amp;gt; XDS.INP &amp;lt;&amp;lt; eof&lt;br /&gt;
DIRECTION_OF_DETECTOR_X-AXIS=1 0 0&lt;br /&gt;
DIRECTION_OF_DETECTOR_Y-AXIS=0 1 0&lt;br /&gt;
eof&lt;br /&gt;
 fi&lt;br /&gt;
 cat &amp;gt;&amp;gt; XDS.INP &amp;lt;&amp;lt; eof&lt;br /&gt;
INCIDENT_BEAM_DIRECTION=0 0 1&lt;br /&gt;
FRACTION_OF_POLARIZATION=0.98   ! better value is provided by beamline staff!&lt;br /&gt;
POLARIZATION_PLANE_NORMAL=0 1 0&lt;br /&gt;
eof&lt;br /&gt;
fi&lt;br /&gt;
cat &amp;gt;&amp;gt; XDS.INP &amp;lt;&amp;lt; eof&lt;br /&gt;
!used by DEFPIX and CORRECT to exclude ice-reflections / ice rings - uncomment if necessary&lt;br /&gt;
!EXCLUDE_RESOLUTION_RANGE= 3.93 3.87 !ice-ring at 3.897 Angstrom&lt;br /&gt;
!EXCLUDE_RESOLUTION_RANGE= 3.70 3.64 !ice-ring at 3.669 Angstrom&lt;br /&gt;
!EXCLUDE_RESOLUTION_RANGE= 3.47 3.41 !ice-ring at 3.441 Angstrom&lt;br /&gt;
!EXCLUDE_RESOLUTION_RANGE= 2.70 2.64 !ice-ring at 2.671 Angstrom&lt;br /&gt;
!EXCLUDE_RESOLUTION_RANGE= 2.28 2.22 !ice-ring at 2.249 Angstrom&lt;br /&gt;
!EXCLUDE_RESOLUTION_RANGE= 2.102 2.042 !ice-ring at 2.072 Angstrom - strong&lt;br /&gt;
!EXCLUDE_RESOLUTION_RANGE= 1.978 1.918 !ice-ring at 1.948 Angstrom - weak&lt;br /&gt;
!EXCLUDE_RESOLUTION_RANGE= 1.948 1.888 !ice-ring at 1.918 Angstrom - strong&lt;br /&gt;
!EXCLUDE_RESOLUTION_RANGE= 1.913 1.853 !ice-ring at 1.883 Angstrom - weak&lt;br /&gt;
!EXCLUDE_RESOLUTION_RANGE= 1.751 1.691 !ice-ring at 1.721 Angstrom - weak&lt;br /&gt;
eof&lt;br /&gt;
if [ &amp;quot;$DET&amp;quot; == &amp;quot;pilatus&amp;quot; -o &amp;quot;$DET&amp;quot; == &amp;quot;eiger&amp;quot; ]; then&lt;br /&gt;
cat &amp;gt;&amp;gt; XDS.INP &amp;lt;&amp;lt; eof&lt;br /&gt;
SEPMIN=4 CLUSTER_RADIUS=2&lt;br /&gt;
NUMBER_OF_PROFILE_GRID_POINTS_ALONG_ALPHA/BETA=13 ! Default is 9 - Increasing may improve data &lt;br /&gt;
NUMBER_OF_PROFILE_GRID_POINTS_ALONG_GAMMA=13      ! accuracy, particularly if finely-sliced on phi, &lt;br /&gt;
!                                                   and does not seem to have any downsides. &lt;br /&gt;
eof&lt;br /&gt;
  if [ $NX == &amp;quot;1475&amp;quot; ]; then&lt;br /&gt;
    if ! grep -q Flat_field tmp2 ; then&lt;br /&gt;
    cat &amp;gt;&amp;gt; XDS.INP &amp;lt;&amp;lt; eof&lt;br /&gt;
! the following specifications are for a detector _without_ proper&lt;br /&gt;
! flat_field correction; they cut away one additional pixel adjacent &lt;br /&gt;
! to each UNTRUSTED_RECTANGLE&lt;br /&gt;
!EXCLUSION OF VERTICAL DEAD AREAS OF THE PILATUS 2M DETECTOR&lt;br /&gt;
UNTRUSTED_RECTANGLE= 486  496     0 1680&lt;br /&gt;
UNTRUSTED_RECTANGLE= 980  990     0 1680&lt;br /&gt;
!EXCLUSION OF HORIZONTAL DEAD AREAS OF THE PILATUS 2M DETECTOR&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476   194  214&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476   406  426&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476   618  638&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476   830  850&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476  1042 1062&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476  1254 1274&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476  1466 1486&lt;br /&gt;
eof&lt;br /&gt;
    else&lt;br /&gt;
    cat &amp;gt;&amp;gt; XDS.INP &amp;lt;&amp;lt; eof&lt;br /&gt;
!EXCLUSION OF VERTICAL DEAD AREAS OF THE PILATUS 2M DETECTOR&lt;br /&gt;
UNTRUSTED_RECTANGLE= 487  495     0 1680&lt;br /&gt;
UNTRUSTED_RECTANGLE= 981  989     0 1680&lt;br /&gt;
!EXCLUSION OF HORIZONTAL DEAD AREAS OF THE PILATUS 2M DETECTOR&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476   195  213&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476   407  425&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476   619  637&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476   831  849&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476  1043 1061&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476  1255 1273&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476  1467 1485&lt;br /&gt;
eof&lt;br /&gt;
    fi&lt;br /&gt;
  elif [ $NX == &amp;quot;2463&amp;quot; ]; then&lt;br /&gt;
# Pilatus 6M&lt;br /&gt;
# FIXME: here we could test if a Flat_field correction was applied like we do for 2M&lt;br /&gt;
    cat &amp;gt;&amp;gt; XDS.INP &amp;lt;&amp;lt; eof&lt;br /&gt;
UNTRUSTED_RECTANGLE= 487  495     0 2528&lt;br /&gt;
UNTRUSTED_RECTANGLE= 981  989     0 2528&lt;br /&gt;
UNTRUSTED_RECTANGLE=1475 1483     0 2528&lt;br /&gt;
UNTRUSTED_RECTANGLE=1969 1977     0 2528&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 2464   195  213&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 2464   407  425&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 2464   619  637&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 2464   831  849&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 2464  1043 1061&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 2464  1255 1273&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 2464  1467 1485&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 2464  1679 1697&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 2464  1891 1909&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 2464  2103 2121&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 2464  2315 2333&lt;br /&gt;
eof&lt;br /&gt;
  elif [ $NX == &amp;quot;3110&amp;quot;  -a $NY == &amp;quot;3269&amp;quot; ]; then&lt;br /&gt;
# Eiger 9M&lt;br /&gt;
    cat &amp;gt;&amp;gt; XDS.INP &amp;lt;&amp;lt; eof&lt;br /&gt;
!EXCLUSION OF VERTICAL DEAD AREAS OF THE EIGER 9M DETECTOR&lt;br /&gt;
UNTRUSTED_RECTANGLE= 1029 1042 0 3269&lt;br /&gt;
UNTRUSTED_RECTANGLE= 2069 2082 0 3269&lt;br /&gt;
!EXCLUSION OF HORIZONTAL DEAD AREAS OF THE EIGER 9M DETECTOR&lt;br /&gt;
UNTRUSTED_RECTANGLE= 0 3110  513  553&lt;br /&gt;
UNTRUSTED_RECTANGLE= 0 3110 1064 1104&lt;br /&gt;
UNTRUSTED_RECTANGLE= 0 3110 1615 1655&lt;br /&gt;
UNTRUSTED_RECTANGLE= 0 3110 2166 2206&lt;br /&gt;
UNTRUSTED_RECTANGLE= 0 3110 2717 2757&lt;br /&gt;
eof&lt;br /&gt;
  fi&lt;br /&gt;
fi&lt;br /&gt;
echo XDS.INP is ready for use. The file has only the most important keywords.&lt;br /&gt;
echo Full documentation, including complete detector templates, is at&lt;br /&gt;
echo http://www.mpimf-heidelberg.mpg.de/~kabsch/xds . More documentation in XDSwiki&lt;br /&gt;
echo After running xds, inspect, using XDS-Viewer, at least the beamstop mask in&lt;br /&gt;
echo BKGPIX.cbf, and the agreement of predicted and observed spots in FRAME.cbf!&lt;br /&gt;
rm -f tmp1 tmp2&lt;br /&gt;
# end of generate_XDS.INP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System-wide or personal installation ==&lt;br /&gt;
&lt;br /&gt;
Ask your system adminstrator to cut-and-paste the script into e.g. /usr/local/bin/generate_XDS.INP, and to make it &amp;quot;executable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
But you may also cut-and-paste the script from this webpage into a file in e.g. your home directory; the filename should be generate_XDS.INP. After creating the file, make it executable - e.g. if it&#039;s in your $HOME, use:&lt;br /&gt;
 chmod +x ~/generate_XDS.INP&lt;br /&gt;
After that, you can just run it in a similar way as if it were installed in your $PATH:&lt;br /&gt;
 ~/generate_XDS.INP &amp;quot;frms/mydata_1_???.img&amp;quot;&lt;br /&gt;
By using your own file, you can easily update to the latest revision, or even change the script, without having to bother the system administrator.&lt;br /&gt;
&lt;br /&gt;
On Mac OS X, installation of the &amp;quot;Command Line Tools&amp;quot; (from http://developer.apple.com/downloads; requires Apple ID) is required. These are also part of the (larger, but also free) [http://developer.apple.com/tools/xcode Xcode] package. This package comes with a license that has to be accepted by the user when running a Command Line Tool for the first time.&lt;br /&gt;
&lt;br /&gt;
== Generating generate_XDS.INP from this webpage ==&lt;br /&gt;
&lt;br /&gt;
Instead of cutting-and-pasting the lines of the script, you (or the system administrator) could just cut-and-paste the following four lines&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 wget http://strucbio.biologie.uni-konstanz.de/xdswiki/index.php/generate_XDS.INP -O - | \&lt;br /&gt;
   sed -e s/\&amp;amp;nbsp\;/\ /g -e s/\&amp;amp;gt\;/\&amp;gt;/g -e s/\&amp;amp;lt\;/\&amp;lt;/g -e s/amp\;//g -e s/\&amp;amp;quot\;/\&amp;quot;/g -e s/\&amp;amp;\#\1\6\0\;/\ /g | \&lt;br /&gt;
   sed &#039;/# end of generate_XDS.INP/,$d&#039; | awk &#039;/^#/,/rm -f tmp1 tmp2/&#039; &amp;gt; generate_XDS.INP&lt;br /&gt;
 chmod +x generate_XDS.INP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to copy the script from this website into an executable file generate_XDS.INP in your current directory. On a Mac (which does not seem to have wget), one could try&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 curl -L -o - http://strucbio.biologie.uni-konstanz.de/xdswiki/index.php/generate_XDS.INP | \&lt;br /&gt;
   sed -e s/\&amp;amp;nbsp\;/\ /g -e s/\&amp;amp;gt\;/\&amp;gt;/g -e s/\&amp;amp;lt\;/\&amp;lt;/g -e s/amp\;//g -e s/\&amp;amp;quot\;/\&amp;quot;/g -e s/\&amp;amp;\#\1\6\0\;/\ /g | \&lt;br /&gt;
   sed &#039;/# end of generate_XDS.INP/,$d&#039; | awk &#039;/^#/,/rm -f tmp1 tmp2/&#039; &amp;gt; generate_XDS.INP&lt;br /&gt;
 chmod +x generate_XDS.INP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you do use cut-and-paste from the webpage, be aware of the following problem report: On the Mac, after loading frames, by clicking “generate XDS.INP”, the program gives some strange symbol “Ã” in XDS.INP. And the more you click “save” button, the more “Ã” appear. This looks like e.g. &amp;lt;br&amp;gt;SPACE_GROUP_NUMBER=0 Ã ! 0 if unknown &amp;lt;br&amp;gt;UNIT_CELL_CONSTANTS= 70 80 90 90 90 90 Ã &amp;lt;br&amp;gt; &#039;&#039;The problem is due to the “Rich text” format in TextEdit when saving &amp;quot;generate_XDS.INP&amp;quot;. It is solved by re-downloading the script, and changing format to Plain - everything should work then.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Calling generate_XDS.INP from a Python script ==&lt;br /&gt;
&lt;br /&gt;
It is recommended to use the [http://docs.python.org/2/library/subprocess.html subprocess.Popen()] module instead of [http://docs.python.org/2/library/os.html os.system()]:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 subprocess.Popen([&amp;quot;generate_XDS.INP&amp;quot;,imagepath],stdout=outputfile)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where imagepath is a string containing the path to an image and outputfile is either a chosen variable for an output file or subprocess.PIPE if you&#039;re not interested in the output of the script.&lt;br /&gt;
&lt;br /&gt;
The module os.system() internally uses /bin/sh to execute the command and overrides #!/bin/bash at the beginning of the script. While this is not a problem on most operating systems, /bin/sh points to dash instead of bash on Ubuntu, which leads to a program crash with the error message&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 sh: 1: Syntax error: Bad fd number&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dependencies ==&lt;br /&gt;
The script makes use of many GNU commands, like ls, grep and egrep, awk, cut, cat, echo, wc, bc, head, sed, tail, cp, od, python. Some of them (like od and python) are only used in case of specific detectors. &lt;br /&gt;
The script will only work if all the required commands are available. They reside in either the coreutils RPM, or specific RPMs (sed, bc, grep, python ...). Please note that to get the &amp;lt;code&amp;gt;strings&amp;lt;/code&amp;gt; command on some Linux distributions (e.g. FC23) you need to install the &amp;lt;code&amp;gt;binutils&amp;lt;/code&amp;gt; RPM package.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
* The script tries to interpret the header of the frames, so is currently limited to Dectris (Pilatus), ADSC (Quantum), Rigaku (several types) and MAR (CCD and image plate) detectors. Other detectors need some values to be manually filled into XDS.INP - the relevant places are marked with XXX. These are detector properties (type, pixel size and number, min and max counts in a pixel), and experimental parameters like oscillation range, wavelength, distance, and direct beam position (or rather: point of detector that is closest to the crystal). For fine-tuning of detector parameters, see the [http://xds.mpimf-heidelberg.mpg.de/html_doc/xds_prepare.html detector-specific templates].&lt;br /&gt;
* The authors have made a &amp;quot;best effort&amp;quot; to provide a XDS.INP that results in the correct sign of the anomalous signal. In the case of one detector type (internally called Rigaku SMV) this requires reversal of one detector axis, and a negative DETECTOR_DISTANCE, as is found in some of the [http://xds.mpimf-heidelberg.mpg.de/html_doc/xds_prepare.html detector-specific templates]. &#039;&#039;&#039;For an unusual or unknown detector setup, the correct sign of the anomalous signal needs to be established and verified e.g. with a good dataset from a test crystal that has a anomalous signal.&#039;&#039;&#039; The authors do not take any responsibility for problems arising from incorrect sign of the anomalous signal, nor - obviously! - for any other mischief arising in or from data processing.&lt;br /&gt;
* At some beamlines, the ROTATION_AXIS should be -1 0 0 (&amp;quot;backwards&amp;quot;) instead of the usual 1 0 0 (&amp;quot;horizontal&amp;quot;), or even 0 1 0 (&amp;quot;vertical&amp;quot;) like at one of the PETRA Hamburg BLs. We have only just started the article [[Beamline notes]], and the frame headers do not have this information, so the default chosen by [[generate_XDS.INP]] may be wrong and need manual correction.&lt;br /&gt;
* Sometimes, the x- and y- values of the primary beam position recorded in the header should be used for ORGY and ORGX (i.e reversed) instead of as ORGX and ORGY. For ADSC, this has been implemented in the script for a number of beamlines. A beamline that is also known to have reversed X and Y is BM14 (ESRF; Mar CCD, as of April 2014) but the script does not currently implement the reversal.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* GlobalPhasing&#039;s list of beamlines and their settings is at http://www.globalphasing.com/autoproc/wiki/index.cgi?BeamlineSettings .&lt;br /&gt;
* [[Beamline notes]] to collect information about specific settings&lt;/div&gt;</summary>
		<author><name>Karine</name></author>
	</entry>
	<entry>
		<id>https://wiki.uni-konstanz.de/xds/index.php?title=Problems&amp;diff=3217</id>
		<title>Problems</title>
		<link rel="alternate" type="text/html" href="https://wiki.uni-konstanz.de/xds/index.php?title=Problems&amp;diff=3217"/>
		<updated>2015-09-14T07:02:56Z</updated>

		<summary type="html">&lt;p&gt;Karine: /* IDXREF.LP does not show the expected lattice */ you do not to know -&amp;gt; you do not know&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a collection of problems and their solutions.&lt;br /&gt;
&lt;br /&gt;
== XDS crashes ==&lt;br /&gt;
&lt;br /&gt;
XDS should never crash (if it terminates with an error message, this does not count as crash). If it does, it is either a bug in the program which should be brought to the attention of Wolfgang Kabsch or Kay Diederichs, and will be fixed, or it is a problem with your computer. &lt;br /&gt;
&lt;br /&gt;
If it crashes for the second reason, these are the things to try/consider:&lt;br /&gt;
&lt;br /&gt;
=== read error ===&lt;br /&gt;
&lt;br /&gt;
... may result in e.g.&lt;br /&gt;
&lt;br /&gt;
 forrtl: severe (24): end-of-file during read, unit 2, file bin1_01.tmp&lt;br /&gt;
&lt;br /&gt;
Any error message that XDS prints out afterwards is just a follow-up error. The most likely cause of the problem is that your disk is full, or your quota exceeded. You must fix the root problem before you can continue. &lt;br /&gt;
&lt;br /&gt;
=== huge frames leading to overflow of the shell&#039;s stack limit ===&lt;br /&gt;
&lt;br /&gt;
Increase the stack limit of your shell, e.g. (if using csh or tcsh) with &lt;br /&gt;
 limit stacksize 102400 &lt;br /&gt;
or (in case of bash)&lt;br /&gt;
 ulimit -s 102400 &lt;br /&gt;
The numbers above mean a 10-fold increase over the default, and should be enough. I&#039;ve found this to be necessary for unusually large frames (32 MB).&lt;br /&gt;
xds_par in this case also might need an increase of the environment variable OMP_STACKSIZE (e.g. &amp;quot;setenv OMP_STACKSIZE 128M&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
=== memory consumption exceeding the 4GB barrier when using the 32bit binary ===&lt;br /&gt;
&lt;br /&gt;
As pointed out by James Holton, the memory consumed by huge frames in combination with many threads may be larger than 32 bits allow. Execution then stops with &lt;br /&gt;
 forrtl: severe (41): insufficient virtual memory &lt;br /&gt;
The workaround is to limit the [http://homes.mpimf-heidelberg.mpg.de/~kabsch/xds/html_doc/xds_parameters.html MAXIMUM_NUMBER_OF_PROCESSORS], or to use XDS instead of XDS_PAR. An even better solution is to switch to the 64bit binary, but that of course requires a 64bit operating system.&lt;br /&gt;
&lt;br /&gt;
=== Problems with OpenMP ===&lt;br /&gt;
&lt;br /&gt;
If the &amp;quot;xds_par&amp;quot; binary crashed, try &amp;quot;xds&amp;quot;. xds_par uses OpenMP for parallelization, which adds complexity. If it works with xds, but not with xds_par, then there is a chance that some environment variable needs to be set/changed. In any case the XDS developers would like to learn about this.&lt;br /&gt;
&lt;br /&gt;
=== limitation of the parallel 32bit binary  ===&lt;br /&gt;
&lt;br /&gt;
The 32bit OpenMP binary may not be able to allocate enough storage when using many threads (e.g. &amp;gt;10). The error message might be something like:&lt;br /&gt;
&lt;br /&gt;
 OMP: Error #34: System unable to allocate necessary resources for OMP thread:&lt;br /&gt;
 OMP: System error #11: Resource temporarily unavailable&lt;br /&gt;
&lt;br /&gt;
=== 64bit binary on a 32 bit operating system ===&lt;br /&gt;
&lt;br /&gt;
If the error message is e.g.&lt;br /&gt;
 xds: Exec format error. Wrong Architecture.&lt;br /&gt;
or&lt;br /&gt;
 -bash: /usr/local/bin/xds: cannot execute binary file&lt;br /&gt;
make sure to use the 32bit version of XDS instead - you try to run the 64bit version on a 32bit operating system; this won&#039;t work.&lt;br /&gt;
&lt;br /&gt;
=== CPU without SSE2 support ===&lt;br /&gt;
&lt;br /&gt;
If the error message is&lt;br /&gt;
&lt;br /&gt;
 forrtl: severe (168): Program Exception - illegal instruction&lt;br /&gt;
 Image              PC        Routine            Line        Source&lt;br /&gt;
 xds                08055250  Unknown               Unknown  Unknown&lt;br /&gt;
 xds                0804B3F6  Unknown               Unknown  Unknown&lt;br /&gt;
&lt;br /&gt;
this means that unfortunately the CPU of your machine is too old to be supported by XDS (which in this respect is compiled with the default options of the ifort compiler). This may happen e.g. with old AMD CPUs that don&#039;t support SSE2 (on Linux check the &#039;&#039;flags&#039;&#039; field of /proc/cpuinfo for the presence of the sse2 flag).&lt;br /&gt;
&lt;br /&gt;
According to [http://en.wikipedia.org/wiki/SSE2#Notable_IA-32_CPUs_not_supporting_SSE2] the following Intel-compatible CPUs did not implement SSE2 after SSE2 was introduced (2001):&lt;br /&gt;
* AMD CPUs prior to Athlon 64, including all Socket A-based CPUs&lt;br /&gt;
* Intel CPUs prior to Pentium 4&lt;br /&gt;
* VIA C3&lt;br /&gt;
* Transmeta Crusoe&lt;br /&gt;
&lt;br /&gt;
=== ASSERT VIOLATION ===&lt;br /&gt;
&lt;br /&gt;
If you get e.g.&lt;br /&gt;
 !!! ERROR !!! ASSERT VIOLATION IN &amp;quot;RESTHKL&amp;quot;&lt;br /&gt;
this indicates that an internal error has occurred, i.e. some situation was hit that the program is not prepared to handle.&lt;br /&gt;
There must be something very special about your dataset - maybe a very small number of reflections, maybe only negative intensities, maybe something else - &lt;br /&gt;
which triggers the bug. If this happens then get in touch with the XDS developers - they will most likely ask to make your XDS.INP and data frames available to them, to fix the program.&lt;br /&gt;
&lt;br /&gt;
== Indexing failures ==&lt;br /&gt;
&lt;br /&gt;
In case of IDXREF problems, you should definitively inspect, using [[XDS-viewer]] or [[adxv]], the FRAME.cbf file which is written by COLSPOT. This file shows the first frame of the SPOT_RANGE, together with strong pixels that COLSPOT found on this frame, marked with white pixels. IDXREF will use those spot positions which have at least as many strong pixels as MINIMUM_NUMBER_OF_PIXELS_IN_A_SPOT specifies. &lt;br /&gt;
&lt;br /&gt;
You will only be able to look at this file if you prevent XDS from running INTEGRATE. This can be achieved e.g. by&lt;br /&gt;
&lt;br /&gt;
 JOB= XYCORR INIT COLSPOT IDXREF DEFPIX ! INTEGRATE CORRECT&lt;br /&gt;
&lt;br /&gt;
since otherwise, FRAME.cbf is overwritten by INTEGRATE. &lt;br /&gt;
&lt;br /&gt;
To look at &#039;&#039;&#039;all&#039;&#039;&#039; spot positions found by COLSPOT, you could try&lt;br /&gt;
 echo &amp;quot;set yrange [] reverse ; plot &#039;SPOT.XDS&#039; us 1:2 w dots&amp;quot; | gnuplot -persist&lt;br /&gt;
This may also help to find shaded regions on the detector.&lt;br /&gt;
&lt;br /&gt;
=== IDXREF ends with !!! ERROR !!! message ===&lt;br /&gt;
&lt;br /&gt;
These messages should really be called !!! WARNING !!!. The two types occuring most often are:&lt;br /&gt;
&lt;br /&gt;
  !!! ERROR !!! SOLUTION IS INACCURATE&lt;br /&gt;
This message is printed if the &amp;quot;STANDARD DEVIATION OF SPOT POSITION (PIXELS)&amp;quot; is larger than the MAXIMUM_ERROR_OF_SPOT_POSITION= (default of 3).&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 !!! ERROR !!! INSUFFICIENT PERCENTAGE (&amp;lt; 50%) OF INDEXED REFLECTIONS&lt;br /&gt;
This message is printed if less than the given percentage of reflections that COLSPOT found was actually indexed. If this occurs, it is clearly a warning sign.&lt;br /&gt;
&lt;br /&gt;
The message continues in both cases:&lt;br /&gt;
 AUTOMATIC DATA PROCESSING STOPPED. AS THE CRITERIA FOR A GOOD&lt;br /&gt;
 SOLUTION ARE RATHER STRICT, YOU MAY CHOOSE TO CONTINUE DATA&lt;br /&gt;
 PROCESSING AFTER CHANGING THE &amp;quot;JOB=&amp;quot;-CARD IN &amp;quot;XDS.INP&amp;quot; TO&lt;br /&gt;
 &amp;quot;JOB= DEFPIX INTEGRATE CORRECT&amp;quot;.&lt;br /&gt;
 IF THE BEST SOLUTION IS REALLY NONSENSE YOU SHOULD FIRST HAVE&lt;br /&gt;
 A LOOK AT THE ASCII-FILE &amp;quot;SPOT.XDS&amp;quot;. THIS FILE CONTAINS THE&lt;br /&gt;
 INITIAL SPOT LIST SORTED IN DECREASING SPOT INTENSITY. SPOTS&lt;br /&gt;
 NEAR THE END OF THE FILE MAY BE ARTEFACTS AND SHOULD BE ERASED.&lt;br /&gt;
 ALTERNATIVELY YOU MAY TRY DIFFERENT VALUES FOR &amp;quot;INDEX_ORIGIN&amp;quot;&lt;br /&gt;
 AS SUGGESTED IN THE ABOVE LISTING.&lt;br /&gt;
 IF THE CRYSTAL HAS SLIPPED AT THE BEGINNING OF DATA COLLECTION&lt;br /&gt;
 YOU MAY CHOOSE TO SKIP SOME OF THE FIRST FRAMES BY CHANGING&lt;br /&gt;
 THE &amp;quot;DATA_RANGE=&amp;quot; IN FILE &amp;quot;XDS.INP&amp;quot; AND START ALL OVER AGAIN.&lt;br /&gt;
&lt;br /&gt;
This is printed out for you to actually read, and take action accordingly. In most cases you just change the JOBS - line in XDS.INP to read&lt;br /&gt;
 JOB= DEFPIX INTEGRATE CORRECT&lt;br /&gt;
and then continue to run XDS. In other cases you may want to change SPOT.XDS, or other keywords in [[XDS.INP]] (see also below). But in any case this is an important alert that should make you check the correctness of the parameters that describe the data collection (X-RAY_WAVELENGTH, DETECTOR_DISTANCE, ORGX, ORGY, OSCILLATION_RANGE, NAME_TEMPLATE_OF_DATA_FRAMES).&lt;br /&gt;
&lt;br /&gt;
=== IDXREF produces too short cell parameter(s) ===&lt;br /&gt;
&lt;br /&gt;
The first table &amp;quot;CLUSTER COORDINATES AND INDICES WITH RESPECT TO REC. LATTICE BASIS VECTORS&amp;quot; should show close-to-integer difference vectors. The following is an example how it should &#039;&#039;not&#039;&#039; look like:&lt;br /&gt;
   #  COORDINATES OF REC. BASIS VECTOR    LENGTH   1/LENGTH&lt;br /&gt;
 &lt;br /&gt;
    1  -0.0000476-0.0014008-0.0044654  0.0046802     213.67&lt;br /&gt;
    2  -0.0101960-0.0056194 0.0019466  0.0118037      84.72&lt;br /&gt;
    3  -0.0145331 0.0238225-0.0071754  0.0288134      34.71&lt;br /&gt;
 &lt;br /&gt;
 CLUSTER COORDINATES AND INDICES WITH RESPECT TO REC. LATTICE BASIS VECTORS &lt;br /&gt;
   #  COORDINATES OF VECTOR CLUSTER   FREQUENCY       CLUSTER INDICES   &lt;br /&gt;
    1  0.0004199-0.0012633-0.0043826     2442.      0.97     -0.04     -0.00&lt;br /&gt;
    2  0.0101757 0.0060701-0.0019630     2175.     -0.03     -1.02      0.01&lt;br /&gt;
    3 -0.0076118 0.0114167-0.0040603     1965.      0.13      0.04      0.50&lt;br /&gt;
    4  0.0100552 0.0071646 0.0025337     1944.     -1.01     -0.99      0.01&lt;br /&gt;
    5  0.0072840-0.0101455 0.0084405     1841.     -1.10     -0.01     -0.49&lt;br /&gt;
    6  0.0000976 0.0027828 0.0089584     1792.     -2.00      0.00     -0.00&lt;br /&gt;
    7  0.0103103 0.0043851-0.0063902     1790.      0.98     -1.02      0.00&lt;br /&gt;
    8  0.0025742 0.0163995-0.0098507     1760.      0.95     -0.99      0.51&lt;br /&gt;
    9  0.0068686-0.0089437 0.0128884     1724.     -2.08      0.03     -0.49&lt;br /&gt;
   10 -0.0174443 0.0123504 0.0161324     1694.     -4.01      0.99      0.52&lt;br /&gt;
   11  0.0272195-0.0050005-0.0136142     1678.      2.99     -1.97     -0.50&lt;br /&gt;
  ...&lt;br /&gt;
 &lt;br /&gt;
 PARAMETERS OF THE REDUCED CELL (ANGSTROEM &amp;amp; DEGREES)&lt;br /&gt;
     34.71     84.72    213.67     90.35     90.27     90.06&lt;br /&gt;
Do you see the half-integer difference vectors in the last column? This clearly indicates that the third axis above the table (with 1/length=34.71) actually should be twice that size. If this happens, the histogram of indexed spots often has two equally-large subtrees:&lt;br /&gt;
 SUBTREE    POPULATION&lt;br /&gt;
 &lt;br /&gt;
     1          976&lt;br /&gt;
     2          972&lt;br /&gt;
     3           10&lt;br /&gt;
     4            7&lt;br /&gt;
     5            6&lt;br /&gt;
&lt;br /&gt;
Remedy: take the reduced cell (as found below the table), but double the 34.71, and stick it into the line&lt;br /&gt;
 UNIT_CELL_CONSTANTS=69.42     84.72    213.67     90.35     90.27     90.06 &lt;br /&gt;
in XDS.INP. To make XDS actually &#039;&#039;use&#039;&#039; that line, specify &lt;br /&gt;
 SPACE_GROUP_NUMBER=1&lt;br /&gt;
and leave the space group determination for later.&lt;br /&gt;
&lt;br /&gt;
Alternatively, try several well-separated SPOT_RANGEs instead of 1. For example, instead of&lt;br /&gt;
 SPOT_RANGE=1 900&lt;br /&gt;
try e.g.&lt;br /&gt;
 SPOT_RANGE=1 100&lt;br /&gt;
 SPOT_RANGE=801 900&lt;br /&gt;
In the cases where I&#039;ve tried this, this splitting of SPOT_RANGE into several wedges always resulted in IDXREF picking up the correct cell. &lt;br /&gt;
&lt;br /&gt;
The reason for the indexing failure in these cases seems to be the fact that the crystal changed its orientation within the SPOT_RANGE by more than ~ 0.1°.&lt;br /&gt;
&lt;br /&gt;
=== IDXREF produces too long axes ===&lt;br /&gt;
&lt;br /&gt;
This may (rarely) happen when MAXIMUM_NUMBER_OF_JOBS is &amp;gt; 1. In this case, different JOBS&#039; COLSPOT runs may report some reflections twice in SPOT.XDS. Since their phi values are close, they correspond to long unit cell parameters. This happens more easily if the mosaicity is high and therefore reflections extend over the borders between JOBs. &lt;br /&gt;
&lt;br /&gt;
This effect may be mitigated by having as many SPOT_RANGEs as JOBs, and leaving gaps between the SPOT_RANGEs.&lt;br /&gt;
&lt;br /&gt;
=== IDXREF prints !!! WARNING !!! message ===&lt;br /&gt;
&lt;br /&gt;
If you see&lt;br /&gt;
 !!! WARNING !!! REFINEMENT DID NOT CONVERGE&lt;br /&gt;
                 LAST CORRECTION SHIFT WAS   6.1E-02 (should be &amp;lt;  1.0E-03)&lt;br /&gt;
then try the following: find the line&lt;br /&gt;
 REFINE(IDXREF)= ...&lt;br /&gt;
in XDS.INP. If it is commented out with a !, remove the !. Then, change it to have&lt;br /&gt;
 REFINE(IDXREF)=CELL BEAM ORIENTATION AXIS ! POSITION&lt;br /&gt;
i.e. remove POSITION from the list of refinable parameters. Once that is done, save XDS.INP and re-run the IDXREF step.&lt;br /&gt;
&lt;br /&gt;
This problem occurs if the POSITION value (called DISTANCE in former XDS versions) is large, and XDS cannot refine it meaningfully.&lt;br /&gt;
&lt;br /&gt;
If this does not help, try to refine even less items, e.g. leave out AXIS.&lt;br /&gt;
&lt;br /&gt;
=== IDXREF.LP does not show the expected lattice ===&lt;br /&gt;
&lt;br /&gt;
By specifying the spacegroup and unitcell, you tell XDS that it should index based on those reflections that match that spacegroup and unitcell. In a sense, you _force_ that spacegroup and cell. This will discard other (spurious?) reflections, and usually leads to a clean list of Bravais lattice possibilities.&lt;br /&gt;
&lt;br /&gt;
If the data reduction fails nevertheless (in terms of bad R-factors and [[CORRECT#An estimate for the overall quality of an experimental setup|ISa]] in the [[CORRECT]] step), then chances are that you specified some parameter wrongly, or not accurate enough (ORGX and ORGY are the most likely candidates), or that the crystal does not match your idea about its spacegroup and unit cell. Actually the latter happens pretty frequently (which is why it is always the safest way to collect 180° of spindle rotation unless you know your crystals very well; this is also a good strategy in other respects).&lt;br /&gt;
&lt;br /&gt;
If you tell XDS that you do not know the spacegroup (SPACE_GROUP_NUMBER= 0), then [[IDXREF]] takes all observed reflections into account. By design, the spacegroup decision is then postponed until the CORRECT step, or rather to a run of [[pointless]] after CORRECT, and it may be not vital to closely inspect IDXREF.LP, because CORRECT.LP has basically the same information, plus more.&lt;br /&gt;
&lt;br /&gt;
=== none of the lattices in IDXREF.LP (except aP) has a good QUALITY OF FIT ===&lt;br /&gt;
&lt;br /&gt;
It is a good idea to use many frames for the SPOT_RANGE, (e.g. the first half of the DATA_RANGE, as does the [[generate_XDS.INP]] script) for the COLSPOT and IDXREF steps. &lt;br /&gt;
&lt;br /&gt;
It is entirely possible to run COLSPOT for the &#039;&#039;complete&#039;&#039; DATA_RANGE (in that case the parameters of SPOT_RANGE are the same as for the DATA_RANGE), and to try smaller SPOT_RANGEs in IDXREF - this means COLSPOT has to be run only once, and the JOBS= line has e.g. &lt;br /&gt;
 JOBS= IDXREF &lt;br /&gt;
only. Maybe some SPOT_RANGE sub-range gives a clear answer. In that case it may be useful to use&lt;br /&gt;
 REFINE(INTEGRATE)=! AXIS BEAM ORIENTATION CELL DISTANCE&lt;br /&gt;
because otherwise the spurious reflections in the other ranges will probably disturb the on-the-fly refinement of parameters.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve seen datasets where each reflection had a satellite associated with the main reflection, but separate from it. This is well visible in FRAME.cbf written by COLSPOT. In such a case it helps to use&lt;br /&gt;
 MINIMUM_NUMBER_OF_PIXELS_IN_A_SPOT= 12 ! re-run COLSPOT after changing the parameter !&lt;br /&gt;
thus doubling (w.r.t. the default of 6) the required spotsize that makes a reflection be used for indexing. In the latest case this made it possible to index cleanly on a single frame (which is actually not uncommon).&lt;br /&gt;
&lt;br /&gt;
A final possibility: your crystal may really be triclinic - hopefully you collected 180° of data, or even a bit more than that.&lt;br /&gt;
&lt;br /&gt;
== Integration failure ==&lt;br /&gt;
&lt;br /&gt;
If INTEGRATE stops after e.g.&lt;br /&gt;
 ******************************************************************************&lt;br /&gt;
                     PROCESSING OF IMAGES      136 ...     140&lt;br /&gt;
 ******************************************************************************&lt;br /&gt;
with &lt;br /&gt;
 !!! ERROR !!! AUTOMATIC DETERMINATION OF SPOT SIZE PARAMETERS HAS FAILED.&lt;br /&gt;
               YOU MAY RESTART THIS STEP AFTER SPECIFYING VALUES IN XDS.INP FOR:&lt;br /&gt;
               REFLECTING_RANGE=    REFLECTING_RANGE_E.S.D.=&lt;br /&gt;
               BEAM_DIVERGENCE=     BEAM_DIVERGENCE_E.S.D.= &lt;br /&gt;
&lt;br /&gt;
then you should reduce the upper limit of the DATA_RANGE, to stop before the problematic frames, and re-run INTEGRATE. In this example, you would modify XDS.INP to have&lt;br /&gt;
 DATA_RANGE=1 135&lt;br /&gt;
 JOB=INTEGRATE CORRECT&lt;br /&gt;
Save XDS.INP, run XDS and inspect INTEGRATE.LP, to find the lines (e.g.)&lt;br /&gt;
 BEAM_DIVERGENCE=   0.478  BEAM_DIVERGENCE_E.S.D.=   0.048&lt;br /&gt;
 REFLECTING_RANGE=  1.100  REFLECTING_RANGE_E.S.D.=  0.157&lt;br /&gt;
Copy them to XDS.INP. Restore the original DATA_RANGE and continue.&lt;br /&gt;
&lt;br /&gt;
Another error mode of INTEGRATE (in processing of small-molecule data) is ...&lt;br /&gt;
 IMAGE IER  SCALE     NBKG NOVL NEWALD NSTRONG  NREJ  SIGMAB  SIGMAR&lt;br /&gt;
     5   0  0.975  3968463    1      5       1     0  0.1028  1.3486&lt;br /&gt;
     6   0  0.967  3969949    2      2       2     0  0.1688  0.0000&lt;br /&gt;
     7   0  0.929  3975306    0      3       0     0  0.0000  0.0000&lt;br /&gt;
  !!! ERROR !!! CANNOT ALLOCATE MEMORY&lt;br /&gt;
               YOU COULD RERUN THIS STEP WITH SMALLER VALUES FOR THE PARAMETERS&lt;br /&gt;
               NUMBER_OF_PROFILE_GRID_POINTS_ALONG_ALPHA/BETA=&lt;br /&gt;
               NUMBER_OF_PROFILE_GRID_POINTS_ALONG_GAMMA=&lt;br /&gt;
The error message is misleading in this case: there are too few reflections to build the average profile. The fix is: restart INTEGRATE after inserting e.g.&lt;br /&gt;
 DELPHI=20 ! default is 5, so try with e.g. 10, 20, 45, 90, 180 &lt;br /&gt;
and re-run INTEGRATE.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
[[XDS.INP#What can go wrong with this file?]]&lt;br /&gt;
&lt;br /&gt;
[[Low dose data]]&lt;/div&gt;</summary>
		<author><name>Karine</name></author>
	</entry>
	<entry>
		<id>https://wiki.uni-konstanz.de/xds/index.php?title=Problems&amp;diff=3161</id>
		<title>Problems</title>
		<link rel="alternate" type="text/html" href="https://wiki.uni-konstanz.de/xds/index.php?title=Problems&amp;diff=3161"/>
		<updated>2015-06-04T14:07:27Z</updated>

		<summary type="html">&lt;p&gt;Karine: /* IDXREF produces too long axes */ corrected typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a collection of problems and their solutions.&lt;br /&gt;
&lt;br /&gt;
== XDS crashes ==&lt;br /&gt;
&lt;br /&gt;
XDS should never crash (if it terminates with an error message, this does not count as crash). If it does, it is either a bug in the program which should be brought to the attention of Wolfgang Kabsch or Kay Diederichs, and will be fixed, or it is a problem with your computer. &lt;br /&gt;
&lt;br /&gt;
If it crashes for the second reason, these are the things to try/consider:&lt;br /&gt;
&lt;br /&gt;
=== read error ===&lt;br /&gt;
&lt;br /&gt;
... may result in e.g.&lt;br /&gt;
&lt;br /&gt;
 forrtl: severe (24): end-of-file during read, unit 2, file bin1_01.tmp&lt;br /&gt;
&lt;br /&gt;
Any error message that XDS prints out afterwards is just a follow-up error. The most likely cause of the problem is that your disk is full, or your quota exceeded. You must fix the root problem before you can continue. &lt;br /&gt;
&lt;br /&gt;
=== huge frames leading to overflow of the shell&#039;s stack limit ===&lt;br /&gt;
&lt;br /&gt;
Increase the stack limit of your shell, e.g. (if using csh or tcsh) with &lt;br /&gt;
 limit stacksize 102400 &lt;br /&gt;
or (in case of bash)&lt;br /&gt;
 ulimit -s 102400 &lt;br /&gt;
The numbers above mean a 10-fold increase over the default, and should be enough. I&#039;ve found this to be necessary for unusually large frames (32 MB).&lt;br /&gt;
xds_par in this case also might need an increase of the environment variable OMP_STACKSIZE (e.g. &amp;quot;setenv OMP_STACKSIZE 128M&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
=== memory consumption exceeding the 4GB barrier when using the 32bit binary ===&lt;br /&gt;
&lt;br /&gt;
As pointed out by James Holton, the memory consumed by huge frames in combination with many threads may be larger than 32 bits allow. Execution then stops with &lt;br /&gt;
 forrtl: severe (41): insufficient virtual memory &lt;br /&gt;
The workaround is to limit the [http://homes.mpimf-heidelberg.mpg.de/~kabsch/xds/html_doc/xds_parameters.html MAXIMUM_NUMBER_OF_PROCESSORS], or to use XDS instead of XDS_PAR. An even better solution is to switch to the 64bit binary, but that of course requires a 64bit operating system.&lt;br /&gt;
&lt;br /&gt;
=== Problems with OpenMP ===&lt;br /&gt;
&lt;br /&gt;
If the &amp;quot;xds_par&amp;quot; binary crashed, try &amp;quot;xds&amp;quot;. xds_par uses OpenMP for parallelization, which adds complexity. If it works with xds, but not with xds_par, then there is a chance that some environment variable needs to be set/changed. In any case the XDS developers would like to learn about this.&lt;br /&gt;
&lt;br /&gt;
=== limitation of the parallel 32bit binary  ===&lt;br /&gt;
&lt;br /&gt;
The 32bit OpenMP binary may not be able to allocate enough storage when using many threads (e.g. &amp;gt;10). The error message might be something like:&lt;br /&gt;
&lt;br /&gt;
 OMP: Error #34: System unable to allocate necessary resources for OMP thread:&lt;br /&gt;
 OMP: System error #11: Resource temporarily unavailable&lt;br /&gt;
&lt;br /&gt;
=== 64bit binary on a 32 bit operating system ===&lt;br /&gt;
&lt;br /&gt;
If the error message is e.g.&lt;br /&gt;
 xds: Exec format error. Wrong Architecture.&lt;br /&gt;
or&lt;br /&gt;
 -bash: /usr/local/bin/xds: cannot execute binary file&lt;br /&gt;
make sure to use the 32bit version of XDS instead - you try to run the 64bit version on a 32bit operating system; this won&#039;t work.&lt;br /&gt;
&lt;br /&gt;
=== CPU without SSE2 support ===&lt;br /&gt;
&lt;br /&gt;
If the error message is&lt;br /&gt;
&lt;br /&gt;
 forrtl: severe (168): Program Exception - illegal instruction&lt;br /&gt;
 Image              PC        Routine            Line        Source&lt;br /&gt;
 xds                08055250  Unknown               Unknown  Unknown&lt;br /&gt;
 xds                0804B3F6  Unknown               Unknown  Unknown&lt;br /&gt;
&lt;br /&gt;
this means that unfortunately the CPU of your machine is too old to be supported by XDS (which in this respect is compiled with the default options of the ifort compiler). This may happen e.g. with old AMD CPUs that don&#039;t support SSE2 (on Linux check the &#039;&#039;flags&#039;&#039; field of /proc/cpuinfo for the presence of the sse2 flag).&lt;br /&gt;
&lt;br /&gt;
According to [http://en.wikipedia.org/wiki/SSE2#Notable_IA-32_CPUs_not_supporting_SSE2] the following Intel-compatible CPUs did not implement SSE2 after SSE2 was introduced (2001):&lt;br /&gt;
* AMD CPUs prior to Athlon 64, including all Socket A-based CPUs&lt;br /&gt;
* Intel CPUs prior to Pentium 4&lt;br /&gt;
* VIA C3&lt;br /&gt;
* Transmeta Crusoe&lt;br /&gt;
&lt;br /&gt;
=== ASSERT VIOLATION ===&lt;br /&gt;
&lt;br /&gt;
If you get e.g.&lt;br /&gt;
 !!! ERROR !!! ASSERT VIOLATION IN &amp;quot;RESTHKL&amp;quot;&lt;br /&gt;
this indicates that an internal error has occurred, i.e. some situation was hit that the program is not prepared to handle.&lt;br /&gt;
There must be something very special about your dataset - maybe a very small number of reflections, maybe only negative intensities, maybe something else - &lt;br /&gt;
which triggers the bug. If this happens then get in touch with the XDS developers - they will most likely ask to make your XDS.INP and data frames available to them, to fix the program.&lt;br /&gt;
&lt;br /&gt;
== Indexing failures ==&lt;br /&gt;
&lt;br /&gt;
In case of IDXREF problems, you should definitively inspect, using [[XDS-viewer]] or [[adxv]], the FRAME.cbf file which is written by COLSPOT. This file shows the first frame of the SPOT_RANGE, together with strong pixels that COLSPOT found on this frame, marked with white pixels. IDXREF will use those spot positions which have at least as many strong pixels as MINIMUM_NUMBER_OF_PIXELS_IN_A_SPOT specifies. &lt;br /&gt;
&lt;br /&gt;
You will only be able to look at this file if you prevent XDS from running INTEGRATE. This can be achieved e.g. by&lt;br /&gt;
&lt;br /&gt;
 JOB= XYCORR INIT COLSPOT IDXREF DEFPIX ! INTEGRATE CORRECT&lt;br /&gt;
&lt;br /&gt;
since otherwise, FRAME.cbf is overwritten by INTEGRATE. &lt;br /&gt;
&lt;br /&gt;
To look at &#039;&#039;&#039;all&#039;&#039;&#039; spot positions found by COLSPOT, you could try&lt;br /&gt;
 echo &amp;quot;set yrange [] reverse ; plot &#039;SPOT.XDS&#039; us 1:2 w dots&amp;quot; | gnuplot -persist&lt;br /&gt;
This may also help to find shaded regions on the detector.&lt;br /&gt;
&lt;br /&gt;
=== IDXREF ends with !!! ERROR !!! message ===&lt;br /&gt;
&lt;br /&gt;
These messages should really be called !!! WARNING !!!. The two types occuring most often are:&lt;br /&gt;
&lt;br /&gt;
  !!! ERROR !!! SOLUTION IS INACCURATE&lt;br /&gt;
This message is printed if the &amp;quot;STANDARD DEVIATION OF SPOT POSITION (PIXELS)&amp;quot; is larger than the MAXIMUM_ERROR_OF_SPOT_POSITION= (default of 3).&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 !!! ERROR !!! INSUFFICIENT PERCENTAGE (&amp;lt; 50%) OF INDEXED REFLECTIONS&lt;br /&gt;
This message is printed if less than the given percentage of reflections that COLSPOT found was actually indexed. If this occurs, it is clearly a warning sign.&lt;br /&gt;
&lt;br /&gt;
The message continues in both cases:&lt;br /&gt;
 AUTOMATIC DATA PROCESSING STOPPED. AS THE CRITERIA FOR A GOOD&lt;br /&gt;
 SOLUTION ARE RATHER STRICT, YOU MAY CHOOSE TO CONTINUE DATA&lt;br /&gt;
 PROCESSING AFTER CHANGING THE &amp;quot;JOB=&amp;quot;-CARD IN &amp;quot;XDS.INP&amp;quot; TO&lt;br /&gt;
 &amp;quot;JOB= DEFPIX INTEGRATE CORRECT&amp;quot;.&lt;br /&gt;
 IF THE BEST SOLUTION IS REALLY NONSENSE YOU SHOULD FIRST HAVE&lt;br /&gt;
 A LOOK AT THE ASCII-FILE &amp;quot;SPOT.XDS&amp;quot;. THIS FILE CONTAINS THE&lt;br /&gt;
 INITIAL SPOT LIST SORTED IN DECREASING SPOT INTENSITY. SPOTS&lt;br /&gt;
 NEAR THE END OF THE FILE MAY BE ARTEFACTS AND SHOULD BE ERASED.&lt;br /&gt;
 ALTERNATIVELY YOU MAY TRY DIFFERENT VALUES FOR &amp;quot;INDEX_ORIGIN&amp;quot;&lt;br /&gt;
 AS SUGGESTED IN THE ABOVE LISTING.&lt;br /&gt;
 IF THE CRYSTAL HAS SLIPPED AT THE BEGINNING OF DATA COLLECTION&lt;br /&gt;
 YOU MAY CHOOSE TO SKIP SOME OF THE FIRST FRAMES BY CHANGING&lt;br /&gt;
 THE &amp;quot;DATA_RANGE=&amp;quot; IN FILE &amp;quot;XDS.INP&amp;quot; AND START ALL OVER AGAIN.&lt;br /&gt;
&lt;br /&gt;
This is printed out for you to actually read, and take action accordingly. In most cases you just change the JOBS - line in XDS.INP to read&lt;br /&gt;
 JOB= DEFPIX INTEGRATE CORRECT&lt;br /&gt;
and then continue to run XDS. In other cases you may want to change SPOT.XDS, or other keywords in [[XDS.INP]] (see also below). But in any case this is an important alert that should make you check the correctness of the parameters that describe the data collection (X-RAY_WAVELENGTH, DETECTOR_DISTANCE, ORGX, ORGY, OSCILLATION_RANGE, NAME_TEMPLATE_OF_DATA_FRAMES).&lt;br /&gt;
&lt;br /&gt;
=== IDXREF produces too short cell parameter(s) ===&lt;br /&gt;
&lt;br /&gt;
The first table &amp;quot;CLUSTER COORDINATES AND INDICES WITH RESPECT TO REC. LATTICE BASIS VECTORS&amp;quot; should show close-to-integer difference vectors. The following is an example how it should &#039;&#039;not&#039;&#039; look like:&lt;br /&gt;
   #  COORDINATES OF REC. BASIS VECTOR    LENGTH   1/LENGTH&lt;br /&gt;
 &lt;br /&gt;
    1  -0.0000476-0.0014008-0.0044654  0.0046802     213.67&lt;br /&gt;
    2  -0.0101960-0.0056194 0.0019466  0.0118037      84.72&lt;br /&gt;
    3  -0.0145331 0.0238225-0.0071754  0.0288134      34.71&lt;br /&gt;
 &lt;br /&gt;
 CLUSTER COORDINATES AND INDICES WITH RESPECT TO REC. LATTICE BASIS VECTORS &lt;br /&gt;
   #  COORDINATES OF VECTOR CLUSTER   FREQUENCY       CLUSTER INDICES   &lt;br /&gt;
    1  0.0004199-0.0012633-0.0043826     2442.      0.97     -0.04     -0.00&lt;br /&gt;
    2  0.0101757 0.0060701-0.0019630     2175.     -0.03     -1.02      0.01&lt;br /&gt;
    3 -0.0076118 0.0114167-0.0040603     1965.      0.13      0.04      0.50&lt;br /&gt;
    4  0.0100552 0.0071646 0.0025337     1944.     -1.01     -0.99      0.01&lt;br /&gt;
    5  0.0072840-0.0101455 0.0084405     1841.     -1.10     -0.01     -0.49&lt;br /&gt;
    6  0.0000976 0.0027828 0.0089584     1792.     -2.00      0.00     -0.00&lt;br /&gt;
    7  0.0103103 0.0043851-0.0063902     1790.      0.98     -1.02      0.00&lt;br /&gt;
    8  0.0025742 0.0163995-0.0098507     1760.      0.95     -0.99      0.51&lt;br /&gt;
    9  0.0068686-0.0089437 0.0128884     1724.     -2.08      0.03     -0.49&lt;br /&gt;
   10 -0.0174443 0.0123504 0.0161324     1694.     -4.01      0.99      0.52&lt;br /&gt;
   11  0.0272195-0.0050005-0.0136142     1678.      2.99     -1.97     -0.50&lt;br /&gt;
  ...&lt;br /&gt;
 &lt;br /&gt;
 PARAMETERS OF THE REDUCED CELL (ANGSTROEM &amp;amp; DEGREES)&lt;br /&gt;
     34.71     84.72    213.67     90.35     90.27     90.06&lt;br /&gt;
Do you see the half-integer difference vectors in the last column? This clearly indicates that the third axis above the table (with 1/length=34.71) actually should be twice that size. If this happens, the histogram of indexed spots often has two equally-large subtrees:&lt;br /&gt;
 SUBTREE    POPULATION&lt;br /&gt;
 &lt;br /&gt;
     1          976&lt;br /&gt;
     2          972&lt;br /&gt;
     3           10&lt;br /&gt;
     4            7&lt;br /&gt;
     5            6&lt;br /&gt;
&lt;br /&gt;
Remedy: take the reduced cell (as found below the table), but double the 34.71, and stick it into the line&lt;br /&gt;
 UNIT_CELL_CONSTANTS=69.42     84.72    213.67     90.35     90.27     90.06 &lt;br /&gt;
in XDS.INP. To make XDS actually &#039;&#039;use&#039;&#039; that line, specify &lt;br /&gt;
 SPACE_GROUP_NUMBER=1&lt;br /&gt;
and leave the space group determination for later.&lt;br /&gt;
&lt;br /&gt;
Alternatively, try several well-separated SPOT_RANGEs instead of 1. For example, instead of&lt;br /&gt;
 SPOT_RANGE=1 900&lt;br /&gt;
try e.g.&lt;br /&gt;
 SPOT_RANGE=1 100&lt;br /&gt;
 SPOT_RANGE=801 900&lt;br /&gt;
In the cases where I&#039;ve tried this, this splitting of SPOT_RANGE into several wedges always resulted in IDXREF picking up the correct cell. &lt;br /&gt;
&lt;br /&gt;
The reason for the indexing failure in these cases seems to be the fact that the crystal changed its orientation within the SPOT_RANGE by more than ~ 0.1°.&lt;br /&gt;
&lt;br /&gt;
=== IDXREF produces too long axes ===&lt;br /&gt;
&lt;br /&gt;
This may (rarely) happen when MAXIMUM_NUMBER_OF_JOBS is &amp;gt; 1. In this case, different JOBS&#039; COLSPOT runs may report some reflections twice in SPOT.XDS. Since their phi values are close, they correspond to long unit cell parameters. This happens more easily if the mosaicity is high and therefore reflections extend over the borders between JOBs. &lt;br /&gt;
&lt;br /&gt;
This effect may be mitigated by having as many SPOT_RANGEs as JOBs, and leaving gaps between the SPOT_RANGEs.&lt;br /&gt;
&lt;br /&gt;
=== IDXREF prints !!! WARNING !!! message ===&lt;br /&gt;
&lt;br /&gt;
If you see&lt;br /&gt;
 !!! WARNING !!! REFINEMENT DID NOT CONVERGE&lt;br /&gt;
                 LAST CORRECTION SHIFT WAS   6.1E-02 (should be &amp;lt;  1.0E-03)&lt;br /&gt;
then try the following: find the line&lt;br /&gt;
 REFINE(IDXREF)= ...&lt;br /&gt;
in XDS.INP. If it is commented out with a !, remove the !. Then, change it to have&lt;br /&gt;
 REFINE(IDXREF)=CELL BEAM ORIENTATION AXIS ! DISTANCE&lt;br /&gt;
i.e. remove DISTANCE from the list of refinable parameters. Once that is done, save XDS.INP and re-run the IDXREF step.&lt;br /&gt;
&lt;br /&gt;
This problem occurs if the DISTANCE is large, and XDS cannot refine it meaningfully.&lt;br /&gt;
&lt;br /&gt;
If this does not help, try to refine even less items, e.g. leave out AXIS.&lt;br /&gt;
&lt;br /&gt;
=== IDXREF.LP does not show the expected lattice ===&lt;br /&gt;
&lt;br /&gt;
By specifying the spacegroup and unitcell, you tell XDS that it should index based on those reflections that match that spacegroup and unitcell. In a sense, you _force_ that spacegroup and cell. This will discard other (spurious?) reflections, and usually leads to a clean list of Bravais lattice possibilities.&lt;br /&gt;
&lt;br /&gt;
If the data reduction fails nevertheless (in terms of bad R-factors and [[CORRECT#An estimate for the overall quality of an experimental setup|ISa]] in the [[CORRECT]] step), then chances are that you specified some parameter wrongly, or not accurate enough (ORGY and ORGY are the most likely candidates), or that the crystal does not match your idea about its spacegroup and unit cell. Actually the latter happens pretty frequently (which is why it is always the safest way to collect 180° of spindle rotation unless you know your crystals very well; this is also a good strategy in other respects).&lt;br /&gt;
&lt;br /&gt;
If you tell XDS that you do not to know the spacegroup (SPACE_GROUP_NUMBER= 0), then [[IDXREF]] takes all observed reflections into account. By design, the spacegroup decision is then postponed until the CORRECT step, or rather to a run of [[pointless]] after CORRECT, and it may be not vital to closely inspect IDXREF.LP, because CORRECT.LP has basically the same information, plus more.&lt;br /&gt;
&lt;br /&gt;
=== none of the lattices in IDXREF.LP (except aP) has a good QUALITY OF FIT ===&lt;br /&gt;
&lt;br /&gt;
It is a good idea to use many frames for the SPOT_RANGE, (e.g. the first half of the DATA_RANGE, as does the [[generate_XDS.INP]] script) for the COLSPOT and IDXREF steps. &lt;br /&gt;
&lt;br /&gt;
It is entirely possible to run COLSPOT for the &#039;&#039;complete&#039;&#039; DATA_RANGE (in that case the parameters of SPOT_RANGE are the same as for the DATA_RANGE), and to try smaller SPOT_RANGEs in IDXREF - this means COLSPOT has to be run only once, and the JOBS= line has e.g. &lt;br /&gt;
 JOBS= IDXREF &lt;br /&gt;
only. Maybe some SPOT_RANGE sub-range gives a clear answer. In that case it may be useful to use&lt;br /&gt;
 REFINE(INTEGRATE)=! AXIS BEAM ORIENTATION CELL DISTANCE&lt;br /&gt;
because otherwise the spurious reflections in the other ranges will probably disturb the on-the-fly refinement of parameters.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve seen datasets where each reflection had a satellite associated with the main reflection, but separate from it. This is well visible in FRAME.cbf written by COLSPOT. In such a case it helps to use&lt;br /&gt;
 MINIMUM_NUMBER_OF_PIXELS_IN_A_SPOT= 12 ! re-run COLSPOT after changing the parameter !&lt;br /&gt;
thus doubling (w.r.t. the default of 6) the required spotsize that makes a reflection be used for indexing. In the latest case this made it possible to index cleanly on a single frame (which is actually not uncommon).&lt;br /&gt;
&lt;br /&gt;
A final possibility: your crystal may really be triclinic - hopefully you collected 180° of data, or even a bit more than that.&lt;br /&gt;
&lt;br /&gt;
== Integration failure ==&lt;br /&gt;
&lt;br /&gt;
If INTEGRATE stops after e.g.&lt;br /&gt;
 ******************************************************************************&lt;br /&gt;
                     PROCESSING OF IMAGES      136 ...     140&lt;br /&gt;
 ******************************************************************************&lt;br /&gt;
with &lt;br /&gt;
 !!! ERROR !!! AUTOMATIC DETERMINATION OF SPOT SIZE PARAMETERS HAS FAILED.&lt;br /&gt;
               YOU MAY RESTART THIS STEP AFTER SPECIFYING VALUES IN XDS.INP FOR:&lt;br /&gt;
               REFLECTING_RANGE=    REFLECTING_RANGE_E.S.D.=&lt;br /&gt;
               BEAM_DIVERGENCE=     BEAM_DIVERGENCE_E.S.D.= &lt;br /&gt;
&lt;br /&gt;
then you should reduce the upper limit of the DATA_RANGE, to stop before the problematic frames, and re-run INTEGRATE. In this example, you would modify XDS.INP to have&lt;br /&gt;
 DATA_RANGE=1 135&lt;br /&gt;
 JOB=INTEGRATE CORRECT&lt;br /&gt;
Save XDS.INP, run XDS and inspect INTEGRATE.LP, to find the lines (e.g.)&lt;br /&gt;
 BEAM_DIVERGENCE=   0.478  BEAM_DIVERGENCE_E.S.D.=   0.048&lt;br /&gt;
 REFLECTING_RANGE=  1.100  REFLECTING_RANGE_E.S.D.=  0.157&lt;br /&gt;
Copy them to XDS.INP. Restore the original DATA_RANGE and continue.&lt;br /&gt;
&lt;br /&gt;
Another error mode of INTEGRATE (in processing of small-molecule data) is ...&lt;br /&gt;
 IMAGE IER  SCALE     NBKG NOVL NEWALD NSTRONG  NREJ  SIGMAB  SIGMAR&lt;br /&gt;
     5   0  0.975  3968463    1      5       1     0  0.1028  1.3486&lt;br /&gt;
     6   0  0.967  3969949    2      2       2     0  0.1688  0.0000&lt;br /&gt;
     7   0  0.929  3975306    0      3       0     0  0.0000  0.0000&lt;br /&gt;
  !!! ERROR !!! CANNOT ALLOCATE MEMORY&lt;br /&gt;
               YOU COULD RERUN THIS STEP WITH SMALLER VALUES FOR THE PARAMETERS&lt;br /&gt;
               NUMBER_OF_PROFILE_GRID_POINTS_ALONG_ALPHA/BETA=&lt;br /&gt;
               NUMBER_OF_PROFILE_GRID_POINTS_ALONG_GAMMA=&lt;br /&gt;
The error message is misleading in this case: there are too few reflections to build the average profile. The fix is: restart INTEGRATE after inserting e.g.&lt;br /&gt;
 DELPHI=20 ! default is 5, so try with e.g. 10, 20, 45, 90, 180 &lt;br /&gt;
and re-run INTEGRATE.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
[[XDS.INP#What can go wrong with this file?]]&lt;br /&gt;
&lt;br /&gt;
[[Low dose data]]&lt;/div&gt;</summary>
		<author><name>Karine</name></author>
	</entry>
	<entry>
		<id>https://wiki.uni-konstanz.de/xds/index.php?title=Scripts_and_interfaces&amp;diff=3038</id>
		<title>Scripts and interfaces</title>
		<link rel="alternate" type="text/html" href="https://wiki.uni-konstanz.de/xds/index.php?title=Scripts_and_interfaces&amp;diff=3038"/>
		<updated>2014-09-10T13:39:11Z</updated>

		<summary type="html">&lt;p&gt;Karine: update&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is a number of script and graphical interfaces for the XDS package.&lt;br /&gt;
&lt;br /&gt;
== XDSi ==&lt;br /&gt;
&lt;br /&gt;
the first published interface, by Petri Kursula (XDSi: a graphical interface for the data processing program XDS. (2004) J. Appl. Cryst. 37, 347-348).&lt;br /&gt;
&lt;br /&gt;
http://cc.oulu.fi/~pkursula/xdsi.html gives 2007 as last modification date.&lt;br /&gt;
&lt;br /&gt;
== [[XDSi]] ==&lt;br /&gt;
&lt;br /&gt;
Tcl/Tk interface by Michael Krug (Welte/Diederichs lab). Unfortunately same name. Can process multiple datasets. &lt;br /&gt;
&lt;br /&gt;
== XDSAPP ==&lt;br /&gt;
&lt;br /&gt;
python/Qt version of [[XDSi]], developed at [http://www.helmholtz-berlin.de/forschung/oe/em/soft-matter/forschung/bessy-mx/xdsapp/index_en.html BESSY].&lt;br /&gt;
&lt;br /&gt;
== [[XDSGUI]] ==&lt;br /&gt;
&lt;br /&gt;
to edit input files and run commands.&lt;br /&gt;
&lt;br /&gt;
== ixds ==&lt;br /&gt;
&lt;br /&gt;
python script programmed at BESSY.&lt;br /&gt;
&lt;br /&gt;
== autoxds ==&lt;br /&gt;
&lt;br /&gt;
script in use at SSRL (Stanford) . See [http://smb.slac.stanford.edu/facilities/software/xds/ A Quick XDS Tutorial for SSRL].&lt;br /&gt;
&lt;br /&gt;
Download: http://smb.slac.stanford.edu/templates/xds/autoxds ; download http://smb.slac.stanford.edu/templates/xds/mccd_xdsparams.pl , too!&lt;br /&gt;
&lt;br /&gt;
== autoPROC ==&lt;br /&gt;
&lt;br /&gt;
software package, not exclusively using XDS, available at http://www.globalphasing.com/autoproc/ (Vonrhein &#039;&#039;et al.&#039;&#039; (2011). Acta Cryst. D67, 293-302)&lt;br /&gt;
&lt;br /&gt;
== AutoProcess ==&lt;br /&gt;
&lt;br /&gt;
Pipeline developed by Michel Fodje at Canadian Macromolecular Crystallography Facility (Saskatoon).&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
&lt;br /&gt;
    autoprocess [options] /path/to/set1.img /path/to/set2.img ... /path/to/setn.img&lt;br /&gt;
&lt;br /&gt;
    options:&lt;br /&gt;
        --mad, -m : Process each set, scale together and generate separate reflection files.&lt;br /&gt;
        --screen, -s : Process a few frames from characterize crystal from each set.&lt;br /&gt;
        --anom, -a : Process with Friedel&#039;s law False&lt;br /&gt;
        --backup, -b : Backup previous output directory if it exists&lt;br /&gt;
        --prefix=p1,p2,p3 : comma separated list of prefixes to use for output files. &lt;br /&gt;
            Default is first part of image name&lt;br /&gt;
            prefix order should correspond to the order of the data sets&lt;br /&gt;
              for example for MAD data, use --prefix=peak,infl,remo&lt;br /&gt;
        --dir=/path : Directory to store processed results. Default is to create a  new one in the current directory.&lt;br /&gt;
        --inputs, -i: generate XDS.INP only and quit&lt;br /&gt;
        --help, -h : display this message&lt;br /&gt;
    Default (no option): Process each set, scale together and merge into one reflection file.&lt;br /&gt;
    &lt;br /&gt;
    Data sets:&lt;br /&gt;
        Each data set can be represented by any frame from that set.&lt;br /&gt;
&lt;br /&gt;
== xdsme ==&lt;br /&gt;
&lt;br /&gt;
by Pierre Legrand at SOLEIL (French synchrotron): web address: http://code.google.com/p/xdsme/&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a short description of the program:&lt;br /&gt;
&lt;br /&gt;
xdsme is a collection of python scripts made to simplify the processing of crystal &lt;br /&gt;
diffraction images with the XDS Program Package. Provided that the diffraction&lt;br /&gt;
parameters are well recorded in the diffraction image headers, XDS data processing &lt;br /&gt;
can be started with a simple command line like:&lt;br /&gt;
&lt;br /&gt;
 $ xdsme pos1_1_???.img&lt;br /&gt;
&lt;br /&gt;
Supported detector image format include: ADSC, MARCCD, MAR345 + experimental &lt;br /&gt;
for PILATUS, SATURN, RAXIS and MAR555.&lt;br /&gt;
&lt;br /&gt;
* xdsme (XDS.py), xscale.py and xdsconv.py for data processing, scaling and file conversion.&lt;br /&gt;
* XOalign.py for the goniometer setting calculation (to work with different type of goniometer including Kappa, mini-Kappa, Euler...).&lt;br /&gt;
* xds2mos.py or xds2dnz.py ... (for conversion of orientation matrices)&lt;br /&gt;
&lt;br /&gt;
== [[generate_XDS.INP]] ==&lt;br /&gt;
&lt;br /&gt;
is a script for generating a XDS.INP for a given dataset. Under development; works well for MarCCD, ADSC and Pilatus detectors.&lt;/div&gt;</summary>
		<author><name>Karine</name></author>
	</entry>
	<entry>
		<id>https://wiki.uni-konstanz.de/xds/index.php?title=Talk:Generate_XDS.INP&amp;diff=3037</id>
		<title>Talk:Generate XDS.INP</title>
		<link rel="alternate" type="text/html" href="https://wiki.uni-konstanz.de/xds/index.php?title=Talk:Generate_XDS.INP&amp;diff=3037"/>
		<updated>2014-09-10T09:00:39Z</updated>

		<summary type="html">&lt;p&gt;Karine: reference?&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Reference ==&lt;br /&gt;
Hello,&lt;br /&gt;
&lt;br /&gt;
when mentionning the use of generate_XDS.INP in a paper, which reference should be given? [[User:Karine|Karine]] ([[User talk:Karine|talk]]) 11:00, 10 September 2014 (CEST)&lt;/div&gt;</summary>
		<author><name>Karine</name></author>
	</entry>
	<entry>
		<id>https://wiki.uni-konstanz.de/xds/index.php?title=Generate_XDS.INP&amp;diff=2887</id>
		<title>Generate XDS.INP</title>
		<link rel="alternate" type="text/html" href="https://wiki.uni-konstanz.de/xds/index.php?title=Generate_XDS.INP&amp;diff=2887"/>
		<updated>2014-03-10T10:09:19Z</updated>

		<summary type="html">&lt;p&gt;Karine: Calling generate_XDS.INP from a Python script&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;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.&lt;br /&gt;
&lt;br /&gt;
On Mac OS X, installation of the &amp;quot;Command Line Tools&amp;quot; (from http://developer.apple.com/downloads; requires Apple ID) is required (I think). These are a part of the (larger, but also free) [http://developer.apple.com/tools/xcode Xcode] package.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
Usage is just (don&#039;t forget the quotation marks!):&lt;br /&gt;
 generate_XDS.INP &amp;quot;/home/myname/frms/mydata_1_???.img&amp;quot;&lt;br /&gt;
XDS [http://strucbio.biologie.uni-konstanz.de/~dikay/XDS_html_doc/html_doc/xds_parameters.html#NAME_TEMPLATE_OF_DATA_FRAMES= supports] bzip2-ed frames. Thus, when specifying the frame name parameter of the script, you should leave out any .bz2 extension.&lt;br /&gt;
&lt;br /&gt;
For improved interaction with [[XDSGUI]], it is advantageous to use an &#039;&#039;absolute&#039;&#039; filename - one that starts with a slash (&amp;quot;/&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
== The script ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash                                                                   &lt;br /&gt;
# purpose: generate XDS.INP                                                   &lt;br /&gt;
#                                                                             &lt;br /&gt;
# tested with some datasets from ALS, SSRL, SLS, ESRF, BESSY, SPring-8 and PF; only MARCCD, ADSC/SMV, PILATUS, RAXIS (in-house) detectors; &lt;br /&gt;
# for other detectors, values marked with XXX must be manually filled in.                                  &lt;br /&gt;
#                                                                                                          &lt;br /&gt;
# revision 0.03 . Kay Diederichs 2/2010                                                                    &lt;br /&gt;
# revision 0.04 . Kay Diederichs 4/2010 - include alternative ORGX, ORGY calculations for ADSC             &lt;br /&gt;
# revision 0.05 . Kay Diederichs 5/2010 - grep for &amp;quot;Corrected&amp;quot; in addition to &amp;quot;marccd&amp;quot;; needed for BESSY   &lt;br /&gt;
# revision 0.06 . KD 6/2010 - add UNTRUSTED_RECTANGLE and UNTRUSTED_ELLIPSE; use `whereis catmar` and so on &lt;br /&gt;
# revision 0.07 . KD 6/2010 - decide about ORGX/Y info in MAR header being pixels or mm; other fixes        &lt;br /&gt;
# revision 0.08 . KD 6/2010 - fixes for Pilatus 6M                                                          &lt;br /&gt;
# revision 0.09 . KD 6/2010 - get rid of requirement for mccd_xdsparams.pl and/or catmar; rather use &amp;quot;od&amp;quot;   &lt;br /&gt;
# revision 0.10 . Tim Gruene 7/2010 - set link &#039;images&#039; to image directory if path exceeds 72 characters    &lt;br /&gt;
# revision 0.11 . KD 7/2010 - for MarCCD: look for distance info at different byte position                 &lt;br /&gt;
# revision 0.12 . KD 7/2010 - fix for negative PHISTART                                                     &lt;br /&gt;
# revision 0.13 . KD 8/2010 - store correct NX NY QX QY in XDS.INP                                          &lt;br /&gt;
# revision 0.14 . KD 1/2011 - SENSOR_THICKNESS for Pilatus; MINIMUM_NUMBER_OF_PIXELS_IN_A_SPOT=3            &lt;br /&gt;
# revision 0.15 . KD 2/2011 - add comment for -ive sign of APS 19-ID and Australian Synchrotron rotation axis&lt;br /&gt;
# revision 0.16 . KD 3/2011 - SENSOR_THICKNESS=0.01 for ADSC and MarCCD. Add comment about SILICON=          &lt;br /&gt;
# revision 0.17 . KD 3/2011 - make it work for .bz2 frames; improve screen output                            &lt;br /&gt;
# revision 0.18 . KD 4/2011 - faster by doing &amp;quot;strings&amp;quot; only once; revert &amp;quot;images/${1##/*/}&amp;quot; &amp;quot;correction&amp;quot;    &lt;br /&gt;
# revision 0.19 . KD 6/2011 - bugfix for 0.18                                                                &lt;br /&gt;
# revision 0.20 . KD 7/2011 - redirect stderr of /bin/ls to /dev/null                                        &lt;br /&gt;
# revision 0.21 . KD 11/2011 - SEPMIN, CLUSTER_RADIUS hints; read NX NY from header (for Pilatus 2M)&lt;br /&gt;
# revision 0.22 . KD 12/2011 - Pilatus 2M UNTRUSTED_RECTANGLE lines, SENSOR_THICKNESS from header&lt;br /&gt;
# revision 0.23 . KD 1/2012 - add UNTRUSTED_QUADRILATERAL, remove MINIMUM_ZETA (0.05 is default now)&lt;br /&gt;
# revision 0.24 . KD 3/2012 - remove revision 0.10 since XDS now takes much longer paths&lt;br /&gt;
# revision 0.25 . KD 3/2012 - remove revision 0.22 for PSI Pilatus 2M; see http://www.globalphasing.com/autoproc/wiki/index.cgi?TroubleShootingKnownIssues&lt;br /&gt;
# revision 0.26 . KD 7/2012 - Mac-compatibility: replace od flags --skip-bytes= and --read-bytes= with -j and -N (thanks to Oliver Clarke for working this out!)&lt;br /&gt;
# revision 0.27 . KD 11/2012 - EXCLUDE_RESOLUTION_RANGE lines and generic Pilatus Flat_field test&lt;br /&gt;
# revision 0.28 . Keitaro 11/2012 - for MarCCD: read oscillation range from the position 1024+736 (fix for omega rotation)&lt;br /&gt;
# revision 0.29 . KD 1/2013 - include UNTRUSTED_RECTANGLEs for Pilatus 6M; never hurts but needed if the beamline software does not mark them with -2 or such&lt;br /&gt;
# revision 0.30 . Keitaro 3/2013 - for ADSC: write all possible beam center conventions in XDS.INP as comments&lt;br /&gt;
# revision 0.31 . Keitaro 3/2013 - add comment for reversed phi for SPring-8&lt;br /&gt;
# revision 0.32 . Keitaro 3/2013 - add RAXIS support. only tested with RAXIS IV++ and VII.&lt;br /&gt;
# revision 0.33 . Keitaro 5/2013 - automatically set ROTATION_AXIS=-1 0 0 for SPring-8 BL32XU/41XU/44XU beamlines based on detector serial numbers.&lt;br /&gt;
# revision 0.34 . Keitaro 5/2013 - recognize ADSC detectors in Photon Factory and choose correct beam center convention based on detector serial numbers.&lt;br /&gt;
# revision 0.35 . KD 6/2013 - reduce 7000 to 6000 for shadow detection; insert comment about *_RESOLUTION_RANGE lines&lt;br /&gt;
# revision 0.36 . KD 6/2013 - insert NUMBER_OF_PROFILE_GRID* lines for Pilatus (suggested by C.Vonrhein)&lt;br /&gt;
# revision 0.37 . Keitaro 10/2013 - fix for MX225HS detector on SPring-8 BL32XU (Ignore case when matching marccd in header); but cannot decide reverse-phi because of missing detector S/N&lt;br /&gt;
# revision 0.38 . KD 2/2014 - change defaults for REFINE(IDXREF) and REFINE(INTEGRATE) such that more stable results are obtained for difficult datasets&lt;br /&gt;
REVISION=&amp;quot;0.38 (15-February-2014)&amp;quot;&lt;br /&gt;
#                                                                                                            &lt;br /&gt;
# usage: e.g. generate_XDS.INP &amp;quot;frms/mydata_1_???.img&amp;quot;                                                       &lt;br /&gt;
# make sure to have the two quotation marks !                                                                &lt;br /&gt;
# the ? are wildcards for the frame numbers.                                                                 &lt;br /&gt;
#                                                                                                            &lt;br /&gt;
# limitations:                                                                                               &lt;br /&gt;
# - frame numbers are assumed to start with 1 and run consecutively                                          &lt;br /&gt;
#                                                                                                            &lt;br /&gt;
# known problems:                                                                                            &lt;br /&gt;
# - for ADSC detectors, there are at least three ways to obtain ORGX and ORGY values from the header (see below);&lt;br /&gt;
# - the same might be a problem for MAR headers, too (not sure about this) &lt;br /&gt;
# - on Mac OS X, Xcode (from http://developer.apple.com/tools/xcode) might be needed - not sure about this                               &lt;br /&gt;
#                                                                                                                &lt;br /&gt;
# notes for debugging of the script:                                                                             &lt;br /&gt;
# - add the -v option to the first line, to see where an error occurs                                            &lt;br /&gt;
# - comment out the removal of tmp1 and tmp2 in the last line                                                    &lt;br /&gt;
#                                                                                                                &lt;br /&gt;
# ====== Start of script ======                                                                                  &lt;br /&gt;
echo generate_XDS.INP version $REVISION . Obtain the latest version from                                         &lt;br /&gt;
echo http://strucbio.biologie.uni-konstanz.de/xdswiki/index.php/generate_XDS.INP                                 &lt;br /&gt;
if [ &amp;quot;$1&amp;quot; == &amp;quot;help&amp;quot; ] || [ &amp;quot;$1&amp;quot; == &amp;quot;-help&amp;quot; ] || [ &amp;quot;$1&amp;quot; == &amp;quot;-h&amp;quot; ]; then                                           &lt;br /&gt;
  echo usage: generate_XDS.INP \&amp;quot;frms/mydata_1_???.img\&amp;quot;   \(_with_ the quotation marks!\)                       &lt;br /&gt;
  echo if the frames are compressed with bzip2, leave out the .bz2 extension!                                    &lt;br /&gt;
  exit                                                                                                           &lt;br /&gt;
fi                                                                                                               &lt;br /&gt;
#                                                                                                                &lt;br /&gt;
# defaults:                                                                                                      &lt;br /&gt;
#                                                                                                                &lt;br /&gt;
DETECTOR=&amp;quot;XXX MINIMUM_VALID_PIXEL_VALUE=XXX OVERLOAD=XXX&amp;quot;                                                        &lt;br /&gt;
REVERSE_PHI=&amp;quot;no&amp;quot;&lt;br /&gt;
ORGX=XXX                                                                                                         &lt;br /&gt;
ORGY=XXX                                                                                                         &lt;br /&gt;
DETECTOR_DISTANCE=XXX                                                                                            &lt;br /&gt;
OSCILLATION_RANGE=XXX                                                                                            &lt;br /&gt;
X_RAY_WAVELENGTH=XXX                                                                                             &lt;br /&gt;
QX=XXX                                                                                                           &lt;br /&gt;
QY=XXX                                                                                                           &lt;br /&gt;
NX=XXX                                                                                                           &lt;br /&gt;
NY=XXX                                                                                                           &lt;br /&gt;
SENSOR_THICKNESS=0                                                                                               &lt;br /&gt;
# see how we are called:                                                                                         &lt;br /&gt;
NAME_TEMPLATE_OF_DATA_FRAMES=&amp;quot;$1&amp;quot;&lt;br /&gt;
# list frames matching the wildcards in NAME_TEMPLATE_OF_DATA_FRAMES&lt;br /&gt;
# don&#039;t accept the &amp;quot;direct beam&amp;quot; shot at SLS/Pilatus PX-I and PX-II &lt;br /&gt;
/bin/ls -C1 $1 $1.bz2 2&amp;gt;/dev/null | egrep -v &amp;quot;_00000.cbf|_000.img&amp;quot; &amp;gt; tmp1 || exit 1&lt;br /&gt;
&lt;br /&gt;
# we can continue - the frames are found&lt;br /&gt;
&lt;br /&gt;
# set upper limit of DATA_RANGE to number of frames (see &amp;quot;limitations&amp;quot; above)&lt;br /&gt;
DATA_RANGE=`wc -l tmp1 | awk &#039;{print $1}&#039;`                                   &lt;br /&gt;
&lt;br /&gt;
# set upper limit of SPOT_RANGE to half of DATA_RANGE, but not less than 1&lt;br /&gt;
SPOT_RANGE=`echo &amp;quot;scale=0; $DATA_RANGE/2&amp;quot; | bc -l`                        &lt;br /&gt;
SPOT_RANGE=`echo &amp;quot;if ($SPOT_RANGE&amp;lt;1) 1;if ($SPOT_RANGE&amp;gt;1) $SPOT_RANGE&amp;quot; | bc -l`&lt;br /&gt;
&lt;br /&gt;
echo DATA_RANGE=1 $DATA_RANGE&lt;br /&gt;
&lt;br /&gt;
# find out detector type&lt;br /&gt;
DET=XXX                 &lt;br /&gt;
FIRSTFRAME=`head -1 tmp1`&lt;br /&gt;
echo $FIRSTFRAME | grep -q bz2 &amp;amp;&amp;amp; bzcat $FIRSTFRAME &amp;gt; tmp1 &amp;amp;&amp;amp; FIRSTFRAME=tmp1&lt;br /&gt;
strings $FIRSTFRAME &amp;gt; tmp2                                                   &lt;br /&gt;
egrep -qi &#039;marccd|Corrected&#039; tmp2 &amp;amp;&amp;amp; DET=mccd                                 &lt;br /&gt;
grep -q PILATUS tmp2             &amp;amp;&amp;amp; DET=pilatus                              &lt;br /&gt;
grep -q BEAM_CENTER_X tmp2       &amp;amp;&amp;amp; DET=adsc                                 &lt;br /&gt;
head -n1 tmp2 | grep -q &amp;quot;^RAXIS&amp;quot; &amp;amp;&amp;amp; DET=raxis&lt;br /&gt;
# identify other detector types in the same way (MAR IP would be straightforward)&lt;br /&gt;
&lt;br /&gt;
# parse ASCII header of first frame&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$DET&amp;quot; == &amp;quot;XXX&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;this is not a MAR, ADSC/SMV or PILATUS detector - fill in XXX values manually!&amp;quot;&lt;br /&gt;
  DETECTOR=&amp;quot;XXX MINIMUM_VALID_PIXEL_VALUE=XXX OVERLOAD=XXX&amp;quot;                            &lt;br /&gt;
&lt;br /&gt;
# find parameters of first frame&lt;br /&gt;
elif [ &amp;quot;$DET&amp;quot; == &amp;quot;mccd&amp;quot; ]; then &lt;br /&gt;
  echo Data from a MarCCD detector&lt;br /&gt;
                                  &lt;br /&gt;
  DETECTOR=&amp;quot;CCDCHESS MINIMUM_VALID_PIXEL_VALUE= 1 OVERLOAD= 65500&amp;quot;&lt;br /&gt;
  SENSOR_THICKNESS=0.01                                           &lt;br /&gt;
  # use first frame of dataset to obtain parameters               &lt;br /&gt;
&lt;br /&gt;
  # Check detector serial number and recognize beamline for reversed-phi setting.&lt;br /&gt;
  # Known detectors for reversed-phi in SPring-8: 31: BL32XU MX225HE, 38: BL44XU MX225HE, 42: BL44XU MX300HE, 40: BL41XU MX225HE&lt;br /&gt;
  REVERSEPHI_SNs=&amp;quot;&lt;br /&gt;
31&lt;br /&gt;
38&lt;br /&gt;
40&lt;br /&gt;
42&lt;br /&gt;
&amp;quot;&lt;br /&gt;
  # get detector serial number and check if it is included in the list&lt;br /&gt;
  DET_SN=`grep &amp;quot;Detector Serial Number =&amp;quot; tmp2 | sed &amp;quot;s/Detector Serial Number = //&amp;quot;`&lt;br /&gt;
  if echo &amp;quot;${DET_SN}${REVERSEPHI_SNs}&amp;quot; | sort | uniq -d | grep [0-9] &amp;gt; /dev/null; then&lt;br /&gt;
    REVERSE_PHI=&amp;quot;yes&amp;quot;&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  # offsets are documented; values can be found in mccd_xdsparams.pl script&lt;br /&gt;
  let SKIP=1024+80                                                        &lt;br /&gt;
  NX=$(od -t dI -j $SKIP -N 4 $FIRSTFRAME | head -1 | awk &#039;{print $2}&#039;)&lt;br /&gt;
  let SKIP=$SKIP+4                                                                         &lt;br /&gt;
  NY=$(od -t dI -j $SKIP -N 4 $FIRSTFRAME | head -1 | awk &#039;{print $2}&#039;)&lt;br /&gt;
&lt;br /&gt;
  let SKIP=1720&lt;br /&gt;
  DETECTOR_DISTANCE=$(od -t dI -j $SKIP -N 4 $FIRSTFRAME | head -1 | awk &#039;{print $2}&#039;)&lt;br /&gt;
  DETECTOR_DISTANCE=`echo &amp;quot;scale=3; $DETECTOR_DISTANCE/1000&amp;quot; | bc -l`                                     &lt;br /&gt;
                                                                                                          &lt;br /&gt;
  let SKIP=1024+256+128+256+4                                                                             &lt;br /&gt;
  ORGX=$(od -t dI -j $SKIP -N 4 $FIRSTFRAME | head -1 | awk &#039;{print $2}&#039;)             &lt;br /&gt;
  ORGX=`echo &amp;quot;scale=2; $ORGX/1000&amp;quot; | bc -l `                                                              &lt;br /&gt;
  let SKIP=$SKIP+4                                                                                        &lt;br /&gt;
  ORGY=$(od -t dI -j $SKIP -N 4 $FIRSTFRAME | head -1 | awk &#039;{print $2}&#039;)             &lt;br /&gt;
  ORGY=`echo &amp;quot;scale=2; $ORGY/1000&amp;quot; | bc -l `                                                              &lt;br /&gt;
&lt;br /&gt;
  let SKIP=1024+736&lt;br /&gt;
  OSCILLATION_RANGE=$(od -t dI -j $SKIP -N 4 $FIRSTFRAME | head -1 | awk &#039;{print $2}&#039;) &lt;br /&gt;
  OSCILLATION_RANGE=`echo &amp;quot;scale=3; $OSCILLATION_RANGE/1000&amp;quot; | bc -l`   &lt;br /&gt;
                                                                                                 &lt;br /&gt;
  let SKIP=1024+256+128+256+128+4                                                                &lt;br /&gt;
  QX=$(od -t dI -j $SKIP -N 4 $FIRSTFRAME | head -1 | awk &#039;{print $2}&#039;)      &lt;br /&gt;
  QX=`echo &amp;quot;scale=10; $QX/1000000&amp;quot; |bc -l `                                                      &lt;br /&gt;
  let SKIP=$SKIP+4                                                                               &lt;br /&gt;
  QY=$(od -t dI -j $SKIP -N 4 $FIRSTFRAME | head -1 | awk &#039;{print $2}&#039;)      &lt;br /&gt;
  QY=`echo &amp;quot;scale=10; $QY/1000000&amp;quot; |bc -l `                                                      &lt;br /&gt;
&lt;br /&gt;
  let SKIP=1024+256+128+256+128+128+12&lt;br /&gt;
  X_RAY_WAVELENGTH=$(od -t dI -j $SKIP -N 4 $FIRSTFRAME | head -1 | awk &#039;{print $2}&#039;)&lt;br /&gt;
  X_RAY_WAVELENGTH=`echo &amp;quot;scale=5; $X_RAY_WAVELENGTH/100000&amp;quot; | bc -l`                                    &lt;br /&gt;
&lt;br /&gt;
# at most BLs, ORGX and ORGY are in pixels, but sometimes in mm ... guess:&lt;br /&gt;
  NXBYFOUR=`echo &amp;quot;scale=0; $NX/4&amp;quot; | bc -l `                               &lt;br /&gt;
  ORGXINT=`echo &amp;quot;scale=0; $ORGX/1&amp;quot; | bc -l `                              &lt;br /&gt;
  if [ $ORGXINT -lt $NXBYFOUR ]; then                                     &lt;br /&gt;
     ORGX=`echo &amp;quot;scale=1; $ORGX/$QX&amp;quot; | bc -l`                             &lt;br /&gt;
     ORGY=`echo &amp;quot;scale=1; $ORGY/$QY&amp;quot; | bc -l`                             &lt;br /&gt;
     echo MARCCD detector: header ORGX, ORGY seem to be in mm ... converting to pixels&lt;br /&gt;
  else                                                                                &lt;br /&gt;
     echo MARCCD detector: header ORGX, ORGY seem to be in pixel units                &lt;br /&gt;
  fi                                                                                  &lt;br /&gt;
&lt;br /&gt;
elif [ &amp;quot;$DET&amp;quot; == &amp;quot;adsc&amp;quot; ]; then&lt;br /&gt;
&lt;br /&gt;
  DETECTOR=&amp;quot;ADSC MINIMUM_VALID_PIXEL_VALUE= 1 OVERLOAD= 65000&amp;quot;&lt;br /&gt;
  echo Data from ADSC detector. Obtaining ORGX, ORGY depends on beamline setup:&lt;br /&gt;
  SENSOR_THICKNESS=0.01                                                        &lt;br /&gt;
  sed s/\;// tmp2 &amp;gt; tmp1                                                       &lt;br /&gt;
  mv tmp1 tmp2                                                                 &lt;br /&gt;
&lt;br /&gt;
      # find X_RAY_WAVELENGTH:&lt;br /&gt;
      X_RAY_WAVELENGTH=`grep WAVELENGTH tmp2 | head -1 | sed s/WAVELENGTH=//`&lt;br /&gt;
&lt;br /&gt;
      # find NX, QX, ORGX and ORGY:&lt;br /&gt;
      NX=`grep SIZE1 tmp2 | tail -1 | sed s/SIZE1=//`&lt;br /&gt;
      QX=`grep PIXEL_SIZE tmp2 | sed s/PIXEL_SIZE=//`&lt;br /&gt;
# FIXME - next 2 lines should be done properly, from header&lt;br /&gt;
      NY=$NX                                               &lt;br /&gt;
      QY=$QX                                               &lt;br /&gt;
      BEAM_CENTER_X=`grep BEAM_CENTER_X tmp2 | sed s/BEAM_CENTER_X=//`&lt;br /&gt;
      BEAM_CENTER_Y=`grep BEAM_CENTER_Y tmp2 | sed s/BEAM_CENTER_Y=//`&lt;br /&gt;
# fix 2010-04-26 - tell user about possible ORGX, ORGY alternatives -  &lt;br /&gt;
      COMMENT_ORGXY=&amp;quot;&lt;br /&gt;
! Following are possible beam center interpretations for ADSC detectors&amp;quot;&lt;br /&gt;
# at ESRF, PF, and ... (pls fill in!) the following should be used:         &lt;br /&gt;
      ORGX1=`echo &amp;quot;scale=1; $BEAM_CENTER_Y/$QX&amp;quot; | bc -l`&lt;br /&gt;
      ORGY1=`echo &amp;quot;scale=1; $BEAM_CENTER_X/$QX&amp;quot; | bc -l`&lt;br /&gt;
      echo - at ESRF,PF BLs use: ORGX=$ORGX1 ORGY=$ORGY1                    &lt;br /&gt;
      COMMENT_ORGXY=&amp;quot;${COMMENT_ORGXY}&lt;br /&gt;
! ORGX= $ORGX1 ORGY= $ORGY1 ! For ESRF,PF,...&amp;quot;&lt;br /&gt;
# this 2nd alternative convention should be used at the following beamlines (pls complete the list): ALS 5.0.3, ...&lt;br /&gt;
      ORGX2=`echo &amp;quot;scale=1; $NX-$BEAM_CENTER_X/$QX&amp;quot; | bc -l `&lt;br /&gt;
      ORGY2=`echo &amp;quot;scale=1; $BEAM_CENTER_Y/$QX&amp;quot; | bc -l `&lt;br /&gt;
      echo - at e.g. ALS 5.0.3 use: ORGX=$ORGX2 ORGY=$ORGY2                                                          &lt;br /&gt;
      COMMENT_ORGXY=&amp;quot;${COMMENT_ORGXY}&lt;br /&gt;
! ORGX= $ORGX2 ORGY= $ORGY2 ! For ALS 5.0.3,..&amp;quot;&lt;br /&gt;
# this 3rd alternative convention should be used at the following beamlines (pls complete the list): ALS 8.2.2, ... &lt;br /&gt;
      ORGX3=`echo &amp;quot;scale=1; $BEAM_CENTER_X/$QX&amp;quot; | bc -l `&lt;br /&gt;
      ORGY3=`echo &amp;quot;scale=1; $NX-$BEAM_CENTER_Y/$QX&amp;quot; | bc -l `&lt;br /&gt;
      echo - at e.g. ALS 8.2.2 use: ORGX=$ORGX3 ORGY=$ORGY3 - this is written to XDS.INP                              &lt;br /&gt;
      COMMENT_ORGXY=&amp;quot;${COMMENT_ORGXY}&lt;br /&gt;
! ORGX= $ORGX3 ORGY= $ORGY3 ! For ALS 8.2.2,..&amp;quot;&lt;br /&gt;
# the latter alternative is written into the generated XDS.INP ! You have to correct this manually in XDS.INP, or adjust this script.&lt;br /&gt;
&lt;br /&gt;
      # Decision of beam center convention based on detector serial numbers.&lt;br /&gt;
      DET_SN=`grep DETECTOR_SN tmp2 | sed -e &amp;quot;s/DETECTOR_SN=//&amp;quot;`&lt;br /&gt;
      # For convention 1; Known PF detectors = 449: NW12A Q210, 472: NE3A Q270, 474: BL17A Q270, 912: BL5A Q315&lt;br /&gt;
      ORG1_SNs=&amp;quot;&lt;br /&gt;
449&lt;br /&gt;
472&lt;br /&gt;
474&lt;br /&gt;
912&lt;br /&gt;
&amp;quot;&lt;br /&gt;
      if echo &amp;quot;${DET_SN}${ORG1_SNs}&amp;quot; | sort | uniq -d | grep [0-9] &amp;gt; /dev/null; then&lt;br /&gt;
       ORGX=$ORGX1&lt;br /&gt;
       ORGY=$ORGY1&lt;br /&gt;
      else&lt;br /&gt;
       ORGX=$ORGX3&lt;br /&gt;
       ORGY=$ORGY3&lt;br /&gt;
      fi&lt;br /&gt;
&lt;br /&gt;
      # find DETECTOR_DISTANCE and OSCILLATION_RANGE:                                                                                &lt;br /&gt;
      DETECTOR_DISTANCE=`grep DISTANCE tmp2 | sed s/DISTANCE=//`                                                                     &lt;br /&gt;
      OSCILLATION_RANGE=`grep OSC_RANGE tmp2 | sed s/OSC_RANGE=//`                                                                   &lt;br /&gt;
&lt;br /&gt;
elif [ &amp;quot;$DET&amp;quot; == &amp;quot;pilatus&amp;quot; ]; then&lt;br /&gt;
  DETECTOR=&amp;quot;PILATUS MINIMUM_VALID_PIXEL_VALUE=0 OVERLOAD= 1048576  !PILATUS&amp;quot;&lt;br /&gt;
  QX=0.172 QY=0.172                                                         &lt;br /&gt;
  echo Data from a Pilatus detector                                         &lt;br /&gt;
  sed s/#// tmp2 &amp;gt; tmp1                                                     &lt;br /&gt;
  mv tmp1 tmp2                                                              &lt;br /&gt;
&lt;br /&gt;
      # find SENSOR_THICKNESS:&lt;br /&gt;
      SENSOR_THICKNESS=`grep thickness tmp2 | sed -e s/&#039;Silicon sensor, thickness&#039;// | awk &#039;{print $1*1000}&#039;`&lt;br /&gt;
      # find X_RAY_WAVELENGTH:                                                                               &lt;br /&gt;
      X_RAY_WAVELENGTH=`grep Wavelength tmp2 | sed -e s/Wavelength// -e s/A// | awk &#039;{print $1}&#039;`            &lt;br /&gt;
&lt;br /&gt;
      # find NX and NY; 2463/2527 is 6M, 1475/1679 is 2M&lt;br /&gt;
      NX=`grep X-Binary-Size-Fastest-Dimension tmp2 | awk &#039;{print $2}&#039;`&lt;br /&gt;
      NY=`grep X-Binary-Size-Second-Dimension tmp2 | awk &#039;{print $2}&#039;` &lt;br /&gt;
&lt;br /&gt;
      # find ORGX and ORGY:&lt;br /&gt;
      ORGX=`grep Beam_xy tmp2 | sed -e s/\(// -e s/\)// -e s/\,// | awk &#039;{print $2}&#039;`&lt;br /&gt;
      ORGY=`grep Beam_xy tmp2 | sed -e s/\(// -e s/\)// -e s/\,// | awk &#039;{print $3}&#039;`&lt;br /&gt;
&lt;br /&gt;
      # find DETECTOR_DISTANCE and OSCILLATION_RANGE:&lt;br /&gt;
      DETECTOR_DISTANCE=`awk &#039;/distance/{print $2}&#039; tmp2`&lt;br /&gt;
      DETECTOR_DISTANCE=`echo &amp;quot;$DETECTOR_DISTANCE*1000&amp;quot; | bc -l`&lt;br /&gt;
&lt;br /&gt;
      OSCILLATION_RANGE=`awk &#039;/Angle/{print $2}&#039; tmp2`&lt;br /&gt;
&lt;br /&gt;
elif [ &amp;quot;$DET&amp;quot; == &amp;quot;raxis&amp;quot; ]; then&lt;br /&gt;
  echo Data from a RAXIS detector&lt;br /&gt;
&lt;br /&gt;
  DETECTOR=&amp;quot;RAXIS MINIMUM_VALID_PIXEL_VALUE=0  OVERLOAD=2000000&amp;quot;&lt;br /&gt;
  #let SKIP=768&lt;br /&gt;
  #NX=$(od -t x -j $SKIP -N 4 $FIRSTFRAME |awk &#039;NR==1{print toupper($2)}&#039;|perl -nle &#039;@array= $_ =~/.{2}/g; print &amp;quot;ibase=16;obase=A;&amp;quot;.join(&amp;quot;&amp;quot;,reverse @array)&#039;|bc)&lt;br /&gt;
  NX=$(python -c &#039;import struct; f=open(&amp;quot;&#039;$FIRSTFRAME&#039;&amp;quot;,&amp;quot;rb&amp;quot;);f.seek(768);print &amp;quot;%.4d&amp;quot;%struct.unpack(&amp;quot;&amp;gt;i&amp;quot;,f.read(4))&#039;)&lt;br /&gt;
  NY=$(python -c &#039;import struct; f=open(&amp;quot;&#039;$FIRSTFRAME&#039;&amp;quot;,&amp;quot;rb&amp;quot;);f.seek(772);print &amp;quot;%.4d&amp;quot;%struct.unpack(&amp;quot;&amp;gt;i&amp;quot;,f.read(4))&#039;)&lt;br /&gt;
&lt;br /&gt;
  DETECTOR_DISTANCE=$(python -c &#039;import struct; f=open(&amp;quot;&#039;$FIRSTFRAME&#039;&amp;quot;,&amp;quot;rb&amp;quot;);f.seek(344);print &amp;quot;-%.4f&amp;quot;%struct.unpack(&amp;quot;&amp;gt;f&amp;quot;,f.read(4))&#039;)&lt;br /&gt;
&lt;br /&gt;
  ORGX=$(python -c &#039;import struct; f=open(&amp;quot;&#039;$FIRSTFRAME&#039;&amp;quot;,&amp;quot;rb&amp;quot;);f.seek(540);print &amp;quot;%.4f&amp;quot;%struct.unpack(&amp;quot;&amp;gt;f&amp;quot;,f.read(4))&#039;)&lt;br /&gt;
  ORGY=$(python -c &#039;import struct; f=open(&amp;quot;&#039;$FIRSTFRAME&#039;&amp;quot;,&amp;quot;rb&amp;quot;);f.seek(544);print &amp;quot;%.4f&amp;quot;%struct.unpack(&amp;quot;&amp;gt;f&amp;quot;,f.read(4))&#039;)&lt;br /&gt;
&lt;br /&gt;
  OSCILLATION_RANGE=$(python -c &#039;import struct; f=open(&amp;quot;&#039;$FIRSTFRAME&#039;&amp;quot;,&amp;quot;rb&amp;quot;);f.seek(524);phis,phie=struct.unpack(&amp;quot;&amp;gt;ff&amp;quot;,f.read(8));print &amp;quot;%.4f&amp;quot;%(phie-phis)&#039;)&lt;br /&gt;
&lt;br /&gt;
  QX=$(python -c &#039;import struct; f=open(&amp;quot;&#039;$FIRSTFRAME&#039;&amp;quot;,&amp;quot;rb&amp;quot;);f.seek(776);print &amp;quot;%.6f&amp;quot;%struct.unpack(&amp;quot;&amp;gt;f&amp;quot;,f.read(4))&#039;)&lt;br /&gt;
  QY=$(python -c &#039;import struct; f=open(&amp;quot;&#039;$FIRSTFRAME&#039;&amp;quot;,&amp;quot;rb&amp;quot;);f.seek(780);print &amp;quot;%.6f&amp;quot;%struct.unpack(&amp;quot;&amp;gt;f&amp;quot;,f.read(4))&#039;)&lt;br /&gt;
&lt;br /&gt;
  X_RAY_WAVELENGTH=$(python -c &#039;import struct; f=open(&amp;quot;&#039;$FIRSTFRAME&#039;&amp;quot;,&amp;quot;rb&amp;quot;);f.seek(292);print &amp;quot;%.6f&amp;quot;%struct.unpack(&amp;quot;&amp;gt;f&amp;quot;,f.read(4))&#039;)&lt;br /&gt;
else&lt;br /&gt;
  echo should never come here&lt;br /&gt;
  exit 1                     &lt;br /&gt;
fi                           &lt;br /&gt;
&lt;br /&gt;
echo ORGX= $ORGX ORGY= $ORGY - check these values with adxv !&lt;br /&gt;
echo DETECTOR_DISTANCE= $DETECTOR_DISTANCE                   &lt;br /&gt;
echo OSCILLATION_RANGE= $OSCILLATION_RANGE                   &lt;br /&gt;
echo X-RAY_WAVELENGTH= $X_RAY_WAVELENGTH                     &lt;br /&gt;
&lt;br /&gt;
# now we know everything that is required to generate XDS.INP&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; XDS.INP &amp;lt;&amp;lt; eof&lt;br /&gt;
! written by generate_XDS.INP version $REVISION&lt;br /&gt;
JOB= XYCORR INIT COLSPOT IDXREF DEFPIX INTEGRATE CORRECT&lt;br /&gt;
ORGX= $ORGX ORGY= $ORGY  ! check these values with adxv !\&lt;br /&gt;
$COMMENT_ORGXY&lt;br /&gt;
DETECTOR_DISTANCE= $DETECTOR_DISTANCE                    &lt;br /&gt;
OSCILLATION_RANGE= $OSCILLATION_RANGE                    &lt;br /&gt;
X-RAY_WAVELENGTH= $X_RAY_WAVELENGTH                      &lt;br /&gt;
NAME_TEMPLATE_OF_DATA_FRAMES=$NAME_TEMPLATE_OF_DATA_FRAMES&lt;br /&gt;
! REFERENCE_DATA_SET=xxx/XDS_ASCII.HKL ! e.g. to ensure consistent indexing  &lt;br /&gt;
DATA_RANGE=1 $DATA_RANGE                                                     &lt;br /&gt;
SPOT_RANGE=1 $SPOT_RANGE                                                     &lt;br /&gt;
! BACKGROUND_RANGE=1 10 ! rather use defaults (first 5 degree of rotation)   &lt;br /&gt;
&lt;br /&gt;
SPACE_GROUP_NUMBER=0                   ! 0 if unknown&lt;br /&gt;
UNIT_CELL_CONSTANTS= 70 80 90 90 90 90 ! put correct values if known&lt;br /&gt;
INCLUDE_RESOLUTION_RANGE=50 0  ! after CORRECT, insert high resol limit; re-run CORRECT&lt;br /&gt;
! IDXREF now obeys INCLUDE_RESOLUTION_RANGE and EXCLUDE_RESOLUTION_RANGE to exclude ice-rings&lt;br /&gt;
&lt;br /&gt;
FRIEDEL&#039;S_LAW=FALSE     ! This acts only on the CORRECT step&lt;br /&gt;
! If the anom signal turns out to be, or is known to be, very low or absent,&lt;br /&gt;
! use FRIEDEL&#039;S_LAW=TRUE instead (or comment out the line); re-run CORRECT&lt;br /&gt;
&lt;br /&gt;
! remove the &amp;quot;!&amp;quot; in the following line:&lt;br /&gt;
! STRICT_ABSORPTION_CORRECTION=TRUE&lt;br /&gt;
! if the anomalous signal is strong: in that case, in CORRECT.LP the three&lt;br /&gt;
! &amp;quot;CHI^2-VALUE OF FIT OF CORRECTION FACTORS&amp;quot; values are significantly&amp;gt; 1, e.g. 1.5&lt;br /&gt;
!&lt;br /&gt;
! exclude (mask) untrusted areas of detector, e.g. beamstop shadow :&lt;br /&gt;
! UNTRUSTED_RECTANGLE= 1800 1950 2100 2150 ! x-min x-max y-min y-max ! repeat&lt;br /&gt;
! UNTRUSTED_ELLIPSE= 2034 2070 1850 2240 ! x-min x-max y-min y-max ! if needed&lt;br /&gt;
! UNTRUSTED_QUADRILATERAL= x1 y1 x2 y2 x3 y3 x4 y4 ! see documentation&lt;br /&gt;
!&lt;br /&gt;
! parameters with changes wrt default values:&lt;br /&gt;
TRUSTED_REGION=0.00 1.2  ! partially use corners of detectors; 1.41421=full use&lt;br /&gt;
VALUE_RANGE_FOR_TRUSTED_DETECTOR_PIXELS=6000. 30000. ! often 7000 or 8000 is ok&lt;br /&gt;
STRONG_PIXEL=4           ! COLSPOT: only use strong reflections (default is 3)&lt;br /&gt;
MINIMUM_NUMBER_OF_PIXELS_IN_A_SPOT=3 ! default of 6 is sometimes too high&lt;br /&gt;
! close spots: reduce SEPMIN and CLUSTER_RADIUS from their defaults of 6 and 3, e.g. to 4 and 2&lt;br /&gt;
! nowadays headers are usually correct so refine DISTANCE in INTEGRATE but not IDXREF&lt;br /&gt;
REFINE(IDXREF)=CELL BEAM ORIENTATION AXIS ! DISTANCE&lt;br /&gt;
REFINE(INTEGRATE)= DISTANCE BEAM ORIENTATION ! AXIS CELL&lt;br /&gt;
! REFINE(CORRECT)=CELL BEAM ORIENTATION AXIS DISTANCE ! Default is: refine everything&lt;br /&gt;
&lt;br /&gt;
! parameters specifically for this detector and beamline:&lt;br /&gt;
DETECTOR= $DETECTOR&lt;br /&gt;
SENSOR_THICKNESS= $SENSOR_THICKNESS&lt;br /&gt;
! attention CCD detectors: for very high resolution (better than 1A) make sure to specify SILICON&lt;br /&gt;
! as about 32* what CORRECT.LP suggests (absorption of phosphor is much higher than that of silicon)&lt;br /&gt;
NX= $NX NY= $NY  QX= $QX  QY= $QY ! to make CORRECT happy if frames are unavailable&lt;br /&gt;
&lt;br /&gt;
eof&lt;br /&gt;
if [ &amp;quot;$DET&amp;quot; == &amp;quot;raxis&amp;quot; ]; then&lt;br /&gt;
 cat &amp;gt;&amp;gt; XDS.INP &amp;lt;&amp;lt; eof&lt;br /&gt;
DIRECTION_OF_DETECTOR_X-AXIS=1 0 0&lt;br /&gt;
DIRECTION_OF_DETECTOR_Y-AXIS=0 -1 0&lt;br /&gt;
INCIDENT_BEAM_DIRECTION=0 0 1&lt;br /&gt;
ROTATION_AXIS=0 1 0&lt;br /&gt;
!FRACTION_OF_POLARIZATION=0.98   ! uncomment if synchrotron&lt;br /&gt;
POLARIZATION_PLANE_NORMAL=1 0 0&lt;br /&gt;
eof&lt;br /&gt;
else&lt;br /&gt;
 if [ &amp;quot;$REVERSE_PHI&amp;quot; == &amp;quot;no&amp;quot; ]; then&lt;br /&gt;
  echo &#039;ROTATION_AXIS=1 0 0  ! at e.g. Australian Synchrotron, SERCAT ID-22 (?), APS 19-ID (?), ESRF BM30A, SPring-8 this needs to be -1 0 0&#039; &amp;gt;&amp;gt; XDS.INP&lt;br /&gt;
 else&lt;br /&gt;
  echo &#039;ROTATION_AXIS=-1 0 0  ! if this is wrong, please contact author.&#039; &amp;gt;&amp;gt; XDS.INP&lt;br /&gt;
 fi&lt;br /&gt;
 cat &amp;gt;&amp;gt; XDS.INP &amp;lt;&amp;lt; eof&lt;br /&gt;
DIRECTION_OF_DETECTOR_X-AXIS=1 0 0&lt;br /&gt;
DIRECTION_OF_DETECTOR_Y-AXIS=0 1 0&lt;br /&gt;
INCIDENT_BEAM_DIRECTION=0 0 1&lt;br /&gt;
FRACTION_OF_POLARIZATION=0.98   ! better value is provided by beamline staff!&lt;br /&gt;
POLARIZATION_PLANE_NORMAL=0 1 0&lt;br /&gt;
eof&lt;br /&gt;
fi&lt;br /&gt;
cat &amp;gt;&amp;gt; XDS.INP &amp;lt;&amp;lt; eof&lt;br /&gt;
!used by DEFPIX and CORRECT to exclude ice-reflections / ice rings - uncomment if necessary&lt;br /&gt;
!EXCLUDE_RESOLUTION_RANGE= 3.93 3.87 !ice-ring at 3.897 Angstrom&lt;br /&gt;
!EXCLUDE_RESOLUTION_RANGE= 3.70 3.64 !ice-ring at 3.669 Angstrom&lt;br /&gt;
!EXCLUDE_RESOLUTION_RANGE= 3.47 3.41 !ice-ring at 3.441 Angstrom&lt;br /&gt;
!EXCLUDE_RESOLUTION_RANGE= 2.70 2.64 !ice-ring at 2.671 Angstrom&lt;br /&gt;
!EXCLUDE_RESOLUTION_RANGE= 2.28 2.22 !ice-ring at 2.249 Angstrom&lt;br /&gt;
!EXCLUDE_RESOLUTION_RANGE= 2.102 2.042 !ice-ring at 2.072 Angstrom - strong&lt;br /&gt;
!EXCLUDE_RESOLUTION_RANGE= 1.978 1.918 !ice-ring at 1.948 Angstrom - weak&lt;br /&gt;
!EXCLUDE_RESOLUTION_RANGE= 1.948 1.888 !ice-ring at 1.918 Angstrom - strong&lt;br /&gt;
!EXCLUDE_RESOLUTION_RANGE= 1.913 1.853 !ice-ring at 1.883 Angstrom - weak&lt;br /&gt;
!EXCLUDE_RESOLUTION_RANGE= 1.751 1.691 !ice-ring at 1.721 Angstrom - weak&lt;br /&gt;
eof&lt;br /&gt;
if [ &amp;quot;$DET&amp;quot; == &amp;quot;pilatus&amp;quot; ]; then&lt;br /&gt;
cat &amp;gt;&amp;gt; XDS.INP &amp;lt;&amp;lt; eof&lt;br /&gt;
NUMBER_OF_PROFILE_GRID_POINTS_ALONG_ALPHA/BETA=13 ! Default is 9 - Increasing may improve data &lt;br /&gt;
NUMBER_OF_PROFILE_GRID_POINTS_ALONG_GAMMA=13      ! accuracy, particularly if finely-sliced on phi, &lt;br /&gt;
!                                                   and does not seem to have any downsides. &lt;br /&gt;
eof&lt;br /&gt;
  if [ $NX == &amp;quot;1475&amp;quot; ]; then&lt;br /&gt;
    if ! grep -q Flat_field tmp2 ; then&lt;br /&gt;
    cat &amp;gt;&amp;gt; XDS.INP &amp;lt;&amp;lt; eof&lt;br /&gt;
! the following specifications are for a detector _without_ proper&lt;br /&gt;
! flat_field correction; they cut away one additional pixel adjacent &lt;br /&gt;
! to each UNTRUSTED_RECTANGLE&lt;br /&gt;
!EXCLUSION OF VERTICAL DEAD AREAS OF THE PILATUS 2M DETECTOR&lt;br /&gt;
UNTRUSTED_RECTANGLE= 486  496     0 1680&lt;br /&gt;
UNTRUSTED_RECTANGLE= 980  990     0 1680&lt;br /&gt;
!EXCLUSION OF HORIZONTAL DEAD AREAS OF THE PILATUS 2M DETECTOR&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476   194  214&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476   406  426&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476   618  638&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476   830  850&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476  1042 1062&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476  1254 1274&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476  1466 1486&lt;br /&gt;
eof&lt;br /&gt;
    else&lt;br /&gt;
    cat &amp;gt;&amp;gt; XDS.INP &amp;lt;&amp;lt; eof&lt;br /&gt;
!EXCLUSION OF VERTICAL DEAD AREAS OF THE PILATUS 2M DETECTOR&lt;br /&gt;
UNTRUSTED_RECTANGLE= 487  495     0 1680&lt;br /&gt;
UNTRUSTED_RECTANGLE= 981  989     0 1680&lt;br /&gt;
!EXCLUSION OF HORIZONTAL DEAD AREAS OF THE PILATUS 2M DETECTOR&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476   195  213&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476   407  425&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476   619  637&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476   831  849&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476  1043 1061&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476  1255 1273&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 1476  1467 1485&lt;br /&gt;
eof&lt;br /&gt;
    fi&lt;br /&gt;
  elif [ $NX == &amp;quot;2463&amp;quot; ]; then&lt;br /&gt;
# Pilatus 6M&lt;br /&gt;
# FIXME: here we could test if a Flat_field correction was applied like we do for 2M&lt;br /&gt;
    cat &amp;gt;&amp;gt; XDS.INP &amp;lt;&amp;lt; eof&lt;br /&gt;
UNTRUSTED_RECTANGLE= 487  495     0 2528&lt;br /&gt;
UNTRUSTED_RECTANGLE= 981  989     0 2528&lt;br /&gt;
UNTRUSTED_RECTANGLE=1475 1483     0 2528&lt;br /&gt;
UNTRUSTED_RECTANGLE=1969 1977     0 2528&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 2464   195  213&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 2464   407  425&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 2464   619  637&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 2464   831  849&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 2464  1043 1061&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 2464  1255 1273&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 2464  1467 1485&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 2464  1679 1697&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 2464  1891 1909&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 2464  2103 2121&lt;br /&gt;
UNTRUSTED_RECTANGLE=   0 2464  2315 2333&lt;br /&gt;
eof&lt;br /&gt;
  fi&lt;br /&gt;
fi&lt;br /&gt;
echo XDS.INP is ready for use. The file has only the most important keywords.&lt;br /&gt;
echo Full documentation, including complete detector templates, is at&lt;br /&gt;
echo http://www.mpimf-heidelberg.mpg.de/~kabsch/xds . More documentation in XDSwiki&lt;br /&gt;
echo After running xds, inspect, using XDS-Viewer, at least the beamstop mask in&lt;br /&gt;
echo BKGPIX.cbf, and the agreement of predicted and observed spots in FRAME.cbf!&lt;br /&gt;
rm -f tmp1 tmp2&lt;br /&gt;
# end of generate_XDS.INP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System-wide or personal installation ==&lt;br /&gt;
&lt;br /&gt;
Ask your system adminstrator to cut-and-paste the script into e.g. /usr/local/bin/generate_XDS.INP, and to make it &amp;quot;executable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
But you may also cut-and-paste the script from this webpage into a file in e.g. your home directory; the filename should be generate_XDS.INP. After creating the file, make it executable - e.g. if it&#039;s in your $HOME, use:&lt;br /&gt;
 chmod +x ~/generate_XDS.INP&lt;br /&gt;
After that, you can just run it in a similar way as if it were installed in your $PATH:&lt;br /&gt;
 ~/generate_XDS.INP &amp;quot;frms/mydata_1_???.img&amp;quot;&lt;br /&gt;
By using your own file, you can easily update to the latest revision, or even change the script, without having to bother the system administrator.&lt;br /&gt;
&lt;br /&gt;
== Generating generate_XDS.INP from this webpage ==&lt;br /&gt;
&lt;br /&gt;
Instead of cutting-and-pasting the lines of the script, you (or the system administrator) could just cut-and-paste the following four lines&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 wget http://strucbio.biologie.uni-konstanz.de/xdswiki/index.php/generate_XDS.INP -O - | \&lt;br /&gt;
   sed -e s/\&amp;amp;nbsp\;/\ /g -e s/\&amp;amp;gt\;/\&amp;gt;/g -e s/\&amp;amp;lt\;/\&amp;lt;/g -e s/amp\;//g -e s/\&amp;amp;quot\;/\&amp;quot;/g -e s/\&amp;amp;\#\1\6\0\;/\ /g | \&lt;br /&gt;
   sed &#039;/# end of generate_XDS.INP/,$d&#039; | awk &#039;/^#/,/rm -f tmp1 tmp2/&#039; &amp;gt; generate_XDS.INP&lt;br /&gt;
 chmod +x generate_XDS.INP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to copy the script from this website into an executable file generate_XDS.INP in your current directory.&lt;br /&gt;
&lt;br /&gt;
If you do use cut-and-paste from the webpage, be aware of the following problem report: On the Mac, after loading frames, by clicking “generate XDS.INP”, the program gives some strange symbol “Ã” in XDS.INP. And the more you click “save” button, the more “Ã” appear. This looks like e.g. &amp;lt;br&amp;gt;SPACE_GROUP_NUMBER=0 Ã ! 0 if unknown &amp;lt;br&amp;gt;UNIT_CELL_CONSTANTS= 70 80 90 90 90 90 Ã &amp;lt;br&amp;gt; &#039;&#039;The problem is due to the “Rich text” format in TextEdit when saving &amp;quot;generate_XDS.INP&amp;quot;. It is solved by re-downloading the script, and changing format to Plain - everything should work then.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Calling generate_XDS.INP from a Python script ==&lt;br /&gt;
&lt;br /&gt;
It is recommended to use the [http://docs.python.org/2/library/subprocess.html subprocess.Popen()] module instead of [http://docs.python.org/2/library/os.html os.system()]:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 subprocess.Popen([&amp;quot;generate_XDS.INP&amp;quot;,imagepath],stdout=outputfile)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where imagepath is a string containing the path to an image and outputfile is either a chosen variable for an output file or subprocess.PIPE if you&#039;re not interested in the output of the script.&lt;br /&gt;
&lt;br /&gt;
The module os.system() internally uses /bin/sh to execute the command and overrides #!/bin/bash at the beginning of the script. While this is not a problem on most operating systems, /bin/sh points to dash instead of bash on Ubuntu, which leads to a program crash with the error message&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 sh: 1: Syntax error: Bad fd number&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Karine</name></author>
	</entry>
	<entry>
		<id>https://wiki.uni-konstanz.de/xds/index.php?title=Main_Page&amp;diff=2886</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://wiki.uni-konstanz.de/xds/index.php?title=Main_Page&amp;diff=2886"/>
		<updated>2014-03-10T09:50:47Z</updated>

		<summary type="html">&lt;p&gt;Karine: XDSAPP link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is XDS, and how to obtain it? ==&lt;br /&gt;
XDS is a program package written for the &amp;quot;reduction&amp;quot; of 2-dimensional data images (&amp;quot;frames&amp;quot;) obtained from crystals irradiated with monochromatic X-rays. The package mainly consists of the programs [[XDS]] (which processes a single dataset), [[XSCALE]] (for scaling of several datasets) , [[XDSCONV]] (for conversion of output file to other formats) and [[VIEW]] (for visualizing).&lt;br /&gt;
&lt;br /&gt;
The author of the program package is Wolfgang Kabsch (Wolfgang dot Kabsch at mpimf-heidelberg dot mpg dot de). &lt;br /&gt;
&lt;br /&gt;
The program is free for academic use, and can be downloaded from http://www.mpimf-heidelberg.mpg.de/~kabsch/xds/html_doc/downloading.html (if the download from that site fails, there&#039;s a copy at ftp://turn5.biologie.uni-konstanz.de/xds ).&lt;br /&gt;
&lt;br /&gt;
Documentation is at http://www.mpimf-heidelberg.mpg.de/~kabsch/xds or [http://strucbio.biologie.uni-konstanz.de/~dikay/XDS_html_doc/index.html here].&lt;br /&gt;
&lt;br /&gt;
Since version 30-Jan-2009, the format of the control images written by [[XDS]] (and [[XSCALE]]) [http://www.mpimf-heidelberg.mpg.de/~kabsch/xds/html_doc/Release_Notes.html changed]. An open-source viewer [[XDS-Viewer]] is [http://xds-viewer.sourceforge.net available]. Latest versions of [[Adxv]] can also visualize XDS output files.&lt;br /&gt;
&lt;br /&gt;
There is another program available, which serves to produce additional output of tables and plots. This is not part of the official XDS package; its name is [[XDSSTAT]] (written and distributed by Kay Diederichs).&lt;br /&gt;
&lt;br /&gt;
[[XDSGUI]], a graphical user interface, serves to help using XDS.&lt;br /&gt;
&lt;br /&gt;
== Links to XDS papers by Wolfgang Kabsch ==&lt;br /&gt;
&lt;br /&gt;
# [http://dx.doi.org/10.1107/S0021889887009737 &#039;&#039;J. Appl. Cryst.&#039;&#039; (1988). 21, 67-72. Automatic indexing of rotation diffraction patterns.] explaining the diffraction geometry as used in XDS, the local-indexing method used in IDXREF and the refinement of diffraction geometry parameters. &lt;br /&gt;
# [http://dx.doi.org/10.1107/S0021889888007903 &#039;&#039;J. Appl. Cryst.&#039;&#039; (1988). 21, 916-924. Evaluation of single-crystal X-ray diffraction data from a position-sensitive detector]. This is &#039;&#039;the&#039;&#039; reference for the integration and scaling algorithms employed in the INTEGRATE and CORRECT steps.&lt;br /&gt;
# [http://dx.doi.org/10.1107/S0021889893005588 &#039;&#039;J. Appl. Cryst.&#039;&#039; (1993). 26, 795-800. Automatic processing of rotation diffraction data from crystals of initially unknown symmetry and cell constants]. This builds upon publication 1. and gives further important details of the IDXREF step, in particular about space-group determination.&lt;br /&gt;
# [http://it.iucr.org/Fa/contents/ Chapters 11.3 and 25.2.9 in &#039;&#039;International Tables for Crystallography Volume F: Crystallography of Biological Macromolecules&#039;&#039;]&lt;br /&gt;
# [http://dx.doi.org/10.1107/S0907444909047374 &#039;&#039;Acta Cryst.&#039;&#039; (2010). &#039;&#039;&#039;D66&#039;&#039;&#039;, 133-144. Integration, scaling, space-group assignment and post-refinement.] the definitive reference. Open access.&lt;br /&gt;
# [http://dx.doi.org/10.1107/S0907444909047337 &#039;&#039;Acta Cryst.&#039;&#039; (2010). &#039;&#039;&#039;D66&#039;&#039;&#039;, 125-132. XDS] the definitive reference. Open access.&lt;br /&gt;
&lt;br /&gt;
== Purpose of the Wiki ==&lt;br /&gt;
The purpose of this Wiki is to provide an accurate resource for XDS users, and to provide explanations and hints for the successful use of XDS. I (Kay Diederichs) try to keep the Wiki up-to-date with XDS versions and insights. I collect [[Tips and Tricks]] for XDS usage, explanations of its output, and recommendations for the parameters in [[XDS.INP]] (if it appears useful to deviate from their defaults).&lt;br /&gt;
&lt;br /&gt;
To see what&#039;s there already, go to [[Special:Allpages|List of all pages]]. A good starting point is the article about [[XDS.INP]] where the keywords and parameters for running XDS are described. There is also a [[wishlist]], and [[Known Bugs]], and [[Quality Control]] (under construction).&lt;br /&gt;
&lt;br /&gt;
== Contributing to the Wiki ==&lt;br /&gt;
* The MediaWiki software used here works in the same way as the well-known Wikipedia. This means that anyone can read articles, but for editing existing pages, and creating new ones (this happens automatically when you click on a [[red link]]), you need a [[Creating an account|userid and password]]. Due to the amount of spam created by abuse of Google mail accounts, we are no longer allowing account creation for @gmail.com email addresses. &lt;br /&gt;
* Short introduction to [[creating an article]]&lt;br /&gt;
&lt;br /&gt;
== Wiki contents ==&lt;br /&gt;
&lt;br /&gt;
* [[Special:Allpages|List of all pages]] - to see which pages exist already ...&lt;br /&gt;
&lt;br /&gt;
* [[Topics]] as an attempt to provide a hierarchy of pages&lt;br /&gt;
&lt;br /&gt;
* new articles: [[adxv]], [[SIM_MX]], [[FAQ]], [[Problems]], [[CORRECT]]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
[http://smb.slac.stanford.edu/facilities/software/xds/ A Quick XDS Tutorial for SSRL]&lt;br /&gt;
&lt;br /&gt;
[http://strucbio.biologie.uni-konstanz.de/~dikay/XDS_Diederichs_ACA2011.pdf XDS talk given at ACA2011]&lt;br /&gt;
&lt;br /&gt;
[https://www.researchgate.net/publication/236032099_Practical_use_of_XDS_%28for_data_reduction%29._Presented_in_April_4th_2013_Dept._of_Biochemical_Sciences_Sapienza_University_of_Rome?ev=prf_pub Practical use of XDS (for data reduction) - by Fulvio Saccoccia, Presented in April, 4th 2013; Dept. of Biochemical Sciences and Istituto Pasteur-Fondazione Cenci Bolognetti - Sapienza University of Rome.  ]&lt;br /&gt;
&lt;br /&gt;
[http://www.helmholtz-berlin.de/forschung/oe/funkma/soft-matter/forschung/bessy-mx/xdsapp/index_en.html XDSAPP, a graphical user interface for automatic data processing with XDS]&lt;/div&gt;</summary>
		<author><name>Karine</name></author>
	</entry>
</feed>