pymmcore-plus / useq-schema

An implementation agnostic schema for describing a sequence of events during a multi-dimensional imaging acquisition.
https://pymmcore-plus.github.io/useq-schema/
BSD 3-Clause "New" or "Revised" License
15 stars 5 forks source link

fix: fix skip channel in iter_sequence + tests #85

Closed fdrgsp closed 1 year ago

fdrgsp commented 1 year ago

This PR fixes a bug in the MDASequence iter_sequence method and adds more tests.

Currently, if we run a sequence with multiple channels and a grid_plan (or z_plan or time_plan) in a position sequence (like the one below), we get ONLY ONE channel through the sequence:

mda = MDASequence(
    channels=[
        {"config": "Cy5", "exposure": 10},
        {"config": "FITC", "exposure": 10}
    ],
    stage_positions=[
        {"x": 0, "y": 0, "sequence": {"grid_plan": {"rows": 2, "columns": 1}}}
    ]
)

running:

for e in mda:
    print(e.index)

current output:

{"p": 0, "c": 0, "g": 0}
{"p": 0, "c": 0, "g": 1}

with this fix, we get both the channels as expected:

{"p": 0, "c": 0, "g": 0}
{"p": 0, "c": 0, "g": 1}
{"p": 0, "c": 1, "g": 0}
{"p": 0, "c": 1, "g": 1}
codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (3a737f9) 96.11% compared to head (3f37c3a) 96.11%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #85 +/- ## ======================================= Coverage 96.11% 96.11% ======================================= Files 10 10 Lines 617 618 +1 ======================================= + Hits 593 594 +1 Misses 24 24 ``` | [Impacted Files](https://codecov.io/gh/pymmcore-plus/useq-schema/pull/85?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pymmcore-plus) | Coverage Δ | | |---|---|---| | [src/useq/\_mda\_sequence.py](https://codecov.io/gh/pymmcore-plus/useq-schema/pull/85?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pymmcore-plus#diff-c3JjL3VzZXEvX21kYV9zZXF1ZW5jZS5weQ==) | `97.95% <100.00%> (+0.01%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pymmcore-plus). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pymmcore-plus)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.