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: MDASequence iter_sequence method #93

Closed fdrgsp closed 1 year ago

fdrgsp commented 1 year ago

This PR fix a bug in the MDASequence iter_sequence method.

Currently, if we iter through a MDASequence where we specify channels (> 1) in the main sequence and channel(s) + any plan in the sub-sequence like the one below...

mda = MDASequence(
      axis_order="tpgcz",
      channels=["Cy5", "FITC"],
      stage_positions=[{"sequence": {"channels": ["DAPI"], "z_plan": {"range": 2, "step": 1}}}]
)

...we duplicate the number of events (duplication depends on the number of channels that are specified in the main sequence.). This is the current result:

index: {'p': 0, 'c': 0, 'z': 0}  channel: DAPI
index: {'p': 0, 'c': 0, 'z': 1}  channel: DAPI
index: {'p': 0, 'c': 0, 'z': 2}  channel: DAPI
index: {'p': 0, 'c': 0, 'z': 0}  channel: DAPI
index: {'p': 0, 'c': 0, 'z': 1}  channel: DAPI
index: {'p': 0, 'c': 0, 'z': 2}  channel: DAPI

with this fix, we make sure that the the sequence is not executed n times.

index: {'p': 0, 'c': 0, 'z': 0}  channel: DAPI
index: {'p': 0, 'c': 0, 'z': 1}  channel: DAPI
index: {'p': 0, 'c': 0, 'z': 2}  channel: DAPI
codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (03d1b76) 96.11% compared to head (5ae83d3) 96.11%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #93 +/- ## ======================================= Coverage 96.11% 96.11% ======================================= Files 10 10 Lines 617 618 +1 ======================================= + Hits 593 594 +1 Misses 24 24 ``` | [Impacted Files](https://app.codecov.io/gh/pymmcore-plus/useq-schema/pull/93?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://app.codecov.io/gh/pymmcore-plus/useq-schema/pull/93?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: |

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