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

refactor: big cleanup of MDAHandler logic #234

Merged
merged 4 commits into from
Dec 7, 2022

Conversation

tlambert03
Copy link
Member

This PR gets rid of a number of mostly similar methods (with slightly different behavior for explorer vs mda):

  • _interpret_split_channels
  • _interpret_explorer_positions
  • _get_shape_and_labels
  • _get_channel_name_with_index
  • _add_mda_channel_layers
  • _add_explorer_positions_layers

and replaces them with two functions:

  1. _determine_sequence_layers - a pure stateless function (i.e. not a class method) that takes a sequence object, and returns information (id, shape, metadata) about all of the layers that need to be created for the experiment (based on whether C or P is being split. Being stateless is particularly nice here, since it means it can be tested completely in absence of a core, a widget, a viewer, etc... (but that will happen in a followup PR)
  2. _create_empty_image_layer - one method that creates the necessary layers.

@codecov
Copy link

codecov bot commented Dec 6, 2022

Codecov Report

Base: 84.79% // Head: 84.45% // Decreases project coverage by -0.34% ⚠️

Coverage data is based on head (f7b5f06) compared to base (52f08ea).
Patch coverage: 96.66% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #234      +/-   ##
==========================================
- Coverage   84.79%   84.45%   -0.35%     
==========================================
  Files          15       15              
  Lines         921      894      -27     
==========================================
- Hits          781      755      -26     
+ Misses        140      139       -1     
Impacted Files Coverage Δ
src/napari_micromanager/_saving.py 72.88% <66.66%> (ø)
src/napari_micromanager/_mda_handler.py 98.15% <98.24%> (+0.26%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@tlambert03 tlambert03 merged commit b28358e into pymmcore-plus:main Dec 7, 2022
@tlambert03 tlambert03 deleted the cleaner-mda branch December 7, 2022 14:00
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.

None yet

1 participant