Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional parameters to OpticalSeries constructor #2023

Merged
merged 11 commits into from
Feb 20, 2025

Conversation

bendichter
Copy link
Contributor

fix #1616

Motivation

The OpticalSeries class in PyNWB currently requires the fields 'distance', 'orientation', and 'field_of_view' in its constructor, but according to the NWB schema these fields should be optional. This PR fixes this discrepancy by making these fields optional in the code to match the schema specification.

How to test the behavior?

from pynwb.image import OpticalSeries

# Create OpticalSeries without the optional fields
optical_series = OpticalSeries(
    name='test_optical_series',
    data=np.ones((2, 2, 2)),  # example data
    unit='pixels',
    timestamps=[1.0, 2.0]
)

# All these fields should be None
assert optical_series.distance is None
assert optical_series.field_of_view is None
assert optical_series.orientation is None

Checklist

[x] Did you update CHANGELOG.md with your changes?
[x] Have you checked our Contributing document?
[x] Have you ensured the PR clearly describes the problem and the solution?
[x] Is your contribution compliant with our coding style? This can be checked running ruff check . && codespell from the source directory.
[x] Have you checked to ensure that there aren't other open Pull Requests for the same change?
[x] Have you included the relevant issue number using "Fix #1616" notation where XXX is the issue number? By including "Fix #1616" you allow GitHub to close issue #1616 when the PR is merged.

Copy link

codecov bot commented Jan 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.78%. Comparing base (f3b3306) to head (fa59027).
Report is 1 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #2023   +/-   ##
=======================================
  Coverage   91.78%   91.78%           
=======================================
  Files          27       27           
  Lines        2738     2738           
  Branches      709      709           
=======================================
  Hits         2513     2513           
  Misses        149      149           
  Partials       76       76           
Flag Coverage Δ
integration 73.15% <ø> (ø)
unit 82.39% <ø> (ø)

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.

@bendichter
Copy link
Contributor Author

@stephprince fixed

stephprince
stephprince previously approved these changes Feb 18, 2025
Copy link
Contributor

@stephprince stephprince left a comment

Choose a reason for hiding this comment

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

looks good - thanks!

@rly rly merged commit 5564f82 into dev Feb 20, 2025
25 checks passed
@rly rly deleted the fix/optical-series-optional-fields branch February 20, 2025 22:56
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.

[Bug]: OpticalSeries distance, orientation, and field of view should be optional
3 participants