Generate XDS.INP: Difference between revisions

replaced script with rev. 0.10: setting link to image directory if path is too long.
(use od instead of catmar/mccd_xdsparams.pl)
(replaced script with rev. 0.10: setting link to image directory if path is too long.)
Line 3: Line 3:


<pre>
<pre>
#!/bin/bash
#!/bin/bash


Line 16: Line 15:
# tested with some datasets from ALS, SSRL, SLS and ESRF; only MARCCD, ADSC/SMV, PILATUS 6M detectors;  
# tested with some datasets from ALS, SSRL, SLS and ESRF; only MARCCD, ADSC/SMV, PILATUS 6M detectors;  
# for other detectors, values marked with XXX must be manually filled in.
# for other detectors, values marked with XXX must be manually filled in.
# revision 0.10 . Tim Gruene 7/2010 - set link 'images' to image directory if path exceeds 72 characters
#
#
# usage: e.g. generate_XDS.INP "frms/mydata_1_???.img"
# usage: e.g. generate_XDS.INP "frms/mydata_1_???.img"
Line 53: Line 53:
# see how we are called:
# see how we are called:
NAME_TEMPLATE_OF_DATA_FRAMES="$1"
NAME_TEMPLATE_OF_DATA_FRAMES="$1"
# check that the image template name does not exceed 72 characters
# and set a link if necessary
if [ ${#1} -gt 72 ]; then
    TMP_PATH=$(/bin/ls -C1 $1 | head -1)
    TMP_FILENAME=$(basename ${TMP_PATH})
    if [ ${#TMP_FILENAME} -gt 65 ]; then
echo "---> Unable to proceed: image filename "
echo "--->  \"${TMP_FILENAME}\""
        echo "---> exceeds 72 characters."
        echo "---> Please rename files or set links."
exit
    else
echo "---> Warning: Template name exceeds 72 characters. Setting link \"image\""
        echo "              to image directory"
TMP_DIRNAME=$(dirname ${TMP_PATH})
if [ -e "images" ]; then
    echo "***  Error:  The file or directory \"images\" already exists. Please remove"
    echo "              and re-run."
    exit
else
    ln -s ${TMP_DIRNAME} images
fi
NAME_TEMPLATE_OF_DATA_FRAMES="images/${1##/*/}"
echo "              Using template filename \"${NAME_TEMPLATE_OF_DATA_FRAMES}\""
    fi
fi


# list frames matching the wildcards in NAME_TEMPLATE_OF_DATA_FRAMES
# list frames matching the wildcards in NAME_TEMPLATE_OF_DATA_FRAMES
# don't accept the "direct beam" shot at SLS/Pilatus
# don't accept the "direct beam" shot at SLS/Pilatus
ls -C1 $1 | grep -v "_00000.cbf" > tmp1 || exit 1
/bin/ls -C1 $1 | grep -v "_00000.cbf" > tmp1 || exit 1


# we can continue - the frames are found
# we can continue - the frames are found
Line 249: Line 276:
echo After running xds, inspect at least BKGPIX.cbf and FRAME.cbf with XDS-Viewer!
echo After running xds, inspect at least BKGPIX.cbf and FRAME.cbf with XDS-Viewer!
rm -f tmp1 tmp2  
rm -f tmp1 tmp2  


</pre>
</pre>
21

edits