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

436 multiposition table focus needs to be ignored when switching from low to high res #437

Conversation

annie-xd-wang
Copy link
Collaborator

@annie-xd-wang annie-xd-wang commented Apr 28, 2023

Please test to see if it works with the device. Load feature "Decoupled Focus Stage Multiposition", run in "Customized" mode. Do not select "Enable Multi-Position" on the GUI. It works as (Loop) Move To the Next Position -> Autofocus -> ZStack.
Do not merge it. If-else for the Autofocus needs to be added in the feature sequence.

@codecov-commenter
Copy link

codecov-commenter commented Apr 28, 2023

Codecov Report

Merging #437 (1a299a2) into develop (3d17990) will decrease coverage by 0.07%.
The diff coverage is 19.56%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@             Coverage Diff             @@
##           develop     #437      +/-   ##
===========================================
- Coverage    41.81%   41.74%   -0.07%     
===========================================
  Files          151      151              
  Lines        13855    13902      +47     
===========================================
+ Hits          5793     5804      +11     
- Misses        8062     8098      +36     
Flag Coverage Δ
unittests 41.74% <19.56%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/aslm/config/config.py 47.05% <0.00%> (ø)
src/aslm/controller/controller.py 0.00% <0.00%> (ø)
...oller/sub_controllers/multi_position_controller.py 22.34% <0.00%> (ø)
src/aslm/model/devices/stages/stage_pi.py 30.33% <0.00%> (-1.81%) ⬇️
src/aslm/model/features/autofocus.py 13.20% <0.00%> (-0.26%) ⬇️
src/aslm/model/features/common_features.py 38.55% <20.00%> (-2.12%) ⬇️
src/aslm/model/model.py 34.14% <57.14%> (+0.23%) ⬆️

... and 1 file with indirect coverage changes

@@ -63,6 +63,7 @@ MicroscopeState:
timepoint_interval: 0
experiment_duration: 600.0899999999995
is_multiposition: False
multipostion_count: 2
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we keep track of just the positions, without adding this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, we could keep track of positions by using a specific LoopByPosition instead of a general LoopByCount feature.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could LoopByCount by default keep track of the number of things it iterates over? Seems like this could be useful for timepoints and channels as well as positions.

@AdvancedImagingUTSW
Copy link
Collaborator

AdvancedImagingUTSW commented May 1, 2023

Notes from our conversation:

  • Move from low to high-res.
  • At the first position, determine the focus position at z[0] and z[-1] so that the focus ramp is known.
  • At each subsequent position, determine the central focus position. The rate of focus change should remain unchanged. If this is too complex, we could possibly measure the focus position at z[0] and z[-1] on a per position basis.

There could also be an edge case where the non-ideal focus is found (e.g., it exists out of the specified range). I guess if the range is large enough, this shouldn't be a problem (we should find it).

@zacsimile
Copy link
Collaborator

zacsimile commented May 1, 2023

I ran "Volume Search" and then "Decoupled Focus Stage Multiposition". The program threw a DAQ error

Traceback (most recent call last):
  File "C:\Users\DeanLab\.conda\envs\ASLM\lib\threading.py", line 973, in _bootstrap_inner
    self.run()
  File "C:\Users\DeanLab\.conda\envs\ASLM\lib\threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File "c:\users\deanlab\desktop\github\aslm\src\aslm\model\model.py", line 887, in run_acquisition
    self.snap_image()
  File "c:\users\deanlab\desktop\github\aslm\src\aslm\model\model.py", line 856, in snap_image
    self.active_microscope.daq.run_acquisition()
  File "c:\users\deanlab\desktop\github\aslm\src\aslm\model\devices\daq\daq_ni.py", line 427, in run_acquisition
    if self.camera_trigger_task.is_task_done():
  File "C:\Users\DeanLab\.conda\envs\ASLM\lib\site-packages\nidaqmx\task.py", line 520, in is_task_done
    check_for_error(error_code)
  File "C:\Users\DeanLab\.conda\envs\ASLM\lib\site-packages\nidaqmx\errors.py", line 127, in check_for_error
    raise DaqError(error_buffer.value.decode("utf-8"), error_code)
nidaqmx.errors.DaqError: Task specified is invalid or does not exist.
Status Code: -200088

The stage moved to its zero position, the program took one image and then stopped. Logs attached.
model_debug.log
view_controller_debug.log

@zacsimile
Copy link
Collaborator

Hang on. I think this might be an issue with multiposition_count not getting copied over.

@zacsimile
Copy link
Collaborator

zacsimile commented May 1, 2023

Nope, same issue.
model_debug.log

@zacsimile
Copy link
Collaborator

Still moving to the zero stage position and then stopping.
model_debug.log
view_controller_debug.log

@annie-xd-wang
Copy link
Collaborator Author

Please add "robust_fit: True" under "AutoFocusParameters" in experiment.yml file.

@zacsimile
Copy link
Collaborator

Same problem.
model_debug.log
view_controller_debug.log

Co-Authored-By: Annie Wang <6161065+annie-xd-wang@users.noreply.github.com>
@zacsimile
Copy link
Collaborator

zacsimile commented May 2, 2023

Now working as expected. Let's add unit tests for the multi-position feature and the new flag in z-stack.

@zacsimile zacsimile merged commit cd80109 into develop May 5, 2023
@AdvancedImagingUTSW AdvancedImagingUTSW deleted the 436-multiposition-table-focus-needs-to-be-ignored-when-switching-from-low-to-high-res branch December 15, 2023 01:38
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.

Multiposition table focus needs to be ignored when switching from low to high res
4 participants