Data structures and I/O
Cedalion builds on the scientific Python stack — numpy, xarray, pandas — and adds domain-specific data structures for fNIRS that carry measurement metadata (optode labels, wavelengths, physical units) alongside the numerical values.
The three core types are:
NDTimeSeries — an
xr.DataArraywith atimedimension and a spatial dimension. The spatial dimension ischannelfor raw and channel-space data (with sub-coordinatessourceanddetectorthat enable joins with the optode geometry),vertexfor image-space data on a surface mesh, orparcelfor region-level summaries. Physical units (V, mol/L, etc.) are attached via pint-xarray and preserved through transformations.LabeledPoints — an
xr.DataArraywith dimensions(label, <crs>)mapping optode and landmark names to 3-D positions in a named coordinate reference system.Recording — a container whose structure closely mirrors the SNIRF file format and serves as the main analysis object. Reading a SNIRF file populates
.timeseries(keyed by canonical names such as"amp","od","conc"),.geo3d(probe geometry),.stim(stimulus table),.aux_ts(auxiliary time series), and.meta_data; CW, FD, and TD data are all supported per the SNIRF specification. Fields such as.head_model,.masks, and image-space time series extend beyond what SNIRF currently specifies.
For a conceptual introduction with worked examples see the Concepts guide. For a hands-on introduction to these types start with the example notebooks below.
Data structures
Data classes used throughout cedalion. |
|
Type aliases for Cedalion dataclasses. |
|
Validators for common data structures. |
|
Builds on pint_xarray's unit registry. |
Utilities
Utility functions for xarray objects. |
I/O
Contains functionality for handling .snirf files. |
|
Functions for reading and processing anatomical data. |
|
Utilities for converting fNIRS datasets to the BIDS standard. |
|
Module for saving and loading forward model computation results. |
|
Module for reading photogrammetry output file formats. |
|
Module for reading and writing probe geometry files. |
|
Cedalion datasets and utility functions. |



