Skip to content

Add Aragon Photonics HDAS format reader (two variants) - #848

Merged
d-chambers merged 3 commits into
devfrom
hdas-reader
Aug 10, 2026
Merged

Add Aragon Photonics HDAS format reader (two variants)#848
d-chambers merged 3 commits into
devfrom
hdas-reader

Conversation

@d-chambers

@d-chambers d-chambers commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Description

Fourth PR of the format-reader series (#844, #846, #847). Adds FiberIO readers for the Aragon Photonics HDAS HDF5 format, whose acquisition metadata lives in a 200-value float header at fixed positions (spec taken from the vendor's H5_Reader.m distributed with the data; decoded values verified against both sample files):

  • HDASV1 — vendor layout: File_Header (1, 200) float64 + HDAS_DATA (time × distance) strain rate. Test file hdas_1.h5 is a trimmed IGN-ADIF (Spain) file from PubDAS Global DAS Month; its float64 header epoch decodes to sub-µs precision (pinned in a test).
  • HDASV2 — attr-timed variant: hdas_header (200,) float32 + data (distance × time) with a start_time ISO attr. The attr is authoritative because a float32 header cannot represent an exact epoch (~±64 s quantization). The measurand is not recorded in this variant's files, so data units stay unset. Test file hdas_2.h5 is a trimmed ICM-CSIC Canalink file.

Design notes:

  • V2 subclasses V1 (the Febus/Terra15 chaining pattern) — an earlier shared abstract base was rejected in review because FiberIO.__init_subclass__ registers every subclass, creating a phantom blank-version format.
  • Detection enforces the variant's exact header shape, the 200 length marker, 2-D data, and (V2) the start_time attr; cross-variant non-claiming is tested both directions.
  • A header that decodes to a non-positive rate or spatial step raises InvalidFiberFileError (caught by directory scans) instead of yielding NaN coordinates.
  • Sampling rate = trigger frequency ÷ two downsampling divisors (header positions 7/16/99, 1-based): 100 Hz for the IGN file, 50 Hz for Canalink — both match the files' samples-per-hour.
  • HDAS entry points are registered ahead of H5Simple so a future HDAS file that also carries a generic time vector resolves to the specific reader.

Changelog

  • added: the HDAS format (versions 1 and 2) for Aragon Photonics HDAS HDF5 files, covering both the vendor File_Header layout and the attr-timed hdas_header variant.

Checklist

I have (if applicable):

  • referenced the GitHub issue this PR closes. (n/a — part of the format-reader series)
  • documented the new feature with docstrings and/or appropriate doc page.
  • included tests. See testing guidelines.
  • added the "ready_for_review" tag once the PR is ready to be reviewed.

Summary by CodeRabbit

  • New Features

    • Added support for reading Aragon Photonics HDAS HDF5 files in versions 1 and 2.
    • Added automatic format detection, metadata extraction, and time/distance coordinate handling.
    • Added optional time and distance selection when reading HDAS data.
  • Documentation

    • Documented supported HDAS file layouts and metadata differences.
    • Added HDAS support to the changelog.
  • Tests

    • Added coverage for valid, malformed, incomplete, and corrupted HDAS files.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@d-chambers, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 7 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b4f1d5c3-2147-4f21-b1a8-3c14a78a6cbf

📥 Commits

Reviewing files that changed from the base of the PR and between 1f290f8 and bc5af55.

📒 Files selected for processing (4)
  • dascore/data_registry.txt
  • docs/changelog.qmd
  • pyproject.toml
  • tests/test_io/test_common_io.py
📝 Walkthrough

Walkthrough

Added HDAS V1 and V2 HDF5 FiberIO readers. The change includes metadata decoding, coordinate construction, format registration, test-data registry entries, common IO integration, and validation tests.

Changes

HDAS reader support

Layer / File(s) Summary
HDAS metadata and patch extraction
dascore/io/hdas/utils.py, dascore/io/hdas/__init__.py
Added validation and decoding for HDAS headers, coordinates, variant-specific attributes, and optional time or distance selections.
HDAS FiberIO readers
dascore/io/hdas/core.py
Added HDASV1 detection, scanning, and reading. Added HDASV2 support for the hdas_header and data layout with required start_time.
Registration and reader validation
pyproject.toml, dascore/data_registry.txt, tests/test_io/test_common_io.py, tests/test_io/test_hdas/test_hdas.py, docs/changelog.qmd, .agents/agents.md
Registered both readers, added HDF5 fixtures, integrated common IO tests, documented the reader, added import guidance, and covered valid coordinates, format discrimination, malformed files, and read errors.

Possibly related PRs

  • DASDAE/dascore#831: Adds a structurally similar HDF5-based DAS FiberIO reader with registration and IO tests.
  • DASDAE/dascore#846: Adds a parallel HDF5-based FiberIO reader with registration, fixtures, and tests.
  • DASDAE/dascore#847: Adds another HDF5-based FiberIO reader with parallel package and validation structures.

Suggested labels: IO, documentation

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the addition of an Aragon Photonics HDAS reader with two variants.
Description check ✅ Passed The description explains the feature, design decisions, tests, documentation, and checklist status in sufficient detail.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch hdas-reader
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hdas-reader

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added documentation Improvements or additions to documentation IO Work for reading/writing different formats labels Aug 8, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@dascore/io/hdas/utils.py`:
- Around line 55-63: Update the header validation around divisors, rate, and
spatial_step to require a finite positive trigger frequency, both downsampling
divisor values, and their product, plus a finite positive spatial_step before
coordinate construction; ensure negative divisors cannot pass through a positive
product. Add regression tests covering an infinite spatial step and negative
downsampling divisors.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c7a09c53-6091-4c21-9097-8a876760b7f7

📥 Commits

Reviewing files that changed from the base of the PR and between 80116a2 and a6b1a9b.

📒 Files selected for processing (8)
  • dascore/data_registry.txt
  • dascore/io/hdas/__init__.py
  • dascore/io/hdas/core.py
  • dascore/io/hdas/utils.py
  • docs/changelog.qmd
  • pyproject.toml
  • tests/test_io/test_common_io.py
  • tests/test_io/test_hdas/test_hdas.py

Comment thread dascore/io/hdas/utils.py Outdated
@codecov

codecov Bot commented Aug 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (8a3b321) to head (bc5af55).
⚠️ Report is 2 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##               dev      #848    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files          164       167     +3     
  Lines        18178     18290   +112     
==========================================
+ Hits         18178     18290   +112     
Flag Coverage Δ
network 48.64% <91.07%> (+0.26%) ⬆️
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown

✅ Documentation built:
👉 Download
Note: You must be logged in to github and a DASDAE member to access the link.

Adds FiberIO readers for the HDAS HDF5 layouts: HDASV1 for the vendor
File_Header layout (time x distance strain rate, e.g. IGN-ADIF) and
HDASV2 for the attr-timed hdas_header variant (distance x time,
start_time attr authoritative since the float32 header cannot hold an
exact epoch, measurand unrecorded, e.g. ICM-CSIC Canalink). The
200-value header spec (spatial sampling, trigger frequency and
downsampling divisors, position offset, epoch) follows the reader
script the vendor distributes with the data.
@d-chambers
d-chambers merged commit 3cd0731 into dev Aug 10, 2026
8 checks passed
@d-chambers
d-chambers deleted the hdas-reader branch August 10, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation IO Work for reading/writing different formats

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant