Conversation
vilim
left a comment
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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(): |
There was a problem hiding this comment.
This can be a simpler if, the only thing that changes is original vs anatomy in the folder name.
| 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) |
| else: | ||
| fl.save( | ||
| Path(self.save_parameters.output_dir) | ||
| / "anatomy/{:04d}.h5".format(self.i_block), |
There was a problem hiding this comment.
again, a simpler if which just changes the folder name will do
|
|
||
| def advance_plane(self): | ||
| self.motors["z"].move_rel(self.experiment_settings.dz / 1000) | ||
| print("plane advanced by by", self.experiment_settings.dz) |
| 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) |
There was a problem hiding this comment.
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") |
No description provided.