Skip to content

Conversation

@Shihao-Yuan
Copy link
Collaborator

@Shihao-Yuan Shihao-Yuan commented Jul 8, 2025

Description

The current I/O functionalities of OptoDAS are limited to Version 8. I update it to include support for the more recent Version 10.

Checklist

I have (if applicable):

  • referenced the GitHub issue this PR closes.
  • documented the new feature with docstrings or appropriate doc page.
  • included a test. See testing guidelines.
  • your name has been added to the contributors page (docs/contributors.md).
  • added the "ready_for_review" tag once the PR is ready to be reviewed.

Summary by CodeRabbit

  • New Features
    • Added support for a new OptoDAS version 10, now available alongside version 8.

@Shihao-Yuan Shihao-Yuan requested a review from d-chambers July 8, 2025 22:33
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 8, 2025

Walkthrough

A new class, OptoDASV10, was introduced as a subclass of OptoDASV8, differing only by its version attribute. The module's public API was updated to export OptoDASV10 alongside OptoDASV8, making the new class available for import from the package.

Changes

File(s) Change Summary
dascore/io/optodas/core.py Added OptoDASV10 class as a subclass of OptoDASV8 with version="10".
dascore/io/optodas/init.py Updated imports to include OptoDASV10 from .core.

Poem

A new version hops into view,
V10 joins V8, shiny and new!
With just a version set to "ten",
The bunny’s code grows once again.
Two OptoDAS now side by side,
In fields of fiber, they both can ride!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fc1bd6e and 19d3763.

📒 Files selected for processing (2)
  • dascore/io/optodas/__init__.py (1 hunks)
  • dascore/io/optodas/core.py (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
dascore/io/optodas/__init__.py (1)
dascore/io/optodas/core.py (2)
  • OptoDASV8 (24-67)
  • OptoDASV10 (70-73)
🪛 Ruff (0.11.9)
dascore/io/optodas/__init__.py

9-9: .core.OptoDASV8 imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


9-9: .core.OptoDASV10 imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: test_code (windows-latest, 3.11)
  • GitHub Check: test_code (windows-latest, 3.10)
  • GitHub Check: test_code (macos-latest, 3.10)
  • GitHub Check: test_code (windows-latest, 3.12)
  • GitHub Check: test_code (macos-latest, 3.11)
  • GitHub Check: test_code (macos-latest, 3.12)
  • GitHub Check: test_code (ubuntu-latest, 3.11)
  • GitHub Check: test_code (ubuntu-latest, 3.10)
  • GitHub Check: test_code (ubuntu-latest, 3.12)
  • GitHub Check: test_code_min_deps (macos-latest, 3.13)
  • GitHub Check: test_code_min_deps (windows-latest, 3.13)
  • GitHub Check: test_code_min_deps (ubuntu-latest, 3.13)
  • GitHub Check: test_code_min_deps (ubuntu-latest, 3.12)
  • GitHub Check: test_code_min_deps (windows-latest, 3.12)
  • GitHub Check: test_code_min_deps (macos-latest, 3.12)
🔇 Additional comments (2)
dascore/io/optodas/core.py (1)

70-73: No version-specific code changes needed for V10

The OptoDASV10 subclass simply updates the version attribute to "10", and all file I/O (version detection, metadata extraction, data reading) is handled by generic utility functions (_get_opto_das_version_str, _get_opto_das_attrs, _read_opto_das). These functions operate on common HDF5 groups (fileVersion, header, data) without any hard-coded logic for versions 8 or 10, so V10 files will be picked up and parsed correctly as long as they follow the same structure.

• No version‐specific branches or parsing were found in dascore/io/optodas/utils.py.
• The new class with version = "10" is sufficient for detection and reading.

You can resolve this comment once you’ve confirmed V10 files use the same HDF5 layout.

dascore/io/optodas/__init__.py (1)

9-9: Registration and discovery of OptoDASV10 confirmed

  • OptoDASV10 is defined in dascore/io/optodas/core.py and imported in dascore/io/optodas/__init__.py
  • The FiberIO.__init_subclass__ hook automatically registers OptoDASV10 with the IO manager
  • get_format is inherited from OptoDASV8 and will return ("OptoDAS", "10") for V10 files
  • Tests for OptoDAS live under tests/test_io/test_optodas/test_optodas.py, ensuring the format is exercised

"""
from __future__ import annotations
from .core import OptoDASV8
from .core import OptoDASV8, OptoDASV10
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add __all__ to properly export the classes and silence static analysis warnings.

The static analysis tool is flagging unused imports because the classes aren't explicitly exported. Add an __all__ definition to make the public API clear and resolve the warnings.

 """
 from __future__ import annotations
 from .core import OptoDASV8, OptoDASV10
+
+__all__ = ["OptoDASV8", "OptoDASV10"]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
from .core import OptoDASV8, OptoDASV10
from __future__ import annotations
from .core import OptoDASV8, OptoDASV10
__all__ = ["OptoDASV8", "OptoDASV10"]
🧰 Tools
🪛 Ruff (0.11.9)

9-9: .core.OptoDASV8 imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


9-9: .core.OptoDASV10 imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)

🤖 Prompt for AI Agents
In dascore/io/optodas/__init__.py at line 9, the imported classes OptoDASV8 and
OptoDASV10 are not explicitly exported, causing static analysis warnings. Add an
__all__ list defining these classes as public exports by setting __all__ =
["OptoDASV8", "OptoDASV10"] immediately after the import statement to clarify
the module's public API and silence the warnings.

@codecov
Copy link

codecov bot commented Jul 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.85%. Comparing base (fc1bd6e) to head (19d3763).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #506   +/-   ##
=======================================
  Coverage   99.85%   99.85%           
=======================================
  Files         118      118           
  Lines        9711     9713    +2     
=======================================
+ Hits         9697     9699    +2     
  Misses         14       14           
Flag Coverage Δ
unittests 99.85% <100.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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.

@Shihao-Yuan Shihao-Yuan merged commit b816be7 into master Jul 9, 2025
20 of 21 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Sep 4, 2025
5 tasks
@d-chambers d-chambers deleted the master-io branch September 19, 2025 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants