Skip to content

feat: allow passing AqcuisitionSettings kwargs directly to create_stream#109

Draft
tlambert03 wants to merge 7 commits intopymmcore-plus:mainfrom
tlambert03:stream-convenience
Draft

feat: allow passing AqcuisitionSettings kwargs directly to create_stream#109
tlambert03 wants to merge 7 commits intopymmcore-plus:mainfrom
tlambert03:stream-convenience

Conversation

@tlambert03
Copy link
Member

really not sure about this one, so will just put here and let it sit

This PR allows this syntax:

import numpy as np

from ome_writers import create_stream, dims_from_standard_axes

with create_stream(
    root_path="output.zarr",
    dimensions=dims_from_standard_axes({"t": 10, "c": 2, "y": 512, "x": 512}),
    dtype="uint16",
) as stream:
    for _i in range(20):
        stream.append(np.zeros((512, 512), dtype=np.uint16))

as a shorthand for creating settings first, then passing them in:

import numpy as np

from ome_writers import AcquisitionSettings, create_stream, dims_from_standard_axes

settings = AcquisitionSettings(
    root_path="output.zarr",
    dimensions=dims_from_standard_axes({"t": 10, "c": 2, "y": 512, "x": 512}),
    dtype="uint16",
)

with create_stream(settings) as stream:
    for _i in range(20):
        stream.append(np.zeros((512, 512), dtype=np.uint16))

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 24, 2026

Merging this PR will degrade performance by 30.25%

❌ 1 regressed benchmark
✅ 22 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
test_bench_append[t5_c2_z3_xy256-tensorstore] 70.4 ms 100.9 ms -30.25%

Comparing tlambert03:stream-convenience (68015a0) with main (76adf84)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (148740d) during the generation of this report, so 76adf84 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@codecov
Copy link

codecov bot commented Feb 24, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.65%. Comparing base (148740d) to head (68015a0).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/ome_writers/_stream.py 71.42% 2 Missing ⚠️

❌ Your patch check has failed because the patch coverage (75.00%) is below the target coverage (85.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #109      +/-   ##
==========================================
- Coverage   97.73%   97.65%   -0.08%     
==========================================
  Files          21       21              
  Lines        2472     2477       +5     
==========================================
+ Hits         2416     2419       +3     
- Misses         56       58       +2     

☔ 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.

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.

1 participant