Skip to content

allow stack settings to be per-series#902

Closed
barentine wants to merge 3 commits into
python-microscopy:masterfrom
barentine:zacq
Closed

allow stack settings to be per-series#902
barentine wants to merge 3 commits into
python-microscopy:masterfrom
barentine:zacq

Conversation

@barentine
Copy link
Copy Markdown
Member

Addresses issue #osmalarity changes cell height

Is this a bugfix or an enhancement?
enhancement
Proposed changes:

  • grab stack settings for the protocol fresh each time so we can spec it for a single series without changing the global stacksettings

Checklist:

  • Tested on sim PYMEAcquire

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 27, 2021

Codecov Report

Merging #902 (d59149d) into master (5165d2d) will increase coverage by 0.00%.
The diff coverage is 18.18%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #902   +/-   ##
=======================================
  Coverage   11.30%   11.30%           
=======================================
  Files         624      624           
  Lines       71803    71811    +8     
=======================================
+ Hits         8117     8121    +4     
- Misses      63686    63690    +4     
Impacted Files Coverage Δ
PYME/Acquire/SpoolController.py 0.00% <0.00%> (ø)
PYME/Acquire/protocol.py 40.66% <22.22%> (-1.00%) ⬇️
PYME/localization/FitFactories/InterpFitR.py 78.18% <0.00%> (-2.73%) ⬇️
...E/localization/FitFactories/SplitterFitInterpNR.py 69.62% <0.00%> (+1.89%) ⬆️
PYME/localization/FitFactories/Dumbell3DFitR.py 98.66% <0.00%> (+4.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5165d2d...d59149d. Read the comment docs.

@barentine
Copy link
Copy Markdown
Member Author

Note there is a small bug in current protocol.py in setting z position since the step size add on doesn't include the direction, so if you are doing a top-down stack you won't get the last slice

In [4]: np.arange(0, 5 + 0.95, 1)
Out[4]: array([0., 1., 2., 3., 4., 5.])

In [5]: np.arange(5, 0 - 0.95, -1)
Out[5]: array([5., 4., 3., 2., 1., 0.])

In [6]: np.arange(5, 0 + 0.95, -1)
Out[6]: array([5., 4., 3., 2., 1.])

now also addressed in this pr

protocol = protocol_z
protocol.dwellTime = z_dwell
#print(protocol)
stack_settings = stack if hasattr(stack, 'keys') else None
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let me rest on it for a bit, but not 100% comfortable with the re-purposing of the boolean stack parameter. Can see arguments both ways ...

Comment thread PYME/Acquire/protocol.py
scope.stackSettings.GetEndPos() + .95 * scope.stackSettings.GetStepSize(),
scope.stackSettings.GetStepSize() * scope.stackSettings.GetDirection())

def set_stack_positions(self, stack_mdh=None):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

a) see PR #799 for re-factored StackSettings object. Any function to set one of these should either take a StackSettings object, or a dict of arguments (as provided by the http endpoints), not a metadata handler.

A dedicated object/handler is needed as some of the properties are computed rather than directly read, depending on stack mode (hard ends, or middle & number). It makes sense that the logic for computing these is in one place and not duplicated. Notably, this code will probably not do what you want as the default mode is middle & number. Protocol then uses it's own StackSettings object/the one that it gets passed rather than the scope one, leaving the rest of the code the same.

a) having this as a separate function (rather than in Init()) feels a bit off, but could grow on me.

@barentine
Copy link
Copy Markdown
Member Author

@David-Baddeley any status updates here?

@David-Baddeley
Copy link
Copy Markdown
Contributor

See latest iteration of #799. Needs a bit of testing / refinement, and maybe another iteration to remove some of the gross aspects. Should however give nice easily called endpoints for both action queueing and webui.

Major un/semi-resolved design choice as follows:

Should the z dwell time be part of the stack settings, or the spooler settings? Current version of the #799 opts for the worst of both worlds and lets it be either with significant grossness as to who takes priority for default values.

Arguments for the dwell time to be part of the stack settings:

  • seems like a logical place for it
  • tidy, easy to grasp as an endpoint for an end user

Arguments against (effectively the status-quo where the z-dwell settings are a property of localisation series rather than z-stepping):

  • you are unlikely to want to share it between different modalities (i.e. the chance of wanting the same z-dwell for a localisation series and a widefield stack of the same structure is virtually nil, whereas sharing other stack parameters is quite likely/common/desirable if you want to do any form of correlative or multi-channel imaging.)
  • putting dwell time in the stack settings means that you can't easily share stack settings between modalities (or if you do you end up with garbage spaghetti logic like I have in py3 (and other) fixes for pymeacquire web ui #799.

I think there are are some pragmatic short-term things which would let us get #799 in though (even if this is a bit of a brain fart)

@David-Baddeley
Copy link
Copy Markdown
Contributor

Have a pragmatic interim solution to the above.

@David-Baddeley
Copy link
Copy Markdown
Contributor

should be redundant to changes in #799

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.

2 participants