Skip to content
jamesrhester edited this page Jan 11, 2013 · 5 revisions

Examples of xasCIF syntax

In CIF, datanames are prefixed by an underscore, and all datanames and datavalues are whitespace separated. Tabular data are prefixed by the keyword 'loop_', following which there is a list of data columns, then the data themselves. Data must appear in columnar order, but there are no formatting restrictions beyond the requirement that data values are whitespace separated.

Beamline namespace

 _xafs_beamline.name   'X11-A'
 _xafs_beamline.collimation    none
 _xafs_beamline.focusing       none
 _xafs_beamline.harmonic_rejection  'detuned mono by 50% on I0'

`

Scan namespace

 _xafs_scan.start   20110401T1202
 _xafs_scan.finish  20110401T1212

Mono namespace

 _xafs_monochromator.material    Si
 _xafs_monochromator.reflection  111
 _xafs_monochromator.d_spacing   3.13525

Facility namespace

_xafs_facility.name    NSLS
_xafs_facility.xray_source   'bending magnet'`

Detector namespace

The example here expands on the XDI example by showing how multiple tables can be used to capture different aspects of the detector system. In the example below, the first loop structure acts as a master table, with the values in the columns being used to index into subsequent tables. For example, an application wishing to determine the length of the ionisation detector at the detector position (found by looking down column _xafs_detectors.position) would see that the ionisation detector at this position has label 'io-detector'. The row indexed by 'io-detector' in the ionisation chamber table gives a length of 10cm. If the application additionally wishes to know the gas mix for this detector, it can look up all rows with 'mix1' in the gas mix table to find the proportions of each gas.

Note that the order of presentation of the tables is not relevant, and the pointers between tables would be predefined when developing the XAFS standard. The process of following such pointers is a routine relational database operation and also easily implemented in a few lines of code.

loop_
    _xafs_detectors.label
    _xafs_detectors.position
    _xafs_detectors.type
    _xafs_detectors.special_details
monitor   monitor       ionisation       .
fl-detector  detector   fluorescence     '36-element PAD detector'
io-detector  detector   ionisation     .
foil      foil          ionisation     .

loop_
    _xafs_ionisation_detector.label
    _xafs_ionisation_detector.gas_pressure
    _xafs_ionisation_detector.gas_mix
    _xafs_ionisation_detector.length
    _xafs_ionisation_detector.amplifier
    _xafs_ionisation_detector.amplifier_gain
monitor         1      mix1  10     'Keithley'    10
io-detector     1      mix1  20     'Keithley'    10
foil            1      mix2   5     'Keithley'    11

loop_
    _xafs_detector_gas_mix.label
    _xafs_detector_gas_mix.gas
    _xafs_detector_gas_mix.percentage
mix1           N2             20
mix1           He             80
mix2           N2            100

Sample namespace

_xafs_sample.name        Hematite
_xafs_sample.formula     Fe2O3
_xafs_sample.prep        'Powder spread on polyamide tape'
_xafs_sample.temperature 296

Data namespace

loop_
  _xafs_reduced.energy
  _xafs_reduced.mu
  _xafs_reduced.monitor
  6899.9609 -1.3070486 149013.70
  6900.1421 -1.3006104 144864.70
  6900.5449 -1.3033816 132978.70
  6900.9678 -1.3059724 125444.70
 ...

Example xasCIF file

A CIF file consists of a set of datablocks (often only one), each containing a set of key-value pairs intermingled with loops (i.e. tables, see above). The order of appearance of key-value pairs and tables is not significant.

data_xafs_example
  _xafs_beamline.name   'X11-A'
 _xafs_beamline.collimation    none
 _xafs_beamline.focusing       none
 _xafs_beamline.harmonic_rejection  'detuned mono by 50% on I0'
 _xafs_scan.start   20110401T1202
 _xafs_scan.finish  20110401T1212
 _xafs_monochromator.material    Si
 _xafs_monochromator.reflection  111
 _xafs_monochromator.d_spacing   3.13525
_xafs_facility.name    NSLS
_xafs_facility.xray_source   'bending magnet'`
loop_
    _xafs_detectors.label
    _xafs_detectors.position
    _xafs_detectors.type
    _xafs_detectors.special_details
monitor   monitor       ionisation       .
fl-detector  detector   fluorescence     '36-element PAD detector'
io-detector  detector   ionisation     .
foil      foil          ionisation     .

loop_
    _xafs_ionisation_detector.label
    _xafs_ionisation_detector.gas_pressure
    _xafs_ionisation_detector.gas_mix
    _xafs_ionisation_detector.length
    _xafs_ionisation_detector.amplifier
    _xafs_ionisation_detector.amplifier_gain
monitor         1      mix1  10     'Keithley'    10
io-detector     1      mix1  20     'Keithley'    10
foil            1      mix2   5     'Keithley'    11

loop_
    _xafs_detector_gas_mix.label
    _xafs_detector_gas_mix.gas
    _xafs_detector_gas_mix.percentage
mix1           N2             20
mix1           He             80
mix2           N2            100

_xafs_sample.name        Hematite
_xafs_sample.formula     Fe2O3
_xafs_sample.prep        'Powder spread on polyamide tape'
_xafs_sample.temperature 296

loop_
  _xafs_reduced.energy
  _xafs_reduced.mu
  _xafs_reduced.monitor
  6899.9609 -1.3070486 149013.70
  6900.1421 -1.3006104 144864.70
  6900.5449 -1.3033816 132978.70
  6900.9678 -1.3059724 125444.70
 ...