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

Drift corr reference working #9

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

EmanPaoli
Copy link
Member

No description provided.

Copy link
Member

@vilim vilim left a comment

Choose a reason for hiding this comment

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

Looks good, I would suggest one simplification though: removing the reference_params_queue and reference_event, and always having only save_paramters with an additional boolean flag is_reference. This removes a lot of code duplication (e.g. you don't need ReferenceParamters, just keep ReferenceSettings and change the convert_save_params function)

dz = st.dz
z_th = st.z_th
n_frames_exp = st.n_frames_exp
rp = ReferenceParameters(n_frames_ref=n_frames_ref,
Copy link
Member

Choose a reason for hiding this comment

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

since everything is the same, you can use the st.params.values (this gives you a dictionary), so
so the function becomes a one-liner

rp = ReferenceParamters(**st.params.values)

Path(self.save_parameters.output_dir) / "original" / "stack_metadata.json"
).is_file():
shutil.rmtree(Path(self.save_parameters.output_dir) / "original")
if not self.ref_event.is_set():
Copy link
Member

Choose a reason for hiding this comment

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

This can be a simpler if, the only thing that changes is original vs anatomy in the folder name.

@@ -74,6 +90,7 @@ def save_loop(self):
try:
self.update_n_t(self.n_frames_queue.get(timeout=0.001))
n_total = self.save_parameters.n_t * self.save_parameters.n_z
print(n_total)
Copy link
Member

Choose a reason for hiding this comment

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

you can remove the prints

else:
fl.save(
Path(self.save_parameters.output_dir)
/ "anatomy/{:04d}.h5".format(self.i_block),
Copy link
Member

Choose a reason for hiding this comment

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

again, a simpler if which just changes the folder name will do

@@ -192,9 +253,20 @@ def pause_scanning(self):

def advance_plane(self):
self.motors["z"].move_rel(self.experiment_settings.dz / 1000)
print("plane advanced by by", self.experiment_settings.dz)
Copy link
Member

Choose a reason for hiding this comment

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

extra print

self.experiment_settings.n_planes - 1) * self.experiment_settings.dz
print("moving stage up by", mic_to_move)
self.motors["z"].move_rel(mic_to_move / 1000)
sleep(0.2)
Copy link
Member

Choose a reason for hiding this comment

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

this time should be set as a constant, possibly parameterized later with a config file, like lightsheet. Also, the moving time might be longer than 0.2s if you are returning to the first plane from the end of the reference stack

self.n_frames_ref = Param(10, (1, 500))
self.extra_planes = Param(1, (1, 500))
self.dz = Param(1.0, (0.1, 20.0), unit="um")
self.xy_th = Param(5.0, (0.1, 20.0), unit="um")
Copy link
Member

Choose a reason for hiding this comment

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

what is this?

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