Supported Input Formats
FLITS reads filterbank-style data through a pluggable reader framework. The built-in readers cover the formats most common in the FRB community:
| Format | Extensions | Backend | Notes |
|---|---|---|---|
| SIGPROC | .fil |
native | Canonical input; 8-, 16- or 32-bit samples, 1, 2 or 4 IFs. |
| PSRFITS (search) | .fits, .sf |
native, via astropy.io.fits |
Search-mode dynamic spectra; 1- to 32-bit samples. |
| PSRFITS (folded/PSR) | .fits, .sf |
astropy.io.fits |
Phase bins are loaded as pseudo-time bins. |
| CHIME/FRB HDF5 | .h5, .hdf5 |
h5py (native) |
flits_chime_v1, public catalog, and beamformed BBData tiedbeam_power. |
No converter is needed in advance. Just point FLITS at the file: the reader framework detects the format by extension, falling back to magic-byte sniffing for misnamed files.
Format detection
Detection cascade (first match wins):
- Trusted extension match. Unique
.filfiles are accepted directly. - Magic-byte / layout sniff. Container formats such as
.fits,.sf,.h5, and.hdf5must still pass a reader-specific sniff/layout check. - Unknown suffix fallback. If the suffix is unknown, each reader's
sniff()runs against the file's first bytes or cheap container metadata. - Explicit override. Pass
format_hint="sigproc","psrfits", or"chime_hdf5"todetect_reader/load_filterbank_datato force a choice. The override is only rejected if FLITS has positive evidence (another reader sniffs the same file as its own) that the hint is wrong.
Telescope preset detection
Once a reader owns the file, FLITS picks a telescope preset (SEFD defaults, auto-mask profile, display label) using a priority cascade over whatever metadata the file exposes:
- SIGPROC
telescope_id— canonical integer tag; strongest signal. - Format / schema signature — e.g.
chime_frb_catalog_v1orflits_chime_v1directly implies CHIME/FRB. - Telescope-name alias — strings like
TELESCOP = "MeerKAT"ortelescope_name = "CHIME"(whitespace, hyphens, and case are ignored). - SIGPROC
machine_id— weak but disambiguating for some setups. - Generic fallback — no preset claimed the file.
Each layer is only consulted if no stronger one matched, and ambiguity at any layer (more than one preset matches) falls through rather than guessing. The UI surfaces which signal was used via the "Detected: …" label and basis.
PSRFITS caveats
- Folded/PSR-mode PSRFITS files are supported as a burst-analysis view: FLITS combines subintegrations and treats folded phase bins as pseudo-time bins. It does not perform pulsar timing analysis.
- Search-mode samples are read as the PSRFITS standard defines them:
calibrated as
(raw - ZERO_OFF) * DAT_SCL + DAT_OFFSfor each channel and polarization, multiplied byDAT_WTS, read as signed bytes whenSIGNINT = 1, and, below 8 bits, unpacked with the first sample in the most significant bits. Before FLITS read these files itself, it used theyourpackage, which ignoresZERO_OFF,SIGNINTand the per-polarization scales, wraps scaled 8-bit values above 255, and misorders the channels of 2- and 4-bit data; files affected by any of these now read differently. - If a required header field is absent, a
MetadataMissingErrornames the missing fields so you can fix the file. - FLITS promotes common source-position and timing-frame metadata when present:
SIGPROC
src_raj/src_dej, PSRFITSRA/DECandRAJ/DECJ, and barycentric/pulsarcentric header flags. Existing barycentric or pulsarcentric inputs are not barycenter-corrected a second time.
CHIME/FRB HDF5 schema (flits_chime_v1)
FLITS-written test fixtures and new HDF5 writers should target this layout:
Root attributes
| Attribute | Type | Required | Description |
|---|---|---|---|
schema_version |
str |
no | "flits_chime_v1" (or recognized alias). |
tsamp_s |
float |
yes | Sample time in seconds. |
fch1_mhz |
float |
yes | Frequency of channel 0 in MHz. |
foff_mhz |
float |
yes | Channel bandwidth (signed). |
tstart_mjd |
float |
yes | Start MJD. |
nchan |
int |
no | Declared channel count (cross-checked). |
npol |
int |
no | Polarization count (defaults to 1). |
source_name |
str |
no | Source or FRB name. |
source_ra_deg |
float |
no | ICRS right ascension, for barycentric TOA. |
source_dec_deg |
float |
no | ICRS declination, for barycentric TOA. |
telescope_id |
int |
no | SIGPROC-style telescope ID. |
telescope_name |
str |
no | Free-form telescope name. |
sefd_jy |
float |
no | System-equivalent flux density, for calibration. |
Waterfall dataset
Required at /wfall (or the alternates /frb/wfall, /intensity, /data)
with shape (nchan, ntime) and float dtype. Chunked storage is preferred —
FLITS reads only the requested time window via HDF5 native slicing, so
multi-GB files do not require loading the full array.
Alternate attribute names (dt, t_sample, fch1, foff, mjd_start,
tstart, TELESCOP, SRC_NAME, src_name) are also recognized, and
attributes on a /frb subgroup fall back transparently to the root when
looked up. This keeps the reader compatible with public CHIME releases that
nest metadata differently.
Unsupported schemas raise UnsupportedSchemaError. To add a new schema,
register a custom reader via an entry point (see
Custom readers).
CHIME/FRB public catalog HDF5
- Public catalog files under
/frbwithplot_freq,extent, andcalibrated_wfall/wfallare supported directly. - The first two
extentvalues are interpreted as milliseconds, matching the CHIME public-catalog plotting convention, and converted to seconds for FLITS sample-time and read-window metadata. - These waterfalls are treated as already dedispersed for FLITS loading.
In the UI, the detection step suggests
DM = 0. - Their dedispersion reference frequency is marked unknown unless an explicit future metadata field says otherwise, so FLITS does not silently invent an infinite-frequency TOA for public catalog files.
Catalog flux calibration
The reader currently normalizes the waterfall, including calibrated_wfall.
FLITS flux and fluence then use its SEFD-based radiometer calibration; they
are not a direct integration of the catalog's stored Jy scale. CHIME's
calibrated-waterfall tutorial
describes that original scale. Preserve the original data and its calibration
metadata when that calibration is required. Do not label a FLITS SEFD-based
estimate as a reproduction of the catalog-calibrated fluence.
CHIME beamformed BBData
FLITS also supports CHIME beamformed BBData containers with:
- root attr
__memh5_subclass = "baseband_analysis.core.bbdata.BBData" - root attr
delta_time - dataset
tiedbeam_power - dataset
index_map/freq - dataset
time0
This iteration supports only the beamformed power product
tiedbeam_power. Complex-voltage tiedbeam_baseband analysis is not yet part
of FLITS.
The reader:
- forms Stokes I from the polarization axis,
- applies the fixed per-channel time alignment encoded in
time0, - uses
tiedbeam_power.attrs["DM_coherent"]as the coherent-dedispersion reference, - promotes
tiedbeam_locationsRA/Dec when the file describes a single tied-beam position, - then applies residual incoherent dedispersion relative to the DM you ask FLITS to use.
In practice, this means:
- If you want the file loaded at its native coherent-dedispersion DM, use
DM = DM_coherent. - The UI auto-suggests
DM = DM_coherentfor these files.
Full-Stokes input
load returns Stokes I for every reader. A reader that can also produce
Stokes I/Q/U/V implements one further method, load_stokes, returning a
(4, channels, time) cube on the same time and frequency grid as the Stokes I
array for the same file and config. The SIGPROC/PSRFITS reader implements it;
the CHIME HDF5 reader does not.
A file yields a cube only when it holds four polarization products and the
polarization basis is established — by an explicit setting, by the telescope
preset, or by the file header (PSRFITS POL_TYPE with FD_POLN). SIGPROC
records nothing about which four products a nifs=4 file holds, so those need a
preset or an explicit basis. Anything else raises
PolarizationUnavailableError. See Rotation-Measure
Synthesis for the bases and the in-session
workflow.
from flits.io import load_stokes_data, reader_supports_stokes, detect_reader
from flits.settings import ObservationConfig
config = ObservationConfig.from_preset(dm=528.0, preset_key="nrt")
inspection = detect_reader("burst.fil").inspect("burst.fil")
if inspection.stokes_available:
cube, metadata = load_stokes_data("burst.fil", config)
FilterbankInspection reports polarization_products, polarization_basis,
polarization_basis_source and the derived stokes_available, so a caller can
tell "this file is Stokes I" from "tell FLITS which basis this file uses"
without attempting a load.
Programmatic use
from flits.io import detect_reader, load_filterbank_data, reader_diagnostics
from flits.settings import ObservationConfig
reader = detect_reader("burst.h5")
config = ObservationConfig.from_preset(dm=500.0, preset_key="generic")
data, metadata = load_filterbank_data("burst.h5", config)
# If detection fails or a reader won't load (e.g. missing optional dep),
# reader_diagnostics() explains per reader.
for entry in reader_diagnostics():
print(entry)
Error taxonomy
All I/O errors derive from flits.io.errors.FlitsReaderError:
UnsupportedFormatError— no reader recognized the file.FormatDetectionError—format_hintconflicts with sniff results.CorruptedDataError— file is recognized but contents are inconsistent.MetadataMissingError— required header fields absent;.fieldslists them.UnsupportedSchemaError— HDF5 schema version is not known.PolarizationUnavailableError— no Stokes cube can be built;.reasonisreader_unsupported,insufficient_productsorunknown_basis.