Skip to content

Commit 987b31b

Browse files
committed
more work on spec and dictionary
1 parent 151c588 commit 987b31b

File tree

14 files changed

+176
-138
lines changed

14 files changed

+176
-138
lines changed

README.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,12 @@ files containing single-scan XAS data.
1414
not yet been released.**
1515

1616

17-
Specification Document
18-
------------------------
17+
Specification Documents
18+
-----------------------
1919

20+
* The [XDI specification](specification/spec.md), version 1.0.
2021

21-
The [XDI specification](specification/spec.md), version 1.0.
22-
23-
24-
The
25-
[metadata dictionary](https://github.com/XraySpectroscopy/XAS-Data-Interchange/wiki/Dictionary-of-metadata)
26-
is also a GitHub wiki
22+
* The [metadata dictionary](specification/dictionary.md), version 1.0.
2723

2824

2925

@@ -66,9 +62,11 @@ Other files
6662
validate as XDI
6763
* The `doc/` folder contains the LaTeX source of the poster on XDI
6864
presented at the XAFS15 conference
69-
* The `magic` file can be appended to `/etc/magic` or otherwise used
70-
by the Unix file determination system:
65+
* The `filemagic` folder contains tools for use by the Unix file
66+
determination system:
7167

7268
~> file -m magic data/co_metal_rt.xdi
7369
data/co_metal_rt.xdi: XAS Data Interchange file -- XDI specification 1.0
7470

71+
It also defines an icon and a registry entry for XDI files on
72+
Windows.

filemagic/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Tools for using XDI files
2+
=========================
3+
4+
# Unix computers
5+
6+
* `magic`: file type difinition for XDI for the [Unix file type recognition system](http://en.wikipedia.org/wiki/File_%28command%29)
7+
* `install_magic`: Bash shell script for installing the contents of the `magic` file
8+
9+
10+
Install XDI file magic as root:
11+
12+
~> sudo ./install_magic
13+
14+
This assumes that the file `/etc/magic` is used for local magic data.
15+
If the local file magic file is in some other location on your
16+
computer, then
17+
18+
~> sudo ./install_magic /path/to/magic
19+
20+
where `/path/to/magic` is that location on your computer.
21+
22+
Once installed, XDI files can be identified with the [file command](http://en.wikipedia.org/wiki/File_%28command%29):
23+
24+
~> file -m magic data/co_metal_rt.xdi
25+
data/co_metal_rt.xdi: XAS Data Interchange file -- XDI specification 1.0
26+
27+
# Windows computers
28+
29+
* `xdi.ico`: Windows icon for XDI files
30+
* `xdi.reg`: Windows registry entry for XDI files
31+
32+
Double click on the `xdi.reg` file to modify a computer's registry.
33+
Once this is done, XDI files will be displayed using the XDI icon.

specification/README.md

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,24 @@ XDI Specification Documents
33

44
* [XDI Specification](spec.md): The XAS Data Interchange specification [(PDF file)](xdi_spec.pdf)
55

6+
* [Dictionary of Metadata](dictionary.md): The XDI dictionary [(PDF file)](xdi_dictionary.pdf)
7+
68
* [XDI background](background.md): Background on what XDI can be used for [(PDF file)](xdi_background.pdf)
79

8-
* [Dictionary of Metadata](dictionary.md): The XDI dictionary [(PDF file)](xdi_dictionary.pdf)
10+
## Generating PDF versions of these documents
911

10-
## Generating PDF version of the specification documents
12+
The following software is used to convert the markdown source files
13+
into nice-lookingt PDF files:
1114

12-
The file [maketex.sh](maketex.sh) is a Bash shell script which uses
13-
[Pandoc](http://johnmacfarlane.net/pandoc/) and
14-
[sed](http://www.gnu.org/software/sed/) to convert the markdown source
15-
into latex and to apply several hand-crafted customizations to make
16-
the resulting PDF documents look lovely.
15+
1. [Pandoc](http://johnmacfarlane.net/pandoc/): convert markdown into LaTeX.
16+
1. [sed](http://www.gnu.org/software/sed/): apply several customizations to the LaTeX files
17+
1. [pdflatex](https://www.tug.org/texlive/): compile the LaTeX files into PDF
1718

18-
The latex files are then compiled into PDF using
19-
[pdflatex](https://www.tug.org/texlive/).
19+
The file [maketex.sh](maketex.sh) is a Bash shell script which
20+
automates the first two steps.
21+
22+
The file [xdi.sty](xdi.sty) is a LeTeX style file which controls the
23+
appearance of the PDF output
2024

2125
**To make the XDI Specification document:**
2226

@@ -29,14 +33,6 @@ pdflatex twice to get all the internal references correct.
2933

3034
This makes a PDF file called `xdi_spec.pdf`.
3135

32-
**To make the XDI Background document:**
33-
34-
~> ./maketex.sh background
35-
~> pdflatex xdi_background.tex
36-
~> pdflatex xdi_background.tex
37-
38-
This makes a PDF file called `xdi_background.pdf`.
39-
4036
**To make the XDI Dictionary of Metadata document:**
4137

4238
~> ./maketex.sh dictionary
@@ -45,3 +41,11 @@ This makes a PDF file called `xdi_background.pdf`.
4541

4642
This makes a PDF file called `xdi_dictionary.pdf`.
4743

44+
**To make the XDI Background document:**
45+
46+
~> ./maketex.sh background
47+
~> pdflatex xdi_background.tex
48+
~> pdflatex xdi_background.tex
49+
50+
This makes a PDF file called `xdi_background.pdf`.
51+

specification/background.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@ Use cases for the XAS Data Interchange format
44
# Conventional XAS
55

66
In a conventional XAS experiment, we measure a sample somewhere
7-
between 2 and 10,000 scans, possibly requiring dead-time or other
7+
between 2 and 10,000 times, possibly requiring dead-time or other
88
corrections. Some data processing is required to correct, calibrate,
99
and/or align the data. Those scans are then merged into a single
1010
spectrum.
1111

1212
![The merge of several dozen scans at the Cd K edge on a sample dilute in Cd.](images/convxas.png)
1313

14-
XDI is about how we express the merged spectrum.
14+
XDI is about how we express the merged spectrum. In some case, XDI
15+
may also be a suitable format for the individual XAS measurements, as
16+
well.
1517

1618
# XRF imaging experiments
1719

@@ -30,16 +32,16 @@ the imaging experiment.
3032
# Difraction anomalous fine structure (DAFS)
3133

3234
An anomalous scattering experiments yields energy-dependent scattering
33-
intensities. Here we see (\footnote{Ravel et al. PRB 60, 778-785
34-
(1999)
35-
[doi:10.1103/PhysRevB.60.778](http://dx.doi.org/10.1103/PhysRevB.60.778)
36-
DAFS data measured near the Ti K and Ba L3 edges on BaTiO3. From
37-
these data, mu(E) or chi(k) spectra are extracted and interpreted as
38-
position-selective EXAFS.
35+
intensities. Here we see DAFS data measured (Ravel et al. PRB 60,
36+
778-785 (1999)
37+
[doi:10.1103/PhysRevB.60.778](http://dx.doi.org/10.1103/PhysRevB.60.778))
38+
near the Ti K and Ba L3 edges on BaTiO3. From these data, mu(E) or
39+
chi(k) spectra are extracted and interpreted as position-selective
40+
EXAFS.
3941

4042
![A DAFS measurement on BaTiO3 and the chi(k) spectrum extracted from it.](images/dafs.png)
4143

42-
XDI is about how we express the mu(E) or chi(k) spectra extracted from
44+
XDI is about how we express the mu(E) or chi(k) spectrum extracted from
4345
the anomalous diffraction measurement.
4446

4547

@@ -53,5 +55,5 @@ scattering. (Bergmann, et al. Chem. Phys. Lett. 369 184 (2003)
5355

5456
![NIXS data measured on graphite and the XANES spectrum extracted from it.](images/nixs.png)
5557

56-
XDI is about how we express the mu(E) spectra extracted from the
58+
XDI is about how we express the mu(E) spectrum extracted from the
5759
non-resonant inelastic scattering measurement.

specification/dictionary.md

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Dictionary of XDI Metadata
2-
==========================
1+
Dictionary of XAS Data Interchange Metadata
2+
===========================================
33

44
XDI Working Group
55
-----------------
@@ -21,7 +21,7 @@ includes:
2121
1. The name representing the datum
2222
1. The meaning of the datum
2323
1. Thw units of the datum
24-
1. The format of representing its value
24+
1. The format for representing its value
2525

2626
Words used to signify the requirements in the specification **shall**
2727
follow the practice of
@@ -49,13 +49,13 @@ multi-spectral datasets.
4949
## The XDI syntax
5050

5151
This dictionary has been developed along with the
52-
[XDI specification](spec.md). Any examples given in this dictionary
53-
use the **recommended** XDI syntax. The metadata name consists of the
54-
capitalized namespace, followed by a dot, followed by a tag. Here
55-
is an example: `Element.symbol`. When appearing in an XDI file to
56-
convey a metadata value, the line begins with a comment token and end
57-
with an end-of-line token. A colon is the delimiting token between
58-
the metadata name and its value. Here is an example:
52+
[XDI specification](spec.md). All examples given in this dictionary
53+
use all recommendations of the XDI syntax. The metadata name consists
54+
of the capitalized namespace, followed by a dot, followed by a tag.
55+
Here is an example: `Element.symbol`. When appearing in an XDI file
56+
to convey a metadata value, the line begins with a comment token and
57+
end with an end-of-line token. A colon is the delimiting token
58+
between the metadata name and its value. Here is an example:
5959

6060
# Element.symbol: Cu
6161

@@ -74,7 +74,7 @@ their definitions.
7474

7575
* _free-format string_: This is a string which can contain any
7676
character (save end-of-line characters) in any encoding system. A
77-
free-sormat string need not be ASCII and need not be English.
77+
free-format string need not be ASCII and need not be English.
7878
Because applications using XDI may not be capable of handling some
7979
encoding systems, it is **recommended** that free-format strings be
8080
ASCII.
@@ -83,31 +83,34 @@ their definitions.
8383
white space, followed by a string denoting the units of the previous
8484
string. As an example, a value for `Column.1` might be `energy eV`,
8585
which identifies the contents of the first column in the data table
86-
as containing energy values expressed in electron volt units.
86+
as containing energy values expressed in electron volt units. The
87+
selection of possible units for a tag is given in the definition of
88+
the tag.
8789

8890
* _float_: A float is a string which is interpretable as a
8991
floating-point number in the C programming language. An integer is
9092
permissable. Values of `NaN`, `sNAN`, `qNAN`, `inf`, `+inf`, and
91-
`-inf` are not allowed in XDI. That is, a float in XDI must be
92-
finite number. See [IEEE 754-2008](http://grouper.ieee.org/groups/754/).
93+
`-inf` are not allowed in XDI. That is, a float in XDI **must** be
94+
a finite number. See
95+
[IEEE 754-2008](http://grouper.ieee.org/groups/754/).
9396

9497
* _float + units_: This is a float as defined above, followed by white
9598
space, followed by a string identifying the units of the number.
9699
For example, a value for `Sample.temperature`, which identifies the
97-
tamperature at which an XAS measurement is made, might be `500 K`,
98-
which identifies the temperature of the measurements in Kelvin
100+
temperature at which an XAS measurement is made, might be `500 K`,
101+
identifying the temperature of the measurements in Kelvin
99102
temperature units. The selection of possible units for a tag is
100103
given in the definition of the tag.
101104

102105
* _chemical formulas_: `Sample.stoichiometry` is intended to represent
103-
the elemental composition of the sample. To make these formulas
104-
interpretable by computer, this and extension fields which represent
105-
chemical information **must** use the
106-
[IUCr definition of a chemical formula]( http://www.iucr.org/__data/iucr/cifdic_html/1/cif_core.dic/Cchemical_formula.html).
106+
the elemental composition of the sample. To allow interpretation of
107+
chemical formulas by computer, this field and extension fields which
108+
represent chemical information **must** use the
109+
[IUCr definition of a chemical formula](http://www.iucr.org/__data/iucr/cifdic_html/1/cif_core.dic/Cchemical_formula.html).
107110

108111
* _time_: Because of the wide variability of cultural standards in the
109112
representation of time, XDI defines a strict standard for time
110-
stamps in XDI files. `Scan.start_time`, `Scan_end_time`, and any
113+
stamps in XDI files. `Scan.start_time`, `Scan.end_time`, and any
111114
extension fields dealing in time **must** use the
112115
[ISO 8601 specification for combined dates and times](http://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations)
113116

@@ -126,6 +129,10 @@ their definitions.
126129

127130
Some additional comments:
128131

132+
* Locale is **not** respected when interpreting floating point numbers.
133+
The decimal mark **must** be a dot (`.`, ASCII 46). The decimal mark
134+
**must not** be a comma (`,`, ASCII 44).
135+
129136
* A tag which is in a defined family but which is not defined in this
130137
dictionary **must** be interpreted as have a free-format string as its
131138
value.
@@ -352,7 +359,7 @@ the signal chain behind the detector.
352359
* **Namespace:** `Sample` -- **Tag:** `stoichiometry`
353360
* _Description_: The stoichiometric formula of the measured sample
354361
* _Units_: none
355-
* _Format_: see [the CIF definition of chemical_formula](http://www.iucr.org/__data/iucr/cifdic_html/1/cif_core.dic/Cchemical_formula.html)
362+
* _Format_: see [the IUCr definition of chemical_formula](http://www.iucr.org/__data/iucr/cifdic_html/1/cif_core.dic/Cchemical_formula.html)
356363

357364
* **Namespace:** `Sample` -- **Tag:** `prep`
358365
* _Description_: A string summarizing the method of sample preparation
@@ -394,7 +401,7 @@ as defined fields in future versions of the XDI specification.
394401
* `Sample.opacity`
395402
* `Sample.electrochemical_potential`
396403

397-
Almost all of these examples **should** take a float+units as its value.
404+
Almost all of these examples **should** take a float+units as values.
398405

399406

400407

@@ -586,4 +593,4 @@ data acquisition, data analysis, and data archiving software.
586593

587594
If an extension tag is not understood due its lack of defined
588595
semantics, the **recommended** behavior for software touching
589-
the data be to silently preserve the metadata.
596+
the data is to silently preserve the metadata.

specification/maketex.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,15 @@ elif [ "$file" = "background" ]; then
2222
sed -i '/section.Conve/i \\\linenumbers\\linenumbersep=25pt\n' temp1.tex
2323
sed -i 's/includegraphics/includegraphics[height=100px]/' temp1.tex
2424
elif [ "$file" = "dictionary" ]; then
25-
sed -i 's/section{Dictionary of/section*{Dictionary of Data/' temp1.tex
25+
sed -i 's/section{Dictionary of/section*{Dictionary of/' temp1.tex
2626
sed -i 's/subsection{XDI Working Group/\subsection*{XDI Working Group/' temp1.tex
2727
sed -i '/section.Overview/i \\\tableofcontents\\thispagestyle{empty}\\newpage\\linenumbers\\linenumbersep=25pt\n\n~\n' temp1.tex
2828
else
2929
echo "$file not valid"
3030
exit
3131
fi
3232

33-
##sed 's/\\hyperref[(.*)]{.*}/Sec.~\\ref{$1}/' temp1.tex
34-
sed -i 's/\\hyperref\[\(.*\)\]{.*}/Sec.~\\ref{\1}/' temp1.tex
33+
sed -i 's/\\hyperref\[\([^]]*\)\]{[^}]*}/Sec.~\\ref{\1}/g' temp1.tex
3534

3635
echo -n "xdi and xditt commands ..."
3736
## use the \xdi macro

0 commit comments

Comments
 (0)