Difference between revisions of "HDF5 data format"
(19 intermediate revisions by the same user not shown) | |||
Line 53: | Line 53: | ||
| style="width: 12%"| | | style="width: 12%"| | ||
| style="width: 12%"| | | style="width: 12%"| | ||
− | | style="width: 30%"| * default attribute at root level which points to relevant entry<br>* default attribute at entry level which points to relevant plot ( | + | | style="width: 30%"| * default attribute at root level which points to relevant entry number<br>* default attribute at entry level which points to relevant plot (NXdata) |
|- | |- | ||
| style="width: 12%"| | | style="width: 12%"| | ||
− | | style="width: 12%"| | + | | style="width: 12%"| instrument |
| style="width: 12%"| | | style="width: 12%"| | ||
| style="width: 12%"| | | style="width: 12%"| | ||
Line 72: | Line 72: | ||
| style="width: 12%"| | | style="width: 12%"| | ||
| style="width: 12%"| | | style="width: 12%"| | ||
− | | style="width: 12%"| | + | | style="width: 12%"| plot |
| style="width: 12%"| | | style="width: 12%"| | ||
− | | style="width: 30%"| | + | | style="width: 30%"| NX_class=NXdata |
|- | |- | ||
| style="width: 12%"| | | style="width: 12%"| | ||
Line 80: | Line 80: | ||
| style="width: 12%"| | | style="width: 12%"| | ||
| style="width: 12%"| | | style="width: 12%"| | ||
− | | style="width: 12%"| | + | | style="width: 12%"| data |
− | | style="width: 30%"| | + | | style="width: 30%"| data array |
|- | |- | ||
| style="width: 12%"| | | style="width: 12%"| | ||
| style="width: 12%"| | | style="width: 12%"| | ||
| style="width: 12%"| | | style="width: 12%"| | ||
+ | | style="width: 12%"| header | ||
| style="width: 12%"| | | style="width: 12%"| | ||
− | + | | style="width: 30%"| group with static metadata - at same level as plot | |
− | | style="width: 30%"| | ||
|} | |} | ||
Line 103: | Line 103: | ||
| style="width: 12%"| | | style="width: 12%"| | ||
| style="width: 12%"| | | style="width: 12%"| | ||
− | | style="width: 30%"| * default attribute at root level which points to relevant entry<br>* default attribute at entry level which points to relevant | + | | style="width: 30%"| * default attribute at root level which points to relevant entry number<br>* default attribute at entry level which points to relevant NXdata group |
|- | |- | ||
| style="width: 12%"| | | style="width: 12%"| | ||
Line 124: | Line 124: | ||
| style="width: 12%"| data | | style="width: 12%"| data | ||
| style="width: 12%"| | | style="width: 12%"| | ||
− | | style="width: 30%"| | + | | style="width: 30%"| NX_class=NXdata |
|- | |- | ||
| style="width: 12%"| | | style="width: 12%"| | ||
Line 131: | Line 131: | ||
| style="width: 12%"| | | style="width: 12%"| | ||
| style="width: 12%"| array | | style="width: 12%"| array | ||
− | | style="width: 30%"| | + | | style="width: 30%"| data array |
|- | |- | ||
| style="width: 12%"| | | style="width: 12%"| | ||
Line 138: | Line 138: | ||
| style="width: 12%"| | | style="width: 12%"| | ||
| style="width: 12%"| header | | style="width: 12%"| header | ||
+ | | style="width: 30%"| group with static metadata | ||
+ | |} | ||
+ | === Dynamic metadata for both types of raw data (scalers file) === | ||
+ | {| class="wikitable" style="width: 90%;" | ||
+ | |- | ||
+ | ! entry | ||
+ | ! colspan="4" | further HDF5 groups | ||
+ | ! interpretation | ||
+ | |- | ||
+ | | style="width: 12%"| entry_{number} | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 30%"| * default attribute at root level which points to relevant entry number | ||
+ | |- | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| id02 | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
| style="width: 30%"| | | style="width: 30%"| | ||
+ | |- | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| MCS | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 30%"| multi channel scalers | ||
+ | |- | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| TFG | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 30%"| time frame generator | ||
+ | |- | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| parameters | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 30%"| group with copy of static metadata | ||
|} | |} | ||
Line 145: | Line 187: | ||
|- | |- | ||
! entry | ! entry | ||
− | ! colspan=" | + | ! colspan="4" | further HDF5 groups |
! interpretation | ! interpretation | ||
|- | |- | ||
− | | style="width: | + | | style="width: 12%"| entry |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
+ | | style="width: 12%"| | ||
| style="width: 30%"| | | style="width: 30%"| | ||
|- | |- | ||
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| data |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
+ | | style="width: 12%"| | ||
| style="width: 30%"| NXclass: NXdata | | style="width: 30%"| NXclass: NXdata | ||
|- | |- | ||
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| data |
− | | style="width: | + | | style="width: 12%"| |
+ | | style="width: 12%"| | ||
| style="width: 30%"| data array | | style="width: 30%"| data array | ||
|- | |- | ||
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: 30%"| no | + | | style="width: 12%"| |
+ | | style="width: 30%"| no metadata available | ||
|} | |} | ||
Line 178: | Line 224: | ||
|- | |- | ||
! entry | ! entry | ||
− | ! colspan=" | + | ! colspan="4" | further HDF5 groups |
! interpretation | ! interpretation | ||
|- | |- | ||
− | | style="width: | + | | style="width: 12%"| entry_{number} |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
+ | | style="width: 12%"| | ||
+ | | style="width: 30%"| different entries represent repetitions of data reduction | ||
+ | * default attribute at root level which points to relevant entry number | ||
+ | * default attribute at entry level which points to relevant data set (NXdata) | ||
+ | |- | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| PyFAI | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
| style="width: 30%"| | | style="width: 30%"| | ||
|- | |- | ||
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| result_{type} |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: 30%"| | + | | style="width: 12%"| |
+ | | style="width: 30%"| NX_class=NXdata<br>name indicates type of data reduction | ||
+ | |- | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| data | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 30%"| data array | ||
+ | |- | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| data_errors | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 30%"| error array - RELATIVE<br>variance = relative_error<sup>2</sup> | ||
+ | |- | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| t | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 30%"| time - important for image series | ||
+ | |- | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| q | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 30%"| {azim} and {ave}: q vector (q cannot be calculated from metadata as in the case of edf files) | ||
|- | |- | ||
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| chi |
− | | style="width: 30%"| | + | | style="width: 12%"| |
+ | | style="width: 30%"| {azim}: azimuthal angle (cannot be calculated from metadata as in the case of edf files) | ||
|- | |- | ||
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| parameters |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: 30%"| | + | | style="width: 12%"| |
+ | | style="width: 30%"| copy of static and dynamic metadata from raw images (not all parameters describe the data arrays) | ||
|} | |} | ||
Line 210: | Line 297: | ||
|- | |- | ||
! entry | ! entry | ||
− | ! colspan=" | + | ! colspan="4" | further HDF5 groups |
! interpretation | ! interpretation | ||
|- | |- | ||
− | | style="width: | + | | style="width: 12%"| entry_{number} |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
+ | | style="width: 12%"| | ||
+ | | style="width: 30%"| different entries represent repetitions of data reduction | ||
+ | * default attribute at root level which points to relevant entry number | ||
+ | * default attribute at entry level which points to relevant data set (NXdata) | ||
+ | |- | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| 1_XPCS | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
| style="width: 30%"| | | style="width: 30%"| | ||
|- | |- | ||
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| results |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: 30%"| | + | | style="width: 12%"| |
+ | | style="width: 30%"| NX_class=NXdata | ||
+ | |- | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| g2 | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 30%"| correlation function | ||
|- | |- | ||
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| t |
− | | style="width: 30%"| | + | | style="width: 12%"| |
+ | | style="width: 30%"| time - important for image series | ||
|- | |- | ||
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| q |
− | | style="width: 30%"| | + | | style="width: 12%"| |
+ | | style="width: 30%"| q vector | ||
|} | |} | ||
Line 242: | Line 349: | ||
|- | |- | ||
! entry | ! entry | ||
− | ! colspan=" | + | ! colspan="4" | further HDF5 groups |
! interpretation | ! interpretation | ||
|- | |- | ||
− | | style="width: | + | | style="width: 12%"| entry_{number} |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
+ | | style="width: 12%"| | ||
+ | | style="width: 30%"| different entries represent repetitions of data reduction | ||
+ | * default attribute at root level which points to relevant entry number | ||
+ | * default attribute at entry level which points to relevant data set (NXdata) | ||
+ | |- | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| saxsutilities | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
| style="width: 30%"| | | style="width: 30%"| | ||
|- | |- | ||
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| data |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: 30%"| | + | | style="width: 12%"| |
+ | | style="width: 30%"| NX_class=NXdata | ||
+ | |- | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| array | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 30%"| data array | ||
+ | |- | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| array_errors | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 30%"| error array - VARIANCE<br>like in edf files (certain file types only) | ||
+ | |- | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| t | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 30%"| time - important for image series | ||
+ | |- | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| q | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 30%"| q vector (q can also be calculated from metadata as in the case of edf files) (certain file types only) | ||
+ | |- | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| chi | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 30%"| azimuthal angle (can also be calculated from metadata as in the case of edf files) (certain file types only) | ||
|- | |- | ||
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| header_array |
− | | style="width: 30%"| | + | | style="width: 12%"| |
+ | | style="width: 30%"| metadata describing data array | ||
|- | |- | ||
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| header_array_errors |
− | | style="width: 30%"| | + | | style="width: 12%"| |
+ | | style="width: 30%"| metadata describing variance array (certain file types only) | ||
|} | |} | ||
Line 274: | Line 429: | ||
|- | |- | ||
! entry | ! entry | ||
− | ! colspan=" | + | ! colspan="4" | further HDF5 groups |
! interpretation | ! interpretation | ||
|- | |- | ||
− | | style="width: | + | | style="width: 12%"| SXentry_{number1} |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
+ | | style="width: 12%"| | ||
| style="width: 30%"| | | style="width: 30%"| | ||
|- | |- | ||
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| SXseries_{number2} |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
+ | | style="width: 12%"| | ||
+ | | style="width: 30%"| {number2} indicates different images of image series (file type A) | ||
+ | |- | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| SXmemory_{number3} | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
| style="width: 30%"| | | style="width: 30%"| | ||
|- | |- | ||
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| SXdata |
− | | style="width: 30%"| | + | | style="width: 12%"| |
+ | | style="width: 30%"| image array - images of image series can also be written in 3 dimensional array (file type B) | ||
+ | |- | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 12%"| SXerror | ||
+ | | style="width: 12%"| | ||
+ | | style="width: 30%"| variance array | ||
|- | |- | ||
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| |
− | | style="width: | + | | style="width: 12%"| SXheader |
− | | style="width: 30%"| | + | | style="width: 12%"| |
+ | | style="width: 30%"| metadata describing each data array | ||
|} | |} |
Latest revision as of 23:09, 6 May 2020
In the beginning there was the EDF format... |
---|
INFO: Problems caused by the "ESRF data format" are unfortunately far too common. The orginal software available from the ESRF is far too bugged to be usable. It is not available for many of the operating systems on which FIT2D is required to run, and users use. Therefore I (and others) have written their own input routines. However, this is only a partial solution. This is because the "format" is totally inadequately defined, and even where defined there are huge differences between the specification and the files actually produced. It is also an unnecessarily complicated format with certain data compression schemes almost totally undefined. Therefore this code has only been written to input a small subset of the possible file formats which could be produced. In particular all header information must be found before the image data, and data compression is not supported. Message when importing EDF files in Fit2D |
...now we have a NeXus standard |
---|
NeXus is an effort by an international group of scientists to define a common data exchange and archival format for neutron, X-ray and muon experiments. NeXus is built on top of the scientific data format HDF5 and adds domain-spe- cific rules for organizing data within HDF5 files, in addition to a dictiona- ry of well defined domain-specific field names. The NeXus data format has two purposes. First, it defines a format that can serve as a container for all relevant data associated with a beamline. This is a very important use case. Second, it defines standards in the form of application definitions for the exchange of data between applications. NeXus provides structures for raw experimental data as well as for processed data. J. Appl. Cryst. (2015). 48, 301-305 |
This sounds promising, but reality is as usual much, much more chaotic. In fact, it is nowadays rather straightforward to read or write data/error arrays together with important metadata in EDF format. Routines are available for Python (fabio library) or Matlab (see EDF data format).
NeXus on the other hand is a standard which leaves a lot of room for interpretation. As a result, there are unfortunately no routines readily available for Python/Matlab to read data/error arrays and metadata from HDF5 files as comfortably as it is the case for EDF files. In the following I list the search path for data and metadata for a selection of known interpretations of the NeXus standard. The main problem in many cases is to programmatically determine the present data type, as there is no common identifier foreseen. Once known, it is rather easy to extract data as high level routines are available in programming languages. The correct interpretation of metadata needs to be taken care in each case individually.
Contents
List of important HDF 'formats' using NeXus standard - RAW data
Lima written raw data at ESRF from 2020
entry | further HDF5 groups | interpretation | |||
---|---|---|---|---|---|
entry_{number} | * default attribute at root level which points to relevant entry number * default attribute at entry level which points to relevant plot (NXdata) | ||||
instrument | |||||
{detector_name} | |||||
plot | NX_class=NXdata | ||||
data | data array | ||||
header | group with static metadata - at same level as plot |
Lima written raw data at ESRF before 2020
entry | further HDF5 groups | interpretation | |||
---|---|---|---|---|---|
entry_{number} | * default attribute at root level which points to relevant entry number * default attribute at entry level which points to relevant NXdata group | ||||
measurement | |||||
{detector_name} | |||||
data | NX_class=NXdata | ||||
array | data array | ||||
header | group with static metadata |
Dynamic metadata for both types of raw data (scalers file)
entry | further HDF5 groups | interpretation | |||
---|---|---|---|---|---|
entry_{number} | * default attribute at root level which points to relevant entry number | ||||
id02 | |||||
MCS | multi channel scalers | ||||
TFG | time frame generator | ||||
parameters | group with copy of static metadata |
Dectris written raw data
entry | further HDF5 groups | interpretation | |||
---|---|---|---|---|---|
entry | |||||
data | NXclass: NXdata | ||||
data | data array | ||||
no metadata available |
List of important HDF 'formats' using NeXus standard - reduced data
Written by online datareduction at ESRF (pyFAI/DAHU) - SAXS
entry | further HDF5 groups | interpretation | |||
---|---|---|---|---|---|
entry_{number} | different entries represent repetitions of data reduction
| ||||
PyFAI | |||||
result_{type} | NX_class=NXdata name indicates type of data reduction | ||||
data | data array | ||||
data_errors | error array - RELATIVE variance = relative_error2 | ||||
t | time - important for image series | ||||
q | {azim} and {ave}: q vector (q cannot be calculated from metadata as in the case of edf files) | ||||
chi | {azim}: azimuthal angle (cannot be calculated from metadata as in the case of edf files) | ||||
parameters | copy of static and dynamic metadata from raw images (not all parameters describe the data arrays) |
Written by online datareduction at ESRF (pyFAI/DAHU) - XPCS
entry | further HDF5 groups | interpretation | |||
---|---|---|---|---|---|
entry_{number} | different entries represent repetitions of data reduction
| ||||
1_XPCS | |||||
results | NX_class=NXdata | ||||
g2 | correlation function | ||||
t | time - important for image series | ||||
q | q vector |
Written by SAXSutilites2 package
entry | further HDF5 groups | interpretation | |||
---|---|---|---|---|---|
entry_{number} | different entries represent repetitions of data reduction
| ||||
saxsutilities | |||||
data | NX_class=NXdata | ||||
array | data array | ||||
array_errors | error array - VARIANCE like in edf files (certain file types only) | ||||
t | time - important for image series | ||||
q | q vector (q can also be calculated from metadata as in the case of edf files) (certain file types only) | ||||
chi | azimuthal angle (can also be calculated from metadata as in the case of edf files) (certain file types only) | ||||
header_array | metadata describing data array | ||||
header_array_errors | metadata describing variance array (certain file types only) |
Written by saxs programs package
entry | further HDF5 groups | interpretation | |||
---|---|---|---|---|---|
SXentry_{number1} | |||||
SXseries_{number2} | {number2} indicates different images of image series (file type A) | ||||
SXmemory_{number3} | |||||
SXdata | image array - images of image series can also be written in 3 dimensional array (file type B) | ||||
SXerror | variance array | ||||
SXheader | metadata describing each data array |