# [IUCr Home Page] [CIF Home Page] [CBF/imgCIF] [CBFlib] #

# imgCIF/CBF #

# Extensions Dictionary #

##############################################################################
#                                                                            #
#                       Image CIF Dictionary (imgCIF)                        #
#             and Crystallographic Binary File Dictionary (CBF)              #
#            Extending the Macromolecular CIF Dictionary (mmCIF)             #
#                                                                            #
#                              Version 1.5.4                                 #
#                              of 2007-07-28                                 #
#    ###################################################################     #
#    # *** WARNING *** THIS IS A DRAFT FOR DISCUSSSION *** WARNING *** #     #
#    #                 SUBJECT TO CHANGE WITHOUT NOTICE                #     #
#    #       SEND COMMENTS TO imgcif-l@iucr.org CITING THE VERSION     #     #
#    ###################################################################     #
#                  This draft edited by H. J. Bernstein                      #
#                                                                            #
#     by Andrew P. Hammersley, Herbert J. Bernstein and John D. Westbrook    #
#                                                                            #
# This dictionary was adapted from format discussed at the imgCIF Workshop,  #
# held at BNL Oct 1997 and the Crystallographic Binary File Format Draft     #
# Proposal by Andrew Hammersley.  The first DDL 2.1 Version was created by   #
# John Westbrook.  This version was drafted by Herbert J. Bernstein and      #
# incorporates comments by I. David Brown, John Westbrook, Brian McMahon,    #
# Bob Sweet, Paul Ellis, Harry Powell, Wilfred Li, Gotzon Madariaga,         #
# Frances C. Bernstein, Chris Nielsen, Nicola Ashcroft and others.           #
##############################################################################

data_cif_img.dic

    _dictionary.title           cif_img.dic
    _dictionary.version         1.5.4
    _dictionary.datablock_id    cif_img.dic

##############################################################################
#    CONTENTS
#
#        CATEGORY_GROUP_LIST
#        SUB_CATEGORY
#
#        category  ARRAY_DATA
#
#                  _array_data.array_id
#                  _array_data.binary_id
#                  _array_data.data
#                  _array_data.header_contents
#                  _array_data.header_convention
#
#        category  ARRAY_ELEMENT_SIZE
#
#                  _array_element_size.array_id
#                  _array_element_size.index
#                  _array_element_size.size
#
#        category  ARRAY_INTENSITIES
#
#                  _array_intensities.array_id
#                  _array_intensities.binary_id
#                  _array_intensities.gain
#                  _array_intensities.gain_esd
#                  _array_intensities.linearity
#                  _array_intensities.offset
#                  _array_intensities.scaling
#                  _array_intensities.overload
#                  _array_intensities.undefined_value
#                  _array_intensities.pixel_fast_bin_size
#                  _array_intensities.pixel_slow_bin_size
#                  _array_intensities.pixel_binning_method
#
#        category  ARRAY_STRUCTURE
#
#                  _array_structure.byte_order
#                  _array_structure.compression_type
#                  _array_structure.compression_type_flag
#                  _array_structure.encoding_type
#                  _array_structure.id
#
#        category  ARRAY_STRUCTURE_LIST
#
#                  _array_structure_list.axis_set_id
#                  _array_structure_list.array_id
#                  _array_structure_list.dimension
#                  _array_structure_list.direction
#                  _array_structure_list.index
#                  _array_structure_list.precedence
#
#        category  ARRAY_STRUCTURE_LIST_AXIS
#
#                  _array_structure_list_axis.axis_id
#                  _array_structure_list_axis.axis_set_id
#                  _array_structure_list_axis.angle
#                  _array_structure_list_axis.angle_increment
#                  _array_structure_list_axis.displacement
#                  _array_structure_list_axis.fract_displacement
#                  _array_structure_list_axis.displacement_increment
#                  _array_structure_list_axis.fract_displacement_increment
#                  _array_structure_list_axis.angular_pitch
#                  _array_structure_list_axis.radial_pitch
#                  _array_structure_list_axis.reference_angle
#                  _array_structure_list_axis.reference_displacement
#
#        category  AXIS
#
#                  _axis.depends_on
#                  _axis.equipment
#                  _axis.id
#                  _axis.offset[1]
#                  _axis.offset[2]
#                  _axis.offset[3]
#                  _axis.type
#                  _axis.system
#                  _axis.vector[1]
#                  _axis.vector[2]
#                  _axis.vector[3]
#
#        category  DIFFRN_DATA_FRAME
#
#                  _diffrn_data_frame.array_id
#                  _diffrn_data_frame.binary_id
#                  _diffrn_data_frame.center_fast
#                  _diffrn_data_frame.center_slow
#                  _diffrn_data_frame.center_units
#                  _diffrn_data_frame.detector_element_id
#                  _diffrn_data_frame.id
#                  _diffrn_data_frame.details
#
#        category  DIFFRN_DETECTOR
#
#                  _diffrn_detector.details
#                  _diffrn_detector.detector
#                  _diffrn_detector.diffrn_id
#                  _diffrn_detector.dtime
#                  _diffrn_detector.id
#                  _diffrn_detector.number_of_axes
#                  _diffrn_detector.type
#
#        category  DIFFRN_DETECTOR_AXIS
#
#                  _diffrn_detector_axis.axis_id
#                  _diffrn_detector_axis.detector_id
#
#        category  DIFFRN_DETECTOR_ELEMENT
#
#                  _diffrn_detector_element.id
#                  _diffrn_detector_element.detector_id
#                  _diffrn_detector_element.reference_center_fast
#                  _diffrn_detector_element.reference_center_slow
#                  _diffrn_detector_element.reference_center_units
#
#        category  DIFFRN_MEASUREMENT
#
#                  _diffrn_measurement.diffrn_id
#                  _diffrn_measurement.details
#                  _diffrn_measurement.device
#                  _diffrn_measurement.device_details
#                  _diffrn_measurement.device_type
#                  _diffrn_measurement.id
#                  _diffrn_measurement.method
#                  _diffrn_measurement.number_of_axes
#                  _diffrn_measurement.sample_detector_distance
#                  _diffrn_measurement.sample_detector_voffset
#                  _diffrn_measurement.specimen_support
#
#        category  DIFFRN_MEASUREMENT_AXIS
#
#                  _diffrn_measurement_axis.axis_id
#                  _diffrn_measurement_axis.measurement_device
#                  _diffrn_measurement_axis.measurement_id
#
#        category  DIFFRN_RADIATION
#
#                  _diffrn_radiation.collimation
#                  _diffrn_radiation.diffrn_id
#                  _diffrn_radiation.div_x_source
#                  _diffrn_radiation.div_y_source
#                  _diffrn_radiation.div_x_y_source
#                  _diffrn_radiation.filter_edge'
#                  _diffrn_radiation.inhomogeneity
#                  _diffrn_radiation.monochromator
#                  _diffrn_radiation.polarisn_norm
#                  _diffrn_radiation.polarisn_ratio
#                  _diffrn_radiation.polarizn_source_norm
#                  _diffrn_radiation.polarizn_source_ratio
#                  _diffrn_radiation.probe
#                  _diffrn_radiation.type
#                  _diffrn_radiation.xray_symbol
#                  _diffrn_radiation.wavelength_id
#
#        category  DIFFRN_REFLN
#
#                  _diffrn_refln.frame_id
#
#        category  DIFFRN_SCAN
#
#                  _diffrn_scan.id
#                  _diffrn_scan.date_end
#                  _diffrn_scan.date_start
#                  _diffrn_scan.integration_time
#                  _diffrn_scan.frame_id_start
#                  _diffrn_scan.frame_id_end
#                  _diffrn_scan.frames
#
#        category  DIFFRN_SCAN_AXIS
#
#                  _diffrn_scan_axis.axis_id
#                  _diffrn_scan_axis.angle_start
#                  _diffrn_scan_axis.angle_range
#                  _diffrn_scan_axis.angle_increment
#                  _diffrn_scan_axis.angle_rstrt_incr
#                  _diffrn_scan_axis.displacement_start
#                  _diffrn_scan_axis.displacement_range
#                  _diffrn_scan_axis.displacement_increment
#                  _diffrn_scan_axis.displacement_rstrt_incr
#                  _diffrn_scan_axis.reference_angle
#                  _diffrn_scan_axis.reference_displacement
#                  _diffrn_scan_axis.scan_id
#
#        category  DIFFRN_SCAN_FRAME
#
#                  _diffrn_scan_frame.date
#                  _diffrn_scan_frame.frame_id
#                  _diffrn_scan_frame.frame_number
#                  _diffrn_scan_frame.integration_time
#                  _diffrn_scan_frame.scan_id
#
#        category  DIFFRN_SCAN_FRAME_AXIS
#
#                  _diffrn_scan_frame_axis.axis_id
#                  _diffrn_scan_frame_axis.angle
#                  _diffrn_scan_frame_axis.angle_increment
#                  _diffrn_scan_frame_axis.angle_rstrt_incr
#                  _diffrn_scan_frame_axis.displacement
#                  _diffrn_scan_frame_axis.displacement_increment
#                  _diffrn_scan_frame_axis.displacement_rstrt_incr
#                  _diffrn_scan_frame_axis.reference_angle
#                  _diffrn_scan_frame_axis.reference_displacement
#                  _diffrn_scan_frame_axis.frame_id
#
#       categor    MAP
#
#                  _map.details
#                  _map.diffrn_id
#                  _map.entry_id
#                  _map.id
#
#       categor    MAP_SEGMENT
#
#                  _map_segment.array_id
#                  _map_segment.binary_id
#                  _map_segment.mask_array_id
#                  _map_segment.mask_binary_id
#                  _map_segment.id
#                  _map_segment.map_id
#                  _map_segment.details
#
#       ***DEPRECATED*** data items
#
#                  _diffrn_detector_axis.id
#                  _diffrn_detector_element.center[1]
#                  _diffrn_detector_element.center[2]
#                  _diffrn_measurement_axis.id
#
#       ***DEPRECATED*** category  DIFFRN_FRAME_DATA
#
#                  _diffrn_frame_data.array_id
#                  _diffrn_frame_data.binary_id
#                  _diffrn_frame_data.detector_element_id
#                  _diffrn_frame_data.id
#                  _diffrn_frame_data.details
#
#
#        ITEM_TYPE_LIST
#        ITEM_UNITS_LIST
#        DICTIONARY_HISTORY
#
##############################################################################


#########################
## CATEGORY_GROUP_LIST ##
#########################

     loop_
    _category_group_list.id
    _category_group_list.parent_id
    _category_group_list.description
             'inclusive_group'   .
;             Categories that belong to the dictionary extension.
;
             'array_data_group'
             'inclusive_group'
;             Categories that describe array data.
;
             'axis_group'
             'inclusive_group'
;             Categories that describe axes.
;
             'diffrn_group'
             'inclusive_group'
;            Categories that describe details of the diffraction experiment.
;


##################
## SUB_CATEGORY ##
##################

     loop_
    _sub_category.id
    _sub_category.description
              'matrix'
;              The collection of elements of a matrix.
;
              'vector'
;              The collection of elements of a vector.
;




##############
# ARRAY_DATA #
##############


save_ARRAY_DATA
    _category.description
;    Data items in the ARRAY_DATA category are the containers for
     the array data items described in the category ARRAY_STRUCTURE.
     
     It is recognized that the data in this category needs to be used in
     two distinct ways.  During a data collection the lack of ancillary
     data and timing constraints in processing data may dictate the
     need to make a 'miniCBF' nothing more than an essential minimum
     of information to record the results of the data collection.  In that
     case it is proper to use the ARRAY_DATA category as a
     container for just a single image and a compacted, beam-line
     dependent list of data collection parameter values.  In such
     a case, only the tags '_array_data.header_convention',
     '_array_data.header_contents' and '_array_data.data' need be
     populated.
     
     For full processing and archiving, most of the tags in this
     dictionary will need to be populated.
     
;
    _category.id                   array_data
    _category.mandatory_code       no
     loop_
    _category_key.name             '_array_data.array_id'
                                   '_array_data.binary_id'
    loop_
    _category_group.id             'inclusive_group'
                                   'array_data_group'
    loop_
    _category_examples.detail
    _category_examples.case
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;
        Example 1 -

        This example shows two binary data blocks.  The first one
        was compressed by the CBF_CANONICAL compression algorithm and is
        presented as hexadecimal data.  The first character 'H' on the
        data lines means hexadecimal.  It could have been 'O' for octal
        or 'D' for decimal.  The second character on the line shows
        the number of bytes in each word (in this case '4'), which then
        requires eight hexadecimal digits per word.  The third character
        gives the order of octets within a word, in this case '<'
        for the ordering 4321 (i.e. 'big-endian').  Alternatively, the
        character '>' could have been used for the ordering 1234
        (i.e. 'little-endian').  The block has a 'message digest'
        to check the integrity of the data.

        The second block is similar, but uses CBF_PACKED compression
        and BASE64 encoding.  Note that the size and the digest are
        different.
;
;

        loop_
        _array_data.array_id
        _array_data.binary_id
        _array_data.data
        image_1 1
        ;
        --CIF-BINARY-FORMAT-SECTION--
        Content-Type: application/octet-stream;
             conversions="X-CBF_CANONICAL"
        Content-Transfer-Encoding: X-BASE16
        X-Binary-Size: 3927126
        X-Binary-ID: 1
        Content-MD5: u2sTJEovAHkmkDjPi+gWsg==

        # Hexadecimal encoding, byte 0, byte order ...21
        #
        H4< 0050B810 00000000 00000000 00000000 000F423F 00000000 00000000 ...
        ....
        --CIF-BINARY-FORMAT-SECTION----
        ;
        image_2 2
        ;
        --CIF-BINARY-FORMAT-SECTION--
        Content-Type: application/octet-stream;
             conversions="X-CBF-PACKED"
        Content-Transfer-Encoding: BASE64
        X-Binary-Size: 3745758
        X-Binary-ID: 2
        Content-MD5: 1zsJjWPfol2GYl2V+QSXrw==

        ELhQAAAAAAAA...
        ...
        --CIF-BINARY-FORMAT-SECTION----
        ;
;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;
        Example 2 -

        This example shows a single image in a miniCBF, provided by
        E. Eikenberry.  The entire CBF consists of one data block
        containing one category and three tags.  The CBFlib
        program convert_miniCBF and a suitable template file
        can be used to convert this miniCBF to a full imgCIF
        file.
;
;
        ###CBF: VERSION 1.5
        # CBF file written by CBFlib v0.7.8

        data_insulin_pilatus6m

        _array_data.header_convention SLS_1.0
        _array_data.header_contents
        ;
        # Detector: PILATUS 6M SN: 60-0001
        # 2007/Jun/17 15:12:36.928
        # Pixel_size 172e-6 m x 172e-6 m
        # Silicon sensor, thickness 0.000320 m
        # Exposure_time 0.995000 s
        # Exposure_period 1.000000 s
        # Tau = 194.0e-09 s
        # Count_cutoff 1048575 counts
        # Threshold_setting 5000 eV
        # Wavelength 1.2398 A
        # Energy_range (0, 0) eV
        # Detector_distance 0.15500 m
        # Detector_Voffset -0.01003 m
        # Beam_xy (1231.00, 1277.00) pixels
        # Flux 22487563295 ph/s
        # Filter_transmission 0.0008
        # Start_angle 13.0000 deg.
        # Angle_increment 1.0000 deg.
        # Detector_2theta 0.0000 deg.
        # Polarization 0.990
        # Alpha 0.0000 deg.
        # Kappa 0.0000 deg.
        # Phi 0.0000 deg.
        # Chi 0.0000 deg.
        # Oscillation_axis  X, CW
        # N_oscillations 1
        ;

        _array_data.data
        ;
        --CIF-BINARY-FORMAT-SECTION--
        Content-Type: application/octet-stream;
             conversions="x-CBF_BYTE_OFFSET"
        Content-Transfer-Encoding: BINARY
        X-Binary-Size: 6247567
        X-Binary-ID: 1
        X-Binary-Element-Type: "signed 32-bit integer"
        X-Binary-Element-Byte-Order: LITTLE_ENDIAN
        Content-MD5: 8wO6i2+899lf5iO8QPdgrw==
        X-Binary-Number-of-Elements: 6224001
        X-Binary-Size-Fastest-Dimension: 2463
        X-Binary-Size-Second-Dimension: 2527
        X-Binary-Size-Padding: 4095

        ...
        
        --CIF-BINARY-FORMAT-SECTION----
        ;
;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

save_


save__array_data.array_id
    _item_description.description
;             This item is a pointer to _array_structure.id in the
              ARRAY_STRUCTURE category.
              
              If not given, it defaults to 1.
;
    _item.name                  '_array_data.array_id'
    _item.category_id             array_data
    _item.mandatory_code          implicit
    _item_type.code               code
     save_


save__array_data.binary_id
    _item_description.description
;             This item is an integer identifier which, along with
              _array_data.array_id, should uniquely identify the
              particular block of array data.

              If _array_data.binary_id is not explicitly given,
              it defaults to 1.

              The value of _array_data.binary_id distinguishes
              among multiple sets of data with the same array
              structure.

              If the MIME header of the data array specifies a
              value for X-Binary-ID, the value of  _array_data.binary_id
              should be equal to the value given for X-Binary-ID.
;
     loop_
    _item.name
    _item.category_id
    _item.mandatory_code
             '_array_data.binary_id'            array_data
                                                                implicit
             '_diffrn_data_frame.binary_id'     diffrn_data_frame
                                                                implicit
             '_array_intensities.binary_id'     array_intensities
                                                                implicit
     loop_
    _item_linked.child_name
    _item_linked.parent_name
             '_diffrn_data_frame.binary_id'     '_array_data.binary_id'
             '_array_intensities.binary_id'     '_array_data.binary_id'

    _item_default.value           1
    _item_type.code               int
     loop_
    _item_range.maximum
    _item_range.minimum
                            1  1
                            .  1
     save_


save__array_data.data
    _item_description.description
;             The value of _array_data.data contains the array data
              encapsulated in a STAR string.

              The representation used is a variant on the
              Multipurpose Internet Mail Extensions (MIME) specified
              in RFC 2045-2049 by N. Freed et al.  The boundary
              delimiter used in writing an imgCIF or CBF is
              '\n--CIF-BINARY-FORMAT-SECTION--' (including the
              required initial '\n--').

              The Content-Type may be any of the discrete types permitted
              in RFC 2045; 'application/octet-stream' is recommended
              for diffraction images in the ARRAY_DATA category.
              Note:  When appropriate in other categories, e.g. for
              photographs of crystals, more precise types, such as
              'image/jpeg', 'image/tiff', 'image/png', etc. should be used.
              
              If an octet stream was compressed, the compression should
              be specified by the parameter 
                'conversions="X-CBF_PACKED"'
              or the parameter 
                'conversions="X-CBF_CANONICAL"'
              or the parameter 
                'conversions="X-CBF_BYTE_OFFSET"'
                
              If the parameter 
                'conversions="X-CBF_PACKED"'
              is given it may be further modified with the parameters
                '"uncorrelated_sections"'
              or
                '"flat"'
              
              If the '"uncorrelated_sections"' parameter is
              given, each section will be compressed without using
              the prior section for averaging.
              
              If the '"flat"' parameter is given, each the
              image will be treated as one long row.

              The Content-Transfer-Encoding may be 'BASE64',
              'Quoted-Printable', 'X-BASE8', 'X-BASE10',
              'X-BASE16' or 'X-BASE32K', for an imgCIF or 'BINARY'
              for a CBF.  The octal, decimal and hexadecimal transfer
              encodings are provided for convenience in debugging and
              are not recommended for archiving and data interchange.

              In a CIF, one of the parameters 'charset=us-ascii',
              'charset=utf-8' or 'charset=utf-16' may be used on the
              Content-Transfer-Encoding to specify the character set
              used for the external presentation of the encoded data.
              If no charset parameter is given, the character set of
              the enclosing CIF is assumed.  In any case, if a BOM
              flag is detected (FE FF for big-endian UTF-16, FF FE for
              little-endian UTF-16 or EF BB BF for UTF-8) is detected,
              the indicated charset will be assumed until the end of the
              encoded data or the detection of a different BOM.  The
              charset of the Content-Transfer-Encoding is not the character
              set of the encoded data, only the character set of the
              presentation of the encoded data and should be respecified
              for each distinct STAR string.

              In an imgCIF file, the encoded binary data begins after
              the empty line terminating the header.  In an imgCIF file,
              the encoded binary data ends with the terminating boundary
              delimiter '\n--CIF-BINARY-FORMAT-SECTION----'
              in the currently effective charset or with the '\n; '
              that terminates the STAR string.

              In a CBF, the raw binary data begins after an empty line
              terminating the header and after the sequence:

              Octet   Hex   Decimal  Purpose
                0     0C       12    (ctrl-L) Page break
                1     1A       26    (ctrl-Z) Stop listings in MS-DOS
                2     04       04    (Ctrl-D) Stop listings in UNIX
                3     D5      213    Binary section begins

              None of these octets are included in the calculation of
              the message size or in the calculation of the
              message digest.

              The X-Binary-Size header specifies the size of the
              equivalent binary data in octets.  If compression was
              used, this size is the size after compression, including
              any book-keeping fields.  An adjustment is made for
              the deprecated binary formats in which eight bytes of binary
              header are used for the compression type.  In this case,
              the eight bytes used for the compression type are subtracted
              from the size, so that the same size will be reported
              if the compression type is supplied in the MIME header.
              Use of the MIME header is the recommended way to
              supply the compression type.  In general, no portion of
              the  binary header is included in the calculation of the size.

              The X-Binary-Element-Type header specifies the type of
              binary data in the octets, using the same descriptive
              phrases as in _array_structure.encoding_type.  The default
              value is 'unsigned 32-bit integer'.

              An MD5 message digest may, optionally, be used. The 'RSA Data
              Security, Inc. MD5 Message-Digest Algorithm' should be used.
              No portion of the header is included in the calculation of the
              message digest.

              If the Transfer Encoding is 'X-BASE8', 'X-BASE10' or
              'X-BASE16', the data are presented as octal, decimal or
              hexadecimal data organized into lines or words.  Each word
              is created by composing octets of data in fixed groups of
              2, 3, 4, 6 or 8 octets, either in the order ...4321 ('big-
              endian') or 1234... ('little-endian').  If there are fewer
              than the specified number of octets to fill the last word,
              then the missing octets are presented as '==' for each
              missing octet.  Exactly two equal signs are used for each
              missing octet even for octal and decimal encoding.
              The format of lines is:

              rnd xxxxxx xxxxxx xxxxxx

              where r is 'H', 'O' or 'D' for hexadecimal, octal or
              decimal, n is the number of octets per word and d is '<'
              or '>' for the '...4321' and '1234...' octet orderings,
              respectively.  The '==' padding for the last word should
              be on the appropriate side to correspond to the missing
              octets, e.g.

              H4< FFFFFFFF FFFFFFFF 07FFFFFF ====0000

              or

              H3> FF0700 00====

              For these hexadecimal, octal and decimal formats only,
              comments beginning with '#' are permitted to improve
              readability.

              BASE64 encoding follows MIME conventions.  Octets are
              in groups of three: c1, c2, c3.  The resulting 24 bits
              are broken into four six-bit quantities, starting with
              the high-order six bits (c1 >> 2) of the first octet, then
              the low-order two bits of the first octet followed by the
              high-order four bits of the second octet [(c1 & 3)<<4 | (c2>>4)],
              then the bottom four bits of the second octet followed by the
              high-order two bits of the last octet [(c2 & 15)<<2 | (c3>>6)],
              then the bottom six bits of the last octet (c3 & 63).  Each
              of these four quantities is translated into an ASCII character
              using the mapping:

                        1         2         3         4         5         6
              0123456789012345678901234567890123456789012345678901234567890123
              |         |         |         |         |         |         |
              ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/

              With short groups of octets padded on the right with one '='
              if c3 is missing, and with '==' if both c2 and c3 are missing.

              X-BASE32K encoding is similar to BASE64 encoding, except that
              sets of 15 octets are encoded as sets of 8 16-bit unicode
              characters, by breaking the 120 bits into 8 15-bit quantities.
              256 is added to each 15 bit quantity to bring it into a
              printable uncode range.  When encoding, zero padding is used
              to fill out the last 15 bit quantity.  If 8 or more bits of
              padding are used, a single equals sign (hexadecimal 003D) is
              appended.  Embedded whitespace and newlines are introduced
              to produce lines of no more than 80 characters each.  On
              decoding, all printable ascii characters and ascii whitespace
              characters are ignored except for any trailing equals signs.
              The number of trailing equals signs indicated the number of
              trailing octets to be trimmed from the end of the decoded data.
              (see Georgi Darakev, Vassil Litchev, Kostadin Z. Mitev, Herbert
              J. Bernstein, 'Efficient Support of Binary Data in the XML
              Implementation of the NeXus File Format',absract W0165,
              ACA Summer Meeting, Honolulu, HI, July 2006).

              QUOTED-PRINTABLE encoding also follows MIME conventions, copying
              octets without translation if their ASCII values are 32...38,
              42, 48...57, 59, 60, 62, 64...126 and the octet is not a ';'
              in column 1.  All other characters are translated to =nn, where
              nn is the hexadecimal encoding of the octet.  All lines are
              'wrapped' with a terminating '=' (i.e. the MIME conventions
              for an implicit line terminator are never used).
              
              The "X-Binary-Element-Byte-Order" can specify either 
              '"BIG_ENDIAN"' or '"LITTLE_ENDIAN"' byte order of the imaage 
              data.  Only LITTLE_ENDIAN is recommended.  Processors
              may treat BIG_ENDIAN as a warning of data that can
              only be processed by special software.

              The "X-Binary-Number-of-Elements" specifies the number of 
              elements (not the number of octets) in the decompressed, decoded 
              image.

              The optional "X-Binary-Size-Fastest-Dimension" specifies the 
              number of elements (not the number of octets) in one row of the 
              fastest changing dimension of the binary data array. This 
              information must be in the MIME header for proper operation of 
              some of the decompression algorithms.

              The optional "X-Binary-Size-Second-Dimension" specifies the 
              number of elements (not the number of octets) in one column of 
              the second-fastest changing dimension of the binary data array. 
              This information must be in the MIME header for proper operation 
              of some of the decompression algorithms.

              The optional "X-Binary-Size-Third-Dimension" specifies the
              number of sections for the third-fastest changing dimension of
              the binary data array.
              
              The optional "X-Binary-Size-Padding" specifies the size in 
              octets of an optional padding after the binary array data and 
              before the closing flags for a binary section.
;
    _item.name                  '_array_data.data'
    _item.category_id             array_data
    _item.mandatory_code          yes
    _item_type.code               binary
save_


save__array_data.header_contents
    _item_description.description
;             This item is an text field for use in minimal CBF files to carry
              essential header information to be kept with image data
              in _array_data.data when the tags that normally carry the
              structured metadata for the image have not been populated.
              
              Normally this data item should not appear when the full set
              of tags have been populated and _diffrn_data_frame.details
              appears.
;
    _item.name                  '_array_data.header_contents'
    _item.category_id            array_data
    _item.mandatory_code         no
    _item_type.code              text
     save_



save__array_data.header_convention
    _item_description.description
;             This item is an identifier for the convention followed in
              constructing the contents of _array_data.header_contents
              
              The permitted values are of the of an image creator identifier
              followed by an underscore and a version string.  To avoid
              confusion about conventions, all creator identifiers
              should be registered with the IUCr and the conventions
              for all identifiers and versions should be posted on
              the MEDSBIO.org web site.
;
    _item.name                  '_array_data.header_convention'
    _item.category_id            array_data
    _item.mandatory_code         no
    _item_type.code              code
     save_




######################
# ARRAY_ELEMENT_SIZE #
######################


save_ARRAY_ELEMENT_SIZE
    _category.description
;    Data items in the ARRAY_ELEMENT_SIZE category record the physical
     size of array elements along each array dimension.
;
    _category.id                   array_element_size
    _category.mandatory_code       no
     loop_
    _category_key.name             '_array_element_size.array_id'
                                   '_array_element_size.index'
    loop_
    _category_group.id             'inclusive_group'
                                   'array_data_group'
    loop_
    _category_examples.detail
    _category_examples.case
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;       Example 1 - A regular 2D array with a uniform element dimension
                    of 1220 nanometres.
;
;
        loop_
       _array_element_size.array_id
       _array_element_size.index
       _array_element_size.size
        image_1   1    1.22e-6
        image_1   2    1.22e-6
;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     save_


save__array_element_size.array_id
    _item_description.description
;             This item is a pointer to _array_structure.id in the
              ARRAY_STRUCTURE category.
;
    _item.name                  '_array_element_size.array_id'
    _item.category_id             array_element_size
    _item.mandatory_code          implicit
    _item_type.code               code
     save_


save__array_element_size.index
    _item_description.description
;             This item is a pointer to _array_structure_list.index in
              the ARRAY_STRUCTURE_LIST category.
;
    _item.name                  '_array_element_size.index'
    _item.category_id             array_element_size
    _item.mandatory_code          yes
    _item_type.code               code
     save_


save__array_element_size.size
    _item_description.description
;              The size in metres of an image element in this
               dimension. This supposes that the elements are arranged
               on a regular grid.
;
    _item.name               '_array_element_size.size'
    _item.category_id          array_element_size
    _item.mandatory_code       yes
    _item_type.code            float
    _item_units.code           'metres'
     loop_
    _item_range.maximum
    _item_range.minimum
                            .   0.0
     save_


#####################
# ARRAY_INTENSITIES #
#####################


save_ARRAY_INTENSITIES
    _category.description
;             Data items in the ARRAY_INTENSITIES category record the
              information required to recover the intensity data from
              the set of data values stored in the ARRAY_DATA category.

              The detector may have a complex relationship
              between the raw intensity values and the number of
              incident photons.  In most cases, the number stored
              in the final array will have a simple linear relationship
              to the actual number of incident photons, given by
              _array_intensities.gain.  If raw, uncorrected values
              are presented (e.g. for calibration experiments), the
              value of _array_intensities.linearity will be 'raw'
              and _array_intensities.gain will not be used.

;
    _category.id                   array_intensities
    _category.mandatory_code       no
    loop_
    _category_key.name             '_array_intensities.array_id'
                                   '_array_intensities.binary_id'
    loop_
    _category_group.id             'inclusive_group'
                                   'array_data_group'
    loop_
    _category_examples.detail
    _category_examples.case
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;
        Example 1
;
;
        loop_
        _array_intensities.array_id
        _array_intensities.linearity
        _array_intensities.gain
        _array_intensities.overload
        _array_intensities.undefined_value
        _array_intensities.pixel_fast_bin_size
        _array_intensities.pixel_slow_bin_size
        _array_intensities.pixel_binning_method
        image_1   linear  1.2    655535   0   2   2    hardware
;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     save_


save__array_intensities.array_id
    _item_description.description
;             This item is a pointer to _array_structure.id in the
              ARRAY_STRUCTURE category.
;
    _item.name                  '_array_intensities.array_id'
    _item.category_id             array_intensities
    _item.mandatory_code          implicit
    _item_type.code               code
     save_


save__array_intensities.binary_id
    _item_description.description
;             This item is a pointer to _array_data.binary_id in the
              ARRAY_DATA category.
;
    _item.name                  '_array_intensities.binary_id'
    _item.category_id             array_intensities
    _item.mandatory_code          implicit
    _item_type.code               int
     save_


save__array_intensities.gain
    _item_description.description
;              Detector 'gain'. The factor by which linearized
               intensity count values should be divided to produce
               true photon counts.
;
    _item.name              '_array_intensities.gain'
    _item.category_id          array_intensities
    _item.mandatory_code       yes
    _item_type.code            float
     loop_
    _item_range.maximum
    _item_range.minimum
                            .   0.0
    _item_units.code           'counts_per_photon'
     loop_
    _item_related.related_name
    _item_related.function_code  '_array_intensities.gain_esd'
                                 'associated_value'
    save_


save__array_intensities.gain_esd
    _item_description.description
;            The estimated standard deviation in detector 'gain'.
;
    _item.name              '_array_intensities.gain_esd'
    _item.category_id          array_intensities
    _item.mandatory_code       yes
    _item_type.code            float
     loop_
    _item_range.maximum
    _item_range.minimum
                            .   0.0

    _item_units.code          'counts_per_photon'
     loop_
    _item_related.related_name
    _item_related.function_code  '_array_intensities.gain'
                                 'associated_esd'
    save_


save__array_intensities.linearity
    _item_description.description
;              The intensity linearity scaling method used to convert
               from the raw intensity to the stored element value:

               'linear' is linear.

               'offset'  means that the value defined by
               _array_intensities.offset should be added to each
                element value.

               'scaling' means that the value defined by
               _array_intensities.scaling should be multiplied with each
               element value.

               'scaling_offset' is the combination of the two previous cases,
               with the scale factor applied before the offset value.

               'sqrt_scaled' means that the square root of raw
               intensities multiplied by _array_intensities.scaling is
               calculated and stored, perhaps rounded to the nearest
               integer. Thus, linearization involves dividing the stored
               values by _array_intensities.scaling and squaring the
               result.

               'logarithmic_scaled' means that the logarithm base 10 of
               raw intensities multiplied by _array_intensities.scaling
               is calculated and stored, perhaps rounded to the nearest
               integer. Thus, linearization involves dividing the stored
               values by _array_intensities.scaling and calculating 10
               to the power of this number.

               'raw' means that the data are a set of raw values straight
               from the detector.
;

    _item.name               '_array_intensities.linearity'
    _item.category_id          array_intensities
    _item.mandatory_code       yes
    _item_type.code            code
     loop_
    _item_enumeration.value
    _item_enumeration.detail
                              'linear' .
                              'offset'
;              The value defined by  _array_intensities.offset should
               be added to each element value.
;
                              'scaling'
;              The value defined by _array_intensities.scaling should be
               multiplied with each element value.
;
                              'scaling_offset'
;              The combination of the scaling and offset
               with the scale factor applied before the offset value.
;
                              'sqrt_scaled'
;              The square root of raw intensities multiplied by
               _array_intensities.scaling is calculated and stored,
               perhaps rounded to the nearest integer. Thus,
               linearization involves dividing the stored
               values by _array_intensities.scaling and squaring the
               result.
;
                              'logarithmic_scaled'
;              The logarithm base 10 of raw intensities multiplied by
               _array_intensities.scaling  is calculated and stored,
               perhaps rounded to the nearest integer. Thus,
               linearization involves dividing the stored values by
               _array_intensities.scaling and calculating 10 to the
               power of this number.
;
                              'raw'
;              The array consists of raw values to which no corrections have
               been applied.  While the handling of the data is similar to
               that given for 'linear' data with no offset, the meaning of
               the data differs in that the number of incident photons is
               not necessarily linearly related to the number of counts
               reported.  This value is intended for use either in
               calibration experiments or to allow for handling more
               complex data-fitting algorithms than are allowed for by
               this data item.
;

    save_


save__array_intensities.offset
    _item_description.description
;              Offset value to add to array element values in the manner
               described by the item _array_intensities.linearity.
;
    _item.name                 '_array_intensities.offset'
    _item.category_id          array_intensities
    _item.mandatory_code       no
    _item_type.code            float
    save_


save__array_intensities.overload
    _item_description.description
;              The saturation intensity level for this data array.
;
    _item.name                 '_array_intensities.overload'
    _item.category_id          array_intensities
    _item.mandatory_code       no
    _item_type.code            float
    _item_units.code          'counts'
    save_


save__array_intensities.pixel_fast_bin_size
    _item_description.description
;              The value of _array_intensities.pixel_fast_bin_size specifies
               the number of pixels that compose one element in the direction
               of the most rapidly varying array dimension.

               Typical values are 1, 2, 4 or 8.  When there is 1 pixel per
               array element in both directions, the value given for
               _array_intensities.pixel_binning_method normally should be
               'none'.

               It is specified as a float to allow for binning algorithms that
               create array elements that are not integer multiples of the 
               detector pixel size.
;
    _item.name              '_array_intensities.pixel_fast_bin_size'
    _item.category_id          array_intensities
    _item.mandatory_code       implicit
    _item_type.code            float
    _item_default.value        1.
     loop_
    _item_range.maximum
    _item_range.minimum
                            .   0.0
    _item_units.code           'pixels_per_element'
    save_


save__array_intensities.pixel_slow_bin_size
    _item_description.description
;              The value of _array_intensities.pixel_slow_bin_size specifies
               the number of pixels that compose one element in the direction
               of the second most rapidly varying array dimension.

               Typical values are 1, 2, 4 or 8.  When there is 1 pixel per
               array element in both directions, the value given for
               _array_intensities.pixel_binning_method normally should be
               'none'.

               It is specified as a float to allow for binning algorithms that
               create array elements that are not integer multiples of the
               detector pixel size.
;
    _item.name              '_array_intensities.pixel_slow_bin_size'
    _item.category_id          array_intensities
    _item.mandatory_code       implicit
    _item_type.code            float
    _item_default.value        1.
     loop_
    _item_range.maximum
    _item_range.minimum
                            .   0.0
    _item_units.code           'pixels_per_element'
    save_


save__array_intensities.pixel_binning_method
    _item_description.description
;              The value of _array_intensities.pixel_binning_method specifies
               the method used to derive array elements from multiple pixels.
;
    _item.name              '_array_intensities.pixel_binning_method'
    _item.category_id          array_intensities
    _item.mandatory_code       implicit
    _item_type.code            code
     loop_
    _item_enumeration.value
    _item_enumeration.detail
                               'hardware'
;              The element intensities were derived from the raw data of one
               or more pixels by used of hardware in the detector, e.g. by use
               of shift registers in a CCD to combine pixels into super-pixels.
;
                               'software'
;              The element intensities were derived from the raw data of more
               than one pixel by use of software.
;
                               'combined'
;              The element intensities were derived from the raw data of more
               than one pixel by use of both hardware and software, as when
               hardware binning is used in one direction and software in the
               other.
;
                               'none'
;              In the both directions, the data has not been binned.  The
               number of pixels is equal to the number of elements.

               When the value of _array_intensities.pixel_binning_method is
               'none' the values of _array_intensities.pixel_fast_bin_size
               and _array_intensities.pixel_slow_bin_size both must be 1.
;
                               'unspecified'
;              The method used to derive element intensities is not specified.
;
    _item_default.value        'unspecified'
    save_

save__array_intensities.scaling
    _item_description.description
;              Multiplicative scaling value to be applied to array data
               in the manner described by item
               _array_intensities.linearity.
;
    _item.name                 '_array_intensities.scaling'
    _item.category_id          array_intensities
    _item.mandatory_code       no
    _item_type.code            float
    save_



save__array_intensities.undefined_value
    _item_description.description
;              A value to be substituted for undefined values in
               the data array.
;
    _item.name                 '_array_intensities.undefined_value'
    _item.category_id          array_intensities
    _item.mandatory_code       no
    _item_type.code            float
    save_


###################
# ARRAY_STRUCTURE #
###################


save_ARRAY_STRUCTURE
    _category.description
;    Data items in the ARRAY_STRUCTURE category record the organization and
     encoding of array data that may be stored in the ARRAY_DATA category.
;
    _category.id                   array_structure
    _category.mandatory_code       no
    _category_key.name             '_array_structure.id'
    loop_
    _category_group.id             'inclusive_group'
                                   'array_data_group'
    loop_
    _category_examples.detail
    _category_examples.case
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;   Example 1 -
;
;
     loop_
    _array_structure.id
    _array_structure.encoding_type
    _array_structure.compression_type
    _array_structure.byte_order
     image_1       "unsigned 16-bit integer"  none  little_endian
;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     save_


save__array_structure.byte_order
    _item_description.description
;              The order of bytes for integer values which require more
               than 1 byte.

               (IBM-PC's and compatibles and DEC VAXs use low-byte-first
               ordered integers, whereas Hewlett Packard 700
               series, Sun-4 and Silicon Graphics use high-byte-first
               ordered integers.  DEC Alphas can produce/use either
               depending on a compiler switch.)
;

    _item.name                     '_array_structure.byte_order'
    _item.category_id               array_structure
    _item.mandatory_code            yes
    _item_type.code                 ucode
     loop_
    _item_enumeration.value
    _item_enumeration.detail
                                   'big_endian'
;       The first byte in the byte stream of the bytes which make up an
        integer value is the most significant byte of an integer.
;
                                   'little_endian'
;       The last byte in the byte stream of the bytes which make up an
        integer value is the most significant byte of an integer.
;
     save_


save__array_structure.compression_type
    _item_description.description
;             Type of data-compression method used to compress the array
              data.
;
    _item.name                   '_array_structure.compression_type'
    _item.category_id             array_structure
    _item.mandatory_code          no
    _item_type.code               ucode
    _item_default.value           'none'
     loop_
    _item_enumeration.value
    _item_enumeration.detail
                                  'byte_offset'
;       Using the 'byte_offset' compression scheme as per A. Hammersley
        and the CBFlib manual, section 3.3.3
;
                                  'canonical'
;       Using the 'canonical' compression scheme (International Tables
        for Crystallography Volume G, Section 5.6.3.1) and CBFlib
        manual section 3.3.1
;
                                  'none'
;       Data are stored in normal format as defined by
        _array_structure.encoding_type and
        _array_structure.byte_order.
;
                                  'packed'
;       Using the 'packed' compression scheme, a CCP4-style packing
        as per J. P. Abrahams pack_c.c and CBFlib manual, section 3.3.2.
;
                                  'packed_v2'
;       Using the 'packed' compression scheme, version 2, as per
        J. P. Abrahams pack_c.c and CBFlib manual, section 3.3.2.
;
    save_

save__array_structure.compression_type_flag
    _item_description.description
;             Flags modifying the type of data-compression method used to 
              compress the arraydata.
;
    _item.name                   '_array_structure.compression_type_flag'
    _item.category_id             array_structure
    _item.mandatory_code          no
    _item_type.code               ucode
     loop_
    _item_enumeration.value
    _item_enumeration.detail
                                  'uncorrelated_sections'
;       When applying packed or packed_v2 compression on an array with
        uncorrelated sections, do not average in points from the prior
        section.
;
                                  'flat'
;       When applying packed or packed_v2 compression on an array with
        treat the entire image as a single line set the maximum number
        of bits for an offset to 65 bits.
        
        The flag is included for compatibility with software prior to
        CBFlib_0.7.7, and should not be used for new data sets.

;

    save_

save__array_structure.encoding_type
    _item_description.description
;              Data encoding of a single element of array data.

               The type 'unsigned 1-bit integer' is used for
               packed Booleans arrays for masks.  Each element
               of the array corresponds to a single bit
               packed in unsigned 8-bit data.
               
               In several cases, the IEEE format is referenced.
               See IEEE Standard 754-1985 (IEEE, 1985).

               Ref: IEEE (1985). IEEE Standard for Binary Floating-Point
               Arithmetic. ANSI/IEEE Std 754-1985. New York: Institute of
               Electrical and Electronics Engineers.
;

    _item.name                '_array_structure.encoding_type'
    _item.category_id          array_structure
    _item.mandatory_code       yes
    _item_type.code            uline
     loop_
    _item_enumeration.value
                              'unsigned 1-bit integer'
                              'unsigned 8-bit integer'
                              'signed 8-bit integer'
                              'unsigned 16-bit integer'
                              'signed 16-bit integer'
                              'unsigned 32-bit integer'
                              'signed 32-bit integer'
                              'signed 32-bit real IEEE'
                              'signed 64-bit real IEEE'
                              'signed 32-bit complex IEEE'
     save_


save__array_structure.id
    _item_description.description
;             The value of _array_structure.id must uniquely identify
              each item of array data.
              
              This item has been made implicit and given a default value of 1
              as a convenience in writing miniCBF files.  Normally an
              explicit name with useful content should be used.
;
    loop_
    _item.name
    _item.category_id
    _item.mandatory_code
             '_array_structure.id'              array_structure      implicit
             '_array_data.array_id'             array_data           implicit
             '_array_structure_list.array_id'   array_structure_list implicit
             '_array_intensities.array_id'      array_intensities    implicit
             '_diffrn_data_frame.array_id'      diffrn_data_frame    implicit


    _item_default.value           1
    _item_type.code               code
     loop_
    _item_linked.child_name
    _item_linked.parent_name
             '_array_data.array_id'             '_array_structure.id'
             '_array_structure_list.array_id'   '_array_structure.id'
             '_array_intensities.array_id'      '_array_structure.id'
             '_diffrn_data_frame.array_id'      '_array_structure.id'

     save_


########################
# ARRAY_STRUCTURE_LIST #
########################


save_ARRAY_STRUCTURE_LIST
    _category.description
;    Data items in the ARRAY_STRUCTURE_LIST category record the size
     and organization of each array dimension.

     The relationship to physical axes may be given.
;
    _category.id                   array_structure_list
    _category.mandatory_code       no
     loop_
    _category_key.name             '_array_structure_list.array_id'
                                   '_array_structure_list.index'
    loop_
    _category_group.id             'inclusive_group'
                                   'array_data_group'
    loop_
    _category_examples.detail
    _category_examples.case
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;       Example 1 - An image array of 1300 x 1200 elements.  The raster
                    order of the image is left to right (increasing) in the
                    first dimension and bottom to top (decreasing) in
                    the second dimension.
;
;
        loop_
       _array_structure_list.array_id
       _array_structure_list.index
       _array_structure_list.dimension
       _array_structure_list.precedence
       _array_structure_list.direction
       _array_structure_list.axis_set_id
        image_1   1    1300    1     increasing  ELEMENT_X
        image_1   2    1200    2     decreasing  ELEMENY_Y
;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     save_


save__array_structure_list.array_id
    _item_description.description
;             This item is a pointer to _array_structure.id in the
              ARRAY_STRUCTURE category.
;
    _item.name                  '_array_structure_list.array_id'
    _item.category_id             array_structure_list
    _item.mandatory_code          implicit
    _item_type.code               code
save_


save__array_structure_list.axis_set_id
    _item_description.description
;              This is a descriptor for the physical axis or set of axes
               corresponding to an array index.

               This data item is related to the axes of the detector
               itself given in DIFFRN_DETECTOR_AXIS, but usually differs
               in that the axes in this category are the axes of the
               coordinate system of reported data points, while the axes in
               DIFFRN_DETECTOR_AXIS are the physical axes
               of the detector describing the 'poise' of the detector as an
               overall physical object.

               If there is only one axis in the set, the identifier of
               that axis should be used as the identifier of the set.
;
     loop_
    _item.name
    _item.category_id
    _item.mandatory_code
           '_array_structure_list.axis_set_id'
                                  array_structure_list            yes
           '_array_structure_list_axis.axis_set_id'
                                  array_structure_list_axis       implicit
    _item_type.code               code
     loop_
    _item_linked.child_name
    _item_linked.parent_name
           '_array_structure_list_axis.axis_set_id'
                               '_array_structure_list.axis_set_id'


     save_


save__array_structure_list.dimension
    _item_description.description
;              The number of elements stored in the array structure in 
               this dimension.
;
    _item.name                '_array_structure_list.dimension'
    _item.category_id          array_structure_list
    _item.mandatory_code       yes
    _item_type.code            int
     loop_
    _item_range.maximum
    _item_range.minimum
                            1  1
                            .  1
     save_


save__array_structure_list.direction
    _item_description.description
;             Identifies the direction in which this array index changes.
;
    _item.name                '_array_structure_list.direction'
    _item.category_id          array_structure_list
    _item.mandatory_code       yes
    _item_type.code            code
     loop_
    _item_enumeration.value
    _item_enumeration.detail

                              'increasing'
;        Indicates the index changes from 1 to the maximum dimension.
;
                              'decreasing'
;        Indicates the index changes from the maximum dimension to 1.
;
     save_


save__array_structure_list.index
    _item_description.description
;              Identifies the one-based index of the row or column in the
               array structure.
;
     loop_
    _item.name
    _item.category_id
    _item.mandatory_code
           '_array_structure_list.index'        array_structure_list   yes
           '_array_structure_list.precedence'   array_structure_list   yes
           '_array_element_size.index'          array_element_size     yes

    _item_type.code            int

     loop_
    _item_linked.child_name
    _item_linked.parent_name
          '_array_element_size.index'         '_array_structure_list.index'
     loop_
    _item_range.maximum
    _item_range.minimum
                            1  1
                            .  1
     save_


save__array_structure_list.precedence
    _item_description.description
;              Identifies the rank order in which this array index changes
               with respect to other array indices.  The precedence of 1
               indicates the index which changes fastest.
;
    _item.name                '_array_structure_list.precedence'
    _item.category_id          array_structure_list
    _item.mandatory_code       yes
    _item_type.code            int
     loop_
    _item_range.maximum
    _item_range.minimum
                            1  1
                            .  1
     save_


#############################
# ARRAY_STRUCTURE_LIST_AXIS #
#############################

save_ARRAY_STRUCTURE_LIST_AXIS
    _category.description
;    Data items in the ARRAY_STRUCTURE_LIST_AXIS category describe
     the physical settings of sets of axes for the centres of pixels that
     correspond to data points described in the
     ARRAY_STRUCTURE_LIST category.

     In the simplest cases, the physical increments of a single axis correspond
     to the increments of a single array index.  More complex organizations,
     e.g. spiral scans, may require coupled motions along multiple axes.

     Note that a spiral scan uses two coupled axes: one for the angular
     direction and one for the radial direction.  This differs from a
     cylindrical scan for which the two axes are not coupled into one 
     set.
;
    _category.id                   array_structure_list_axis
    _category.mandatory_code       no
     loop_
    _category_key.name
                                  '_array_structure_list_axis.axis_set_id'
                                  '_array_structure_list_axis.axis_id'
     loop_
    _category_group.id           'inclusive_group'
                                 'array_data_group'
     save_


save__array_structure_list_axis.axis_id
    _item_description.description
;              The value of this data item is the identifier of one of
               the axes in the set of axes for which settings are being
               specified.

               Multiple axes may be specified for the same value of
               _array_structure_list_axis.axis_set_id.

               This item is a pointer to _axis.id in the
               AXIS category.
;
    _item.name                 '_array_structure_list_axis.axis_id'
    _item.category_id          array_structure_list_axis
    _item.mandatory_code       yes
    _item_type.code            code
     save_


save__array_structure_list_axis.axis_set_id
    _item_description.description
;              The value of this data item is the identifier of the
               set of axes for which axis settings are being specified.

               Multiple axes may be specified for the same value of
               _array_structure_list_axis.axis_set_id.

               This item is a pointer to
               _array_structure_list.axis_set_id
               in the ARRAY_STRUCTURE_LIST category.

               If this item is not specified, it defaults to the corresponding
               axis identifier.
;
    _item.name                 '_array_structure_list_axis.axis_set_id'
    _item.category_id          array_structure_list_axis
    _item.mandatory_code       implicit
    _item_type.code            code
     save_


save__array_structure_list_axis.angle
    _item_description.description
;              The setting of the specified axis in degrees for the first
               data point of the array index with the corresponding value
               of _array_structure_list.axis_set_id.  If the index is
               specified as 'increasing', this will be the centre of the
               pixel with index value 1.  If the index is specified as
               'decreasing', this will be the centre of the pixel with
               maximum index value.
;
    _item.name                 '_array_structure_list_axis.angle'
    _item.category_id          array_structure_list_axis
    _item.mandatory_code       no
    _item_default.value        0.0
    _item_type.code            float
    _item_units.code           'degrees'
     save_


save__array_structure_list_axis.angle_increment
    _item_description.description
;              The pixel-centre-to-pixel-centre increment in the angular
               setting of the specified axis in degrees.  This is not
               meaningful in the case of 'constant velocity' spiral scans
               and should not be specified for this case.

               See _array_structure_list_axis.angular_pitch.

;
    _item.name                 '_array_structure_list_axis.angle_increment'
    _item.category_id          array_structure_list_axis
    _item.mandatory_code       no
    _item_default.value        0.0
    _item_type.code            float
    _item_units.code           'degrees'
     save_


save__array_structure_list_axis.displacement
    _item_description.description
;              The setting of the specified axis in millimetres for the first
               data point of the array index with the corresponding value
               of _array_structure_list.axis_set_id.  If the index is
               specified as 'increasing', this will be the centre of the
               pixel with index value 1.  If the index is specified as
               'decreasing', this will be the centre of the pixel with
               maximum index value.
;
    _item.name               '_array_structure_list_axis.displacement'
    _item.category_id          array_structure_list_axis
    _item.mandatory_code       no
    _item_default.value        0.0
    _item_type.code            float
    _item_units.code           'millimetres'
     save_

save__array_structure_list_axis.fract_displacement
    _item_description.description
;              The setting of the specified axis as a decimal fraction of 
               the axis unit vector for the first data point of the array 
               index with the corresponding value of 
               _array_structure_list.axis_set_id.  
               If the index is specified as 'increasing', this will be the 
               centre of the pixel with index value 1.  If the index is 
               specified as 'decreasing', this will be the centre of the 
               pixel with maximum index value.
;
    _item.name               '_array_structure_list_axis.fract_displacement'
    _item.category_id          array_structure_list_axis
    _item.mandatory_code       no
    _item_default.value        0.0
    _item_type.code            float
     save_

save__array_structure_list_axis.displacement_increment
    _item_description.description
;              The pixel-centre-to-pixel-centre increment for the displacement
               setting of the specified axis in millimetres.
;
    _item.name
        '_array_structure_list_axis.displacement_increment'
    _item.category_id          array_structure_list_axis
    _item.mandatory_code       no
    _item_default.value        0.0
    _item_type.code            float
    _item_units.code           'millimetres'
     save_

save__array_structure_list_axis.fract_displacement_increment
    _item_description.description
;              The pixel-centre-to-pixel-centre increment for the displacement
               setting of the specified axis as a decimal fraction of the
               axis unit vector.
;
    _item.name
        '_array_structure_list_axis.fract_displacement_increment'
    _item.category_id          array_structure_list_axis
    _item.mandatory_code       no
    _item_default.value        0.0
    _item_type.code            float
    _item_units.code           'millimetres'
     save_


save__array_structure_list_axis.angular_pitch
    _item_description.description
;              The pixel-centre-to-pixel-centre distance for a one-step
               change in the setting of the specified axis in millimetres.

               This is meaningful only for 'constant velocity' spiral scans
               or for uncoupled angular scans at a constant radius
               (cylindrical scans) and should not be specified for cases
               in which the angle between pixels (rather than the distance
               between pixels) is uniform.

               See _array_structure_list_axis.angle_increment.
;
    _item.name               '_array_structure_list_axis.angular_pitch'
    _item.category_id          array_structure_list_axis
    _item.mandatory_code       no
    _item_default.value        0.0
    _item_type.code            float
    _item_units.code           'millimetres'
     save_


save__array_structure_list_axis.radial_pitch
    _item_description.description
;              The radial distance from one 'cylinder' of pixels to the
               next in millimetres.  If the scan is a 'constant velocity'
               scan with differing angular displacements between pixels,
               the value of this item may differ significantly from the
               value of _array_structure_list_axis.displacement_increment.
;
    _item.name               '_array_structure_list_axis.radial_pitch'
    _item.category_id          array_structure_list_axis
    _item.mandatory_code       no
    _item_default.value        0.0
    _item_type.code            float
    _item_units.code           'millimetres'
     save_


save__array_structure_list_axis.reference_angle
     _item_description.description
;              The value of _array_structure_list_axis.reference_angle
               specifies the setting of the angle of this axis used for 
               determining a reference beam center and a reference detector 
               distance.  It is normally expected to be identical to the 
               value of _array_structure_list.angle.

;
     _item.name '_array_structure_list_axis.reference_angle'
     _item.category_id          array_structure_list_axis
     _item.mandatory_code       implicit
     _item_type.code            float
     _item_units.code           'degrees'
      save_


save__array_structure_list_axis.reference_displacement
     _item_description.description
;              The value of _array_structure_list_axis.reference_displacement
               specifies the setting of the displacement of this axis used 
               for determining a reference beam center and a reference detector
               distance.  It is normally expected to be identical to the value
               of _array_structure_list.displacement.

;
     _item.name '_array_structure_list_axis.reference_displacement'
     _item.category_id          array_structure_list_axis
     _item.mandatory_code       implicit
     _item_type.code            float
     _item_units.code           'millimetres'
      save_




########
# AXIS #
########

save_AXIS
    _category.description
;    Data items in the AXIS category record the information required
     to describe the various goniometer, detector, source and other
     axes needed to specify a data collection or the axes defining the
     coordinate system of an image.  
     
     The location of each axis is specified by two vectors: the axis 
     itself, given by a  unit vector in the direction of the axis, and 
     an offset to the base of the unit vector.  
     
     The vectors defining an axis are referenced to an appropriate
     coordinate system.  The axis vector, itself, is a dimensionless
     unit vector.  Where meaningful, the offset vector is given in
     millimetres.  In coordinate systems not measured in metres,
     the offset is not specified and is taken as zero. 
     
     The available coordinate systems are:
     
         The imgCIF standard laboratory coordinate system
         The direct lattice (fractional atomic coordinates)
         The orthogonal Cartesian coordinate system (real space)
         The reciprocal lattice
         An abstract orthogonal Cartesian coordinate frame
      
     For consistency in this discussion, we call the three coordinate 
     system axes X, Y and Z.  This is appropriate for the imgCIF
     standard laboratory coordinate system, and last two Cartesian
     coordinate systems, but for the direct lattice, X corresponds
     to a, Y to b and Z to c, while for the reciprocal lattice,
     X corresponds to a*, Y to b* and Z to c*.
     
     For purposes of visualization, all the coordinate systems are 
     taken as right-handed, i.e., using the convention that the extended 
     thumb of a right hand could point along the first (X) axis, the 
     straightened pointer finger could point along the second (Y) axis 
     and the middle finger folded inward could point along the third (Z)
     axis.  
     
     THE IMGCIF STANDARD LABORATORY COORDINATE SYSTEM
     
     The imgCIF standard laboratory coordinate system is a right-handed   
     orthogonal coordinate similar to the MOSFLM coordinate system,  
     but imgCIF puts Z along the X-ray beam, rather than putting X along the
     X-ray beam as in MOSFLM.
     
     The vectors for the imgCIF standard laboratory coordinate system
     form a right-handed Cartesian coordinate system with its origin
     in the sample or specimen.  The origin of the axis system should,
     if possible, be defined in terms of mechanically stable axes to be
     be both in the sample and in the beam.  If the sample goniometer or other
     sample positioner has two axes the intersection of which defines a
     unique point at which the sample should be mounted to be bathed
     by the beam, that will be the origin of the axis system.  If no such
     point is defined, then the midpoint of the line of intersection
     between the sample and the center of the beam will define the origin.
     For this definition the sample positioning system will be set at 
     its initial reference position for the experiment.


                             | Y (to complete right-handed system)
                             |
                             |
                             |
                             |
                             |
                             |________________X
                            /       principal goniometer axis
                           /
                          /
                         /
                        /
                       /Z (to source)




     Axis 1 (X): The X-axis is aligned to the mechanical axis pointing from
     the sample or specimen along the  principal axis of the goniometer or
     sample positioning system if the sample positioning system has an axis 
     that intersects the origin and which form an angle of more than 22.5 
     degrees with the beam axis.
     
     Axis 2 (Y): The Y-axis completes an orthogonal right-handed system
     defined by the X-axis and the Z-axis (see below).

     Axis 3 (Z): The Z-axis is derived from the source axis which goes from
     the sample to the source.  The Z-axis is the component of the source axis
     in the direction of the source orthogonal to the X-axis in the plane
     defined by the X-axis and the source axis.

     If the conditions for the X-axis can be met, the coordinate system
     will be based on the goniometer or other sample positioning system
     and the beam and not on the orientation of the detector, gravity etc.  
     The vectors necessary to specify all other axes are given by sets of 
     three components in the order (X, Y, Z).
     If the axis involved is a rotation axis, it is right-handed, i.e. as
     one views the object to be rotated from the origin (the tail) of the
     unit vector, the rotation is clockwise.  If a translation axis is
     specified, the direction of the unit vector specifies the sense of
     positive translation.

     Note:  This choice of coordinate system is similar to but significantly
     different from the choice in MOSFLM (Leslie & Powell, 2004).  In MOSFLM,
     X is along the X-ray beam (the CBF/imgCIF Z axis) and Z is along the
     rotation axis.
     
     In some experimental techniques, there is no goniometer or the principal
     axis of the goniometer is at a small acute angle with respect to
     the source axis.  In such cases, other reference axes are needed
     to define a useful coordinate system.  The order of priority in
     defining directions in such cases is to use the detector, then
     gravity, then north.
     
     
     If the X-axis cannot be defined as above, then the
     direction (not the origin) of the X-axis should be parallel to the axis 
     of the primary detector element corresponding to the most rapidly 
     varying dimension of that detector element's data array, with its 
     positive sense corresponding to increasing values of the index for 
     that dimension.  If the detector is such that such a direction cannot 
     be defined (as with a point detector) or that direction forms an
     angle of less than 22.5 degrees with respect to the source axis, then 
     the X-axis should be chosen so that if the Y-axis is chosen 
     in the direction of gravity, and the Z-axis is chosen to be along 
     the source axis, a right-handed orthogonal coordinate system is chosen.  
     In the case of a vertical source axis, as a last resort, the 
     X-axis should be chosen to point North.
     
     All rotations are given in degrees and all translations are given in mm.

     Axes may be dependent on one another.  The X-axis is the only goniometer
     axis the direction of which is strictly connected to the hardware.  All
     other axes are specified by the positions they would assume when the
     axes upon which they depend are at their zero points.

     When specifying detector axes, the axis is given to the beam centre.
     The location of the beam centre on the detector should be given in the
     DIFFRN_DETECTOR category in distortion-corrected millimetres from
     the (0,0) corner of the detector.

     It should be noted that many different origins arise in the definition
     of an experiment.  In particular, as noted above, it is necessary to
     specify the location of the beam centre on the detector in terms
     of the origin of the detector, which is, of course, not coincident
     with the centre of the sample.
     
     The unit cell, reciprocal cell and crystallographic orthogonal 
     Cartesian coordinate system are defined by the CELL and the matrices 
     in the ATOM_SITES category.
     
     THE DIRECT LATTICE (FRACTIONAL COORDINATES)
     
     The direct lattice coordinate system is a system of fractional
     coordinates aligned to the crystal, rather than to the laboratory.
     This is a natural coordinate system for maps and atomic coordinates.
     It is the simplest coordinate system in which to apply symmetry.
     The axes are determined by the cell edges, and are not necessarily
     othogonal.  This coordinate system is not uniquely defined and 
     depends on the cell parameters in the CELL category and the
     settings chosen to index the crystal. 
     
     Molecules in a crystal studied by X-ray diffracraction are organized
     into a repeating regular array of unit cells.  Each unit cell is defined 
     by three vectors, a, b and c.  To quote from Drenth,
     
     
     "The choice of the unit cell is not unique and therefore, guidelines
     have been established for selecting the standard basis vectors and
     the origin.  They are based on symmetry and metric considerations:
     
      "(1)  The axial system should be right handed.
       (2)  The basis vectors should coincide as much as possible with
       directions of highest symmetry."
       (3)  The cell taken should be the smallest one that satisfies
       condition (2)
       (4)  Of all the lattice vectors, none is shorter than a.
       (5)  Of those not directed along a, none is shorter than b.
       (6)  Of those not lying in the ab plane, none is shorter than c.
       (7)  The three angles between the basis vectors a, b and c are
       either all acute (<90\%) or all obtuse (≥90\%)."
     
     These rules do not produce a unique result that is stable under
     the assumption of experimental errors, and the the resulting cell
     may not be primitive.
     
     In this coordinate system, the vector (.5, .5, .5) is in the middle
     of the given unit cell.
     
     Grid coordinates are an important variation on fractional coordinates
     used when working with maps.  In imgCIF, the conversion from
     fractional to grid coordinates is implicit in the array indexing
     specified by _array_structure_list.dimension.  Note that this
     implicit grid-coordinate scheme is 1-based, not zero-based, i.e.
     the origin of the cell for axes along the cell edges with no
     specified _array_structure_list_axis.displacement will have
     grid coordinates of (1,1,1), i.e. array indices of (1,1,1).
     
     THE ORTHOGONAL CARTESIAN COORDINATE SYSTEM (REAL SPACE)
     
     The orthogonal Cartesian coordinate system is a transformation of
     the direct lattice to the actual physical coordinates of atoms in
     space.  It is similar to the laboratory coordinate system, but
     is anchored to and moves with the crystal, rather than being
     schored to the laboratory.  The transformation from fractional
     to orthogonal cartesian coordinates is given by the
              _atom_sites.Cartn_transf_matrix[i][j]  and
              _atom_sites.Cartn_transf_vector[i]
     tags.  A common choice for the matrix of the transformation is 
     given in the 1992 PDB format document
     
              | a      b cos(\g)   c cos(\b)                            |
              | 0      b sin(\g)   c (cos(\a) - cos(\b)cos(\g))/sin(\g) |
              | 0      0           V/(a b sin(\g))                      |
     
     This is a convenient coordinate system in which to do fitting
     of models to maps and in which to understand the chemistry of
     a molecule.
     
     THE RECIPROCAL LATTICE
     
     The reciprocal lattice coordinate system is used for diffraction
     intensitities.  It is based on the reciprocal cell, the dual of the cell,
     in which reciprocal cell edges are derived from direct cell faces:
     
        a* = bc sin(\a)/V  b* = ac sin(\b)/V  c* = ab sin(\g)/V
        cos(\a*) = (cos(\b) cos(\g) - cos(\a))/(sin(\b) sin(\g))
        cos(\b*) = (cos(\a) cos(\g) - cos(\b))/(sin(\a) sin(\g))
        cos(\g*) = (cos(\a) cos(\b) - cos(\g))/(sin(\a) sin(\b))
        V = abc SQRT(1 - cos(\a)^2^ 
                       - cos(\b)^2^ 
                       - cos(\g)^2^ 
                       + 2 cos(\a) cos(\b) cos(\g) )
     
     In this form the dimensions of the reciprocal lattice are in reciprocal
     \%Angstroms (\%A^-1^).  A dimensionless form can be obtained by 
     multiplying by the wavelength.  Reflections are commonly indexed against
     this coordinate system as (h, k, l) triples.
     
     
     References:
     
     Drenth, J., "Introduction to basic crystallography." chapter
     2.1 in Rossmann, M. G. and Arnold, E. "Crystallography of 
     biological macromolecules", Volume F of the IUCr's "International 
     tables for crystallography", Kluwer, Dordrecht 2001, pp 44 -- 63

     Leslie, A. G. W. and Powell, H. (2004). MOSFLM v6.11.
     MRC Laboratory of Molecular Biology, Hills Road, Cambridge, England.
     http://www.CCP4.ac.uk/dist/X-windows/Mosflm/.
     
     Stout, G. H. and Jensen, L. H., "X-ray structure determination",
     2nd ed., Wiley, New York, 1989, 453 pp.
     
     __, "PROTEIN DATA BANK ATOMIC COORDINATE AND BIBLIOGRAPHIC ENTRY
     FORMAT DESCRIPTION," Brookhaven National Laboratory, February 1992.
;
    _category.id                   axis
    _category.mandatory_code       no
     loop_
    _category_key.name          '_axis.id'
                                '_axis.equipment'
     loop_
    _category_group.id           'inclusive_group'
                                 'axis_group'
                                 'diffrn_group'
    loop_
    _category_examples.detail
    _category_examples.case
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;       Example 1 -

        This example shows the axis specification of the axes of a kappa-
        geometry goniometer [see Stout, G. H. & Jensen, L. H. (1989). X-ray
        structure determination. A practical
        guide, 2nd ed. p. 134. New York: Wiley Interscience].

        There are three axes specified, and no offsets.  The outermost axis,
        omega, is pointed along the X axis.  The next innermost axis, kappa,
        is at a 50 degree angle to the X axis, pointed away from the source.
        The innermost axis, phi, aligns with the X axis when omega and
        phi are at their zero points.  If T-omega, T-kappa and T-phi
        are the transformation matrices derived from the axis settings,
        the complete transformation would be:
            X' = (T-omega) (T-kappa) (T-phi) X
;
;
         loop_
        _axis.id
        _axis.type
        _axis.equipment
        _axis.depends_on
        _axis.vector[1] _axis.vector[2] _axis.vector[3]
        omega rotation goniometer     .    1        0        0
        kappa rotation goniometer omega    -.64279  0       -.76604
        phi   rotation goniometer kappa    1        0        0
;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;       Example 2 -

        This example shows the axis specification of the axes of a
        detector, source and gravity.  The order has been changed as a
        reminder that the ordering of presentation of tokens is not
        significant.  The centre of rotation of the detector has been taken
        to be 68 millimetres in the direction away from the source.
;
;
        loop_
        _axis.id
        _axis.type
        _axis.equipment
        _axis.depends_on
        _axis.vector[1] _axis.vector[2] _axis.vector[3]
        _axis.offset[1] _axis.offset[2] _axis.offset[3]
        source       .        source     .       0     0     1   . . .
        gravity      .        gravity    .       0    -1     0   . . .
        tranz     translation detector rotz      0     0     1   0 0 -68
        twotheta  rotation    detector   .       1     0     0   . . .
        roty      rotation    detector twotheta  0     1     0   0 0 -68
        rotz      rotation    detector roty      0     0     1   0 0 -68
;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;       Example 3 -

        This example show the axis specification of the axes for a map,
        using fractional coordinates.  Each cell edge has been divided
        into a grid of 50 divisions in the ARRAY_STRUCTURE_LIST_AXIS 
        category.  The map is using only the first octant of the grid
        in the ARRAY_STRUCTURE_LIST category.

        The fastest changing axis is the gris along A, then along B,
        and the slowest is along C. 
        
        The map sampling is being done in the middle of each grid
        division
        
;
;
        loop_
        _axis.id
        _axis.system
        _axis.vector[1] _axis.vector[2] _axis.vector[3]
        CELL_A_AXIS    fractional       1 0 0
        CELL_B_AXIS    fractional       0 1 0
        CELL_C_AXIS    fractional       0 0 1
        
        loop_
        _array_structure_list.array_id
        _array_structure_list.index
        _array_structure_list.dimension
        _array_structure_list.precedence
        _array_structure_list.direction
        _array_structure_list.axis_id
        MAP 1 25 1 increasing CELL_A_AXIS
        MAP 1 25 2 increasing CELL_B_AXIS
        MAP 1 25 3 increasing CELL_C_AXIS
        
        loop_
        _array_structure_list_axis.axis_id
        _array_structure_list_axis.fract_displacement
        _array_structure_list_axis.fract_displacement_increment
        CELL_A_AXIS 0.01 0.02
        CELL_B_AXIS 0.01 0.02
        CELL_C_AXIS 0.01 0.02

        
        
;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;       Example 4 -

        This example show the axis specification of the axes for a map,
        this time as orthogonal \%Angstroms, using the same coordinate system 
        as for the atomic coordinates.  The map is sampling every 1.5
        \%Angstroms (1.5e-7 millimeters) in a map segment 37.5 \%Angstroms on 
        a side.
        
;
;
        loop_
        _axis.id
        _axis.system
        _axis.vector[1] _axis.vector[2] _axis.vector[3]
        X    orthogonal       1 0 0
        Y    orthogonal       0 1 0
        Z    orthogonal       0 0 1
        
                loop_
        _array_structure_list.array_id
        _array_structure_list.index
        _array_structure_list.dimension
        _array_structure_list.precedence
        _array_structure_list.direction
        _array_structure_list.axis_id
        MAP 1 25 1 increasing X
        MAP 2 25 2 increasing Y
        MAP 3 25 3 increasing Z
        
        loop_
        _array_structure_list_axis.axis_id
        _array_structure_list_axis.displacement
        _array_structure_list_axis.displacement_increment
        X 7.5e-8 1.5e-7
        Y 7.5e-8 1.5e-7
        Z 7.5e-8 1.5e-7


;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     save_


save__axis.depends_on
    _item_description.description
;             The value of _axis.depends_on specifies the next outermost
              axis upon which this axis depends.

              This item is a pointer to _axis.id in the same category.
;
    _item.name                      '_axis.depends_on'
    _item.category_id                 axis
    _item.mandatory_code              no

     save_


save__axis.equipment
    _item_description.description
;             The value of  _axis.equipment specifies the type of
              equipment using the axis:  'goniometer', 'detector',
              'gravity', 'source' or 'general'.
;
    _item.name                      '_axis.equipment'
    _item.category_id                 axis
    _item.mandatory_code              no
    _item_type.code                   ucode
    _item_default.value               general
     loop_
    _item_enumeration.value
    _item_enumeration.detail   goniometer
                              'equipment used to orient or position samples'
                               detector
                              'equipment used to detect reflections'
                               general
                              'equipment used for general purposes'
                               gravity
                              'axis specifying the downward direction'
                               source
                              'axis specifying the direction sample to source'

     save_


save__axis.offset[1]
    _item_description.description
;              The [1] element of the three-element vector used to specify
               the offset to the base of a rotation or translation axis.

               The vector is specified in millimetres.
;
    _item.name                  '_axis.offset[1]'
    _item.category_id             axis
    _item.mandatory_code          no
    _item_default.value           0.0
    _item_sub_category.id         vector
    _item_type.code               float
    _item_units.code              millimetres
     save_


save__axis.offset[2]
    _item_description.description
;              The [2] element of the three-element vector used to specify
               the offset to the base of a rotation or translation axis.

               The vector is specified in millimetres.
;
    _item.name                  '_axis.offset[2]'
    _item.category_id             axis
    _item.mandatory_code          no
    _item_default.value           0.0
    _item_sub_category.id         vector
    _item_type.code               float
    _item_units.code              millimetres
     save_


save__axis.offset[3]
    _item_description.description
;              The [3] element of the three-element vector used to specify
               the offset to the base of a rotation or translation axis.

               The vector is specified in millimetres.
;
    _item.name                  '_axis.offset[3]'
    _item.category_id             axis
    _item.mandatory_code          no
    _item_default.value           0.0
    _item_sub_category.id         vector
    _item_type.code               float
    _item_units.code              millimetres
     save_


save__axis.id
    _item_description.description
;             The value of _axis.id must uniquely identify
              each axis relevant to the experiment.  Note that multiple
              pieces of equipment may share the same axis (e.g. a twotheta
              arm), so the category key for AXIS also includes the
              equipment.
;
    loop_
    _item.name
    _item.category_id
    _item.mandatory_code
         '_axis.id'                         axis                    yes
         '_array_structure_list_axis.axis_id'
                                            array_structure_list_axis
                                                                    yes
         '_diffrn_detector_axis.axis_id'    diffrn_detector_axis    yes
         '_diffrn_measurement_axis.axis_id' diffrn_measurement_axis yes
         '_diffrn_scan_axis.axis_id'        diffrn_scan_axis        yes
         '_diffrn_scan_frame_axis.axis_id'  diffrn_scan_frame_axis  yes

    _item_type.code               code
     loop_
    _item_linked.child_name
    _item_linked.parent_name
         '_axis.depends_on'                   '_axis.id'
         '_array_structure_list_axis.axis_id' '_axis.id'
         '_diffrn_detector_axis.axis_id'      '_axis.id'
         '_diffrn_measurement_axis.axis_id'   '_axis.id'
         '_diffrn_scan_axis.axis_id'          '_axis.id'
         '_diffrn_scan_frame_axis.axis_id'    '_axis.id'

     save_

save__axis.system
    _item_description.description
;             The value of  _axis.system specifies the coordinate
              system used to define the axis: 'laboratory', 'direct', 
              'orthogonal', 'reciprocal' or 'abstract'.
;
    _item.name                      '_axis.system'
    _item.category_id                 axis
    _item.mandatory_code              no
    _item_type.code                   ucode
    _item_default.value               laboratory
     loop_
    _item_enumeration.value
    _item_enumeration.detail   

laboratory
;  the axis is referenced to the imgCIF standard laboratory Cartesian
   coordinate system
;

direct
;  the axis is referenced to the direct lattice
;

orthogonal
;  the axis is referenced to the cell Cartesian orthogonal coordinates
;

reciprocal
;  the axis is referenced to the reciprocal lattice
;

abstract
;  the axis is referenced to abstract Cartesian cooridinate system
;

     save_


save__axis.type
    _item_description.description
;             The value of _axis.type specifies the type of
              axis:  'rotation' or 'translation' (or 'general' when
              the type is not relevant, as for gravity).
;
    _item.name                      '_axis.type'
    _item.category_id                 axis
    _item.mandatory_code              no
    _item_type.code                   ucode
    _item_default.value               general
     loop_
    _item_enumeration.value
    _item_enumeration.detail      rotation
                                 'right-handed axis of rotation'
                                  translation
                                 'translation in the direction of the axis'
                                  general
                                 'axis for which the type is not relevant'

     save_


save__axis.vector[1]
    _item_description.description
;              The [1] element of the three-element vector used to specify
               the direction of a rotation or translation axis.
               The vector should be normalized to be a unit vector and
               is dimensionless.
;
    _item.name                  '_axis.vector[1]'
    _item.category_id             axis
    _item.mandatory_code          no
    _item_default.value           0.0
    _item_sub_category.id         vector
    _item_type.code               float
     save_

save__axis.vector[2]
    _item_description.description
;              The [2] element of the three-element vector used to specify
               the direction of a rotation or translation axis.
               The vector should be normalized to be a unit vector and
               is dimensionless.
;
    _item.name                  '_axis.vector[2]'
    _item.category_id             axis
    _item.mandatory_code          no
    _item_default.value           0.0
    _item_sub_category.id         vector
    _item_type.code               float
     save_

save__axis.vector[3]
    _item_description.description
;              The [3] element of the three-element vector used to specify
               the direction of a rotation or translation axis.
               The vector should be normalized to be a unit vector and
               is dimensionless.
;
    _item.name                  '_axis.vector[3]'
    _item.category_id             axis
    _item.mandatory_code          no
    _item_default.value           0.0
    _item_sub_category.id         vector
    _item_type.code               float
     save_



#####################
# DIFFRN_DATA_FRAME #
#####################


save_DIFFRN_DATA_FRAME
    _category.description
;             Data items in the DIFFRN_DATA_FRAME category record
              the details about each frame of data.

              The items in this category were previously in a
              DIFFRN_FRAME_DATA category, which is now deprecated.
              The items from the old category are provided
              as aliases but should not be used for new work.
;
    _category.id                   diffrn_data_frame
    _category.mandatory_code       no
     loop_
    _category_key.name             '_diffrn_data_frame.id'
                                   '_diffrn_data_frame.detector_element_id'
    loop_
    _category_group.id             'inclusive_group'
                                   'array_data_group'
    loop_
    _category_examples.detail
    _category_examples.case
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;   Example 1 - A frame containing data from 4 frame elements.
                Each frame element has a common array configuration
                'array_1' described in ARRAY_STRUCTURE and related
                categories.  The data for each detector element are
                stored in four groups of binary data in the
                ARRAY_DATA category, linked by the array_id and
                binary_id.
;
;
        loop_
        _diffrn_data_frame.id
        _diffrn_data_frame.detector_element_id
        _diffrn_data_frame.array_id
        _diffrn_data_frame.binary_id
        frame_1   d1_ccd_1  array_1  1
        frame_1   d1_ccd_2  array_1  2
        frame_1   d1_ccd_3  array_1  3
        frame_1   d1_ccd_4  array_1  4
;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    save_


save__diffrn_data_frame.array_id
    _item_description.description
;             This item is a pointer to _array_structure.id in the
              ARRAY_STRUCTURE category.
;
    _item.name                  '_diffrn_data_frame.array_id'
    _item.category_id             diffrn_data_frame
    _item.mandatory_code          implicit
    _item_aliases.alias_name    '_diffrn_frame_data.array_id'
    _item_aliases.dictionary      cif_img.dic
    _item_aliases.version         1.0
    _item_type.code               code
     save_


save__diffrn_data_frame.binary_id
    _item_description.description
;             This item is a pointer to _array_data.binary_id in the
              ARRAY_DATA category.
;
    _item.name                  '_diffrn_data_frame.binary_id'
    _item.category_id             diffrn_data_frame
    _item.mandatory_code          implicit
    _item_aliases.alias_name    '_diffrn_frame_data.binary_id'
    _item_aliases.dictionary      cif_img.dic
    _item_aliases.version         1.0
    _item_type.code               int
     save_


save__diffrn_data_frame.center_fast
     _item_description.description
;             The value of _diffrn_data_frame.center_fast is 
              the fast index axis beam center position relative to the detector
              element face in the units specified in the data item
              '_diffrn_data_frame.center_units' along the fast
              axis of the detector from the center of the first pixel to 
              the point at which the Z-axis (which should be colinear with the
              beam) intersects the face of the detector, if in fact is does.
              At the time of the measurement the current setting of detector
              positioner given frame are used.

              It is important to note that for measurements in millimetres,
              the sense of the axis is used, rather than the sign of the 
              pixel-to-pixel increments.

;
     _item.name '_diffrn_data_frame.center_fast'
     _item.category_id             diffrn_data_frame
     _item.mandatory_code          no
     _item_type.code               float

     save_


save__diffrn_data_frame.center_slow
     _item_description.description
;             The value of _diffrn_data_frame.center_slow is
              the slow index axis beam center position relative to the detector
              element face in the units specified in the data item
              '_diffrn_data_frame.center_units' along the slow
              axis of the detector from the center of the first pixel to 
              the point at which the Z-axis (which should be colinear with the
              beam) intersects the face of the detector, if in fact is does.
              At the time of the measurement the current setting of detector
              positioner given frame are used.

              It is important to note that the sense of the axis is used,
              rather than the sign of the pixel-to-pixel increments.

;
     _item.name '_diffrn_data_frame.center_slow'
     _item.category_id             diffrn_data_frame
     _item.mandatory_code          no
     _item_type.code               float

     save_


save__diffrn_data_frame.center_units
     _item_description.description
;             The value of _diffrn_data_frame.center_units
              specifies the units in which the values of 
              '_diffrn_data_frame.center_fast' and
              '_diffrn_data_frame.center_slow'
              are presented.  The default is 'mm' for millimetres.  The 
              alternatives are 'pixels' and 'bins'.  In all cases the
              center distances are measured from the center of the
              first pixel, i.e. in a 2x2 binning, the measuring origin
              is offset from the centers of the bins by one half pixel
              towards the first pixel.
              
              If 'bins' is specified, the data in
                  '_array_intensities.pixel_fast_bin_size',
                  '_array_intensities.pixel_slow_bin_size', and
                  '_array_intensities.pixel_binning_method'
              is used to define the binning scheme.


;
     _item.name '_diffrn_data_frame.center_units'
     _item.category_id             diffrn_data_frame
     _item.mandatory_code          no
     _item_type.code               code
      loop_
     _item_enumeration.value
     _item_enumeration.detail
                                   mm        'millimetres'
                                   pixels    'detector pixels'
                                   bins      'detector bins'

     save_




save__diffrn_data_frame.detector_element_id
    _item_description.description
;              This item is a pointer to _diffrn_detector_element.id
               in the DIFFRN_DETECTOR_ELEMENT category.
;
    _item.name                  '_diffrn_data_frame.detector_element_id'
    _item.category_id             diffrn_data_frame
    _item.mandatory_code          yes
    _item_aliases.alias_name    '_diffrn_frame_data.detector_element_id'
    _item_aliases.dictionary      cif_img.dic
    _item_aliases.version         1.0
    _item_type.code               code
     save_


save_