calamari.catalog#

Discovery and cataloguing of magnetometry measurement files.

Provides find_files() to walk a directory tree and identify files recognised by any registered calamari.io loader, summarise() to build a one-row inventory summary of a single file, logbook_line() / logbook() to render those summaries as human-readable logbook entries, and build_catalog() to assemble the whole tree’s inventory as a Catalog – the rows plus the root they resolve against, with chainable selection (where/of_type/at/drop/sort_by), a repr that is the logbook, and iteration as file paths so the plot helpers consume one directly. deduplicated() and select_representative() (also exposed as Catalog methods) reduce an inventory by removing verified byte-identical cross-group copies and choosing one representative sweep per nominal setpoint respectively.

This module makes no assumption about why a tree is organised into subfolders – a real project typically mirrors several data sources (a collaborator’s beamtime export, a working copy of the same data, runs grouped by sample revision, …) under one root, and wants an inventory that reflects that structure. Rather than hardcoding folder-name markers, grouping and duplicate detection are exposed as caller-supplied parameters (group_fn and dedup_between) – see build_catalog().

Functions

build_catalog

Build a Catalog -- the inventory of every recognised measurement file under root, plus the root it resolves against.

deduplicated

Return a de-duplicated view of a catalog DataFrame.

find_files

Walk root recursively and return files recognised by a registered calamari.io loader, in sorted path order.

logbook

Logbook lines for every recognised file under root, sorted by date.

logbook_line

One tab-separated logbook entry for a loaded measurement.

select_representative

Thin a catalog DataFrame to one representative row per nominal setpoint.

summarise

Build a one-row inventory summary dict for a single measurement file.

Classes

Catalog

A directory's recognised measurement files: the inventory rows plus the root they resolve against.