exafel / README.md
ayzk's picture
Update dataset card and file table
2dad783 verified
|
Raw History Blame Contribute Delete
5.48 kB
---
license: other
license_name: sdrbench
license_link: https://sdrbench.github.io/
pretty_name: "SDRBench: EXAFEL"
tags:
- scientific-data
- lossy-compression
- sdrbench
- hpc
- sz3
configs:
- config_name: files
data_files: files.jsonl
default: true
---
# SDRBench — EXAFEL
X-ray free-electron laser images from the LCLS instrument (SLAC): events x detector panels x rows x columns.
> **Raw binary arrays, not an Arrow/Parquet dataset.** `datasets.load_dataset("sdrbench/exafel")` returns the table of files (`files.jsonl`: path, dtype, shape, sha256). Read the arrays with the `sdrbench` package or `hf_hub_download` + numpy as shown below.
This repository is an **unmodified mirror** of the EXAFEL data of [SDRBench](https://sdrbench.github.io/datasets.html), the
Scientific Data Reduction Benchmark. The originals are hosted by Argonne National Laboratory on Globus;
every archive was unpacked and its files uploaded byte-for-byte (sha256 verified) (revision `484ab4c6a9`). `metadata/` holds
the original SDRBench property and template files. Kept in sync automatically by
[szcompressor/sdrbench](https://github.com/szcompressor/sdrbench).
- **Data provider:** LCLS (SLAC)
- **Size:** 10.4 GB in 3 variant(s)
- **Format:** raw little-endian binary, C order (slowest dimension first); dtype and shape per field below
## Usage
```bash
pip install "sdrbench[sz3]" # sdrbench + pysz (SZ3)
```
```python
import numpy as np
import sdrbench
from pysz import sz, szConfig, szErrorBoundMode
ds = sdrbench.dataset("exafel") # default variant "small"
print(ds.fields)
x = ds["dark"] # numpy array, dtype <u2, shape (10, 32, 185, 388)
# compress with SZ3 (pysz) at a 1e-3 value-range-relative error bound
conf = szConfig()
conf.errorBoundMode = szErrorBoundMode.REL
conf.relErrorBound = 1e-3
compressed, ratio = sz.compress(np.ascontiguousarray(x), conf)
y, _ = sz.decompress(compressed, x.dtype.type, x.shape)
max_err, psnr, nrmse = sz.verify(np.asarray(x), y)
print(f"ratio {ratio:.1f}x, PSNR {psnr:.1f} dB, max error {max_err:.3g}")
```
Files are fetched on first use (in parallel with `ds.download("data/")`) and cached, pinned to the revision
of the installed `sdrbench` release; if Hugging Face is unreachable the package falls back to the original
archive on Globus. Existing local SDRBench copies can be used with `sdrbench.dataset("exafel", root="/path")`.
Without the package, with `huggingface_hub` and numpy only:
```python
from huggingface_hub import hf_hub_download
import numpy as np
p = hf_hub_download("sdrbench/exafel", "10x32x185x388/smd-cxif5315-r129-dark.u16", repo_type="dataset", revision="484ab4c6a935c25c8f5ad09854d71c6c1316912c")
x = np.fromfile(p, dtype="<u2").reshape((10, 32, 185, 388))
```
## Variants and fields
### `small` (default)
`sdrbench.dataset("exafel", "small")` — folder `10x32x185x388/` — 3 files, 137.8 MB, from [SDRBENCH-EXAFEL-10x32x185x388.tar.gz](https://g-d0cd3f.fd635.8443.data.globus.org/raw-data/EXAFEL/SDRBENCH-EXAFEL-10x32x185x388.tar.gz).
10 events of the 32-panel detector as raw counts: raw, dark (background) and calib-fde frames, unsigned 16-bit.
| Field | dtype | Shape (C order) | File |
|---|---|---|---|
| `dark` | `<u2` | 10 x 32 x 185 x 388 | `10x32x185x388/smd-cxif5315-r129-dark.u16` |
| `calib-fde` | `<u2` | 10 x 32 x 185 x 388 | `10x32x185x388/smd-cxif5315-r169-calib-fde.u16` |
| `raw` | `<u2` | 10 x 32 x 185 x 388 | `10x32x185x388/smd-cxif5315-r169-raw.u16` |
### `large`
`sdrbench.dataset("exafel", "large")` — folder `986x32x185x388/` — 1 files, 9.1 GB, from [SDRBENCH-EXAFEL-986x32x185x388.tar.gz](https://g-d0cd3f.fd635.8443.data.globus.org/raw-data/EXAFEL/SDRBENCH-EXAFEL-986x32x185x388.tar.gz).
986 calibrated events of the 32-panel detector, single precision.
| Field | dtype | Shape (C order) | File |
|---|---|---|---|
| `data` | `<f4` | 986 x 32 x 185 x 388 | `986x32x185x388/EXAFEL-LCLS-986x32x185x388.f32` |
### `assembled`
`sdrbench.dataset("exafel", "assembled")` — folder `130x1480x1552/` — 4 files, 1.2 GB, from [SDRBENCH-EXAFEL-130x1480x1552.tar.gz](https://g-d0cd3f.fd635.8443.data.globus.org/raw-data/EXAFEL/SDRBENCH-EXAFEL-130x1480x1552.tar.gz).
130 assembled 1480 x 1552 detector images with Bragg peak positions and counts per event.
| Field | dtype | Shape (C order) | File |
|---|---|---|---|
| `data` | `<f4` | 130 x 1480 x 1552 | `130x1480x1552/SDRBENCH-EXAFEL-data-130x1480x1552.f32` |
| `nPeaks` | `<i8` | 130 | `130x1480x1552/SDRBENCH-EXAFEL-nPeaks.i64` |
| `peakXPosRaw` | `<f8` | 130 x 2048 | `130x1480x1552/SDRBENCH-EXAFEL-peakXPosRaw-130x2048.d64` |
| `peakYPosRaw` | `<f8` | 130 x 2048 | `130x1480x1552/SDRBENCH-EXAFEL-peakYPosRaw-130x2048.d64` |
## Citation
Please cite SDRBench; `sdrbench cite exafel` prints it:
```bibtex
@inproceedings{zhao2020sdrbench,
title = {{SDRBench}: Scientific Data Reduction Benchmark for Lossy Compressors},
author = {Zhao, Kai and Di, Sheng and Liang, Xin and Li, Sihuan and Tao, Dingwen and Chen, Zizhong and Cappello, Franck},
booktitle = {2020 IEEE International Conference on Big Data (Big Data)},
pages = {2716--2724},
year = {2020}
}
```
## License and terms
The data are distributed by the SDRBench team for research use under the terms of the original
data providers listed above (see the [SDRBench website](https://sdrbench.github.io/datasets.html)); please acknowledge them as
requested. Rights remain with the data providers.