2cbf: Difference between revisions

From XDSwiki
Jump to navigation Jump to search
(improve example)
m (another fix)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
[http://xds.mpimf-heidelberg.mpg.de/html_doc/2cbf_program.html 2cbf] is part of the [[XDS]] distribution. It converts any image file format that is known to XDS to a miniCBF file. This program is also used by [[XDSGUI]].
[http://xds.mpimf-heidelberg.mpg.de/html_doc/2cbf_program.html 2cbf] is part of the [[XDS]] distribution. It converts any image file format that is known to XDS to a miniCBF file. This program is also used by [[XDSGUI]].


Line 5: Line 6:
This converts all .img files in ../images to miniCBF files with the extension .img.cbf in the current directory.
This converts all .img files in ../images to miniCBF files with the extension .img.cbf in the current directory.


For 2cbf to work with the [http://xds.mpimf-heidelberg.mpg.de/html_doc/xds_parameters.html#LIB= LIB=] option, it is mandatory to have a filename like test_123456.xy, i.e. with a 6-digit number and a 2-letter extension. If you want to use LIB= and your filenames do not follow this pattern, just symlink them, and construct the symlinks accordingly: e.g.
To have control over the number of digits encoding the frame number, one can use bash's printf command. Example:
<pre>
<pre>
#!/bin/bash
#!/bin/bash
# purpose: create symlinks for xds_par
# usage: mklinks
for j in $(seq 1 120); do
for j in $(seq 1 120); do
   ln -sfn Data_02_$(printf "%04d" "$j").sfrm Data_02_$(printf "%06d" "$j").sf
   echo Data_02_$(printf "%04d" "$j").sfrm Data_02_$(printf "%04d" "$j").cbf | 2cbf
done
done
</pre>


echo ready
To convert frames stored in Dectris-format .h5 files, one should replace "master" with a 6-digit framenumber, and use the [https://xds.mr.mpg.de/html_doc/xds_parameters.html#LIB= LIB=] keyword:
</pre>
echo collect_01_000001.h5 collect_1.cbf LIB=/usr/local/lib64/dectris-neggia.so | 2cbf
It should work without LIB=, but then H5ToXds is required.
 
To convert a full data set, use e.g.:
#!/bin/bash
for j in $(seq 1 100); do
  echo x1_1_$(printf "%06d" "$j").h5 x1_1_$(printf "%04d" "$j").cbf LIB=/usr/local/bin/linux_bin/dectris-neggia.so | 2cbf
done


If you don't do this, you'll get an error message like
or just use GlobalPhasing's hdf2mini-cbf :
<pre>
  hdf2mini-cbf x1_1_master.h5 -linkrange 1 100
forrtl: severe (59): list-directed I/O syntax error, unit -5, file Internal List-Directed Read
which seems to convert batches of 100 frames - don't know how to restrict it to convert only frames 1 to 100. The advantage of hdf2mini-cbf is that it writes a proper mini-CBF header which is suitable for MOSFLM or DIALS.
Image              PC                Routine            Line        Source           
2cbf              000000000041DCDC Unknown              Unknown  Unknown
2cbf              00000000004476AA  Unknown              Unknown  Unknown
2cbf              0000000000445C2B  Unknown              Unknown  Unknown
2cbf              00000000004059B8  getfrm_                  1713  MAIN_2CBF.f90
2cbf              0000000000404C6A  MAIN__                    58  MAIN_2CBF.f90
2cbf              0000000000402ADE  Unknown              Unknown  Unknown
libc-2.17.so      00007FB47339BB35  __libc_start_main    Unknown  Unknown
2cbf              00000000004029E9  Unknown              Unknown  Unknown
</pre>

Latest revision as of 21:13, 12 June 2022

2cbf is part of the XDS distribution. It converts any image file format that is known to XDS to a miniCBF file. This program is also used by XDSGUI.

Single-line example (bash shell):

for i in ../images/*img ; do echo $i; echo $i `basename $i`.cbf | 2cbf ; done

This converts all .img files in ../images to miniCBF files with the extension .img.cbf in the current directory.

To have control over the number of digits encoding the frame number, one can use bash's printf command. Example:

#!/bin/bash
for j in $(seq 1 120); do
  echo Data_02_$(printf "%04d" "$j").sfrm Data_02_$(printf "%04d" "$j").cbf | 2cbf
done

To convert frames stored in Dectris-format .h5 files, one should replace "master" with a 6-digit framenumber, and use the LIB= keyword:

echo collect_01_000001.h5 collect_1.cbf LIB=/usr/local/lib64/dectris-neggia.so | 2cbf

It should work without LIB=, but then H5ToXds is required.

To convert a full data set, use e.g.:

#!/bin/bash
for j in $(seq 1 100); do
  echo x1_1_$(printf "%06d" "$j").h5 x1_1_$(printf "%04d" "$j").cbf LIB=/usr/local/bin/linux_bin/dectris-neggia.so | 2cbf
done

or just use GlobalPhasing's hdf2mini-cbf :

hdf2mini-cbf x1_1_master.h5 -linkrange 1 100

which seems to convert batches of 100 frames - don't know how to restrict it to convert only frames 1 to 100. The advantage of hdf2mini-cbf is that it writes a proper mini-CBF header which is suitable for MOSFLM or DIALS.