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

0.4.0 Previewer #92

Open
wants to merge 58 commits into
base: dev
Choose a base branch
from
Open

0.4.0 Previewer #92

wants to merge 58 commits into from

Conversation

MasterVexillen
Copy link
Collaborator

@MasterVexillen MasterVexillen commented Mar 29, 2023

Change log

  1. Changing tilt-series datatype from int (04d) to str
  2. Modularised MGUI API according to respective plug-in. Old MGUI file not obsoleted yet.
  3. Moved most parameter / metadata handling to MGUI functions for active plug-ins. Savu not migrated yet.
  4. Added MGUI-no-show option to plug-MGUI functions.
  5. Modified codebase to facilitate automation of MotionCor2 -> AreTomo workflow.

Note

  • Albeit thus named, issue with file-naming conventions in beam-shift data is not yet resolved in this PR.

…55/.local/bin:/home/wed13955/bin:/usr/local/go/bin:/root/go/bin:/usr/local/cuda/bin:/opt/lmod/modules/miniconda/4.10.3/bin:/opt/lmod/modules/miniconda/4.10.3/condabin:/usr/local/go/bin:/root/go/bin:/usr/local/cuda/bin:/usr/local/go/bin:/root/go/bin:/usr/local/cuda/bin:/sbin:/bin:/usr/bin:/usr/local/bin:/snap/bin:/ceph/groups/structbio/ot2rec-0.2.4/bin.
…e/wed13955/.local/bin:/home/wed13955/bin:/usr/local/go/bin:/root/go/bin:/usr/local/cuda/bin:/opt/lmod/modules/miniconda/4.10.3/bin:/opt/lmod/modules/miniconda/4.10.3/condabin:/usr/local/go/bin:/root/go/bin:/usr/local/cuda/bin:/usr/local/go/bin:/root/go/bin:/usr/local/cuda/bin:/sbin:/bin:/usr/bin:/usr/local/bin:/snap/bin:/ceph/groups/structbio/ot2rec-0.2.4/bin."

This reverts commit 88a1a0b.
@MasterVexillen MasterVexillen added the enhancement New feature or request label Mar 29, 2023
@MasterVexillen MasterVexillen self-assigned this Mar 29, 2023
Copy link
Contributor

@elainehoml elainehoml 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 overall, thanks Neville - a few bits and pieces to look at which are in the comments.
Main thing to consider is if we should separate out the previewer code into its own previewer.py because that would make it more consistent with how the other plugins are set up. it'll be a "meta plugin" but still works the same as the others and would be easier to maintain if it's separated out like the others.
I'll update the tests and add ot2rec_report to the previewer in a separate PR into this branch to keep this PR a manageable size

@@ -166,10 +167,17 @@ def create_stack_folders(self):

# Create the folders and dictionary for future reference
self._path_dict = {}
for curr_ts in self._process_list:
subfolder_path = f'{self.basis_folder}/{self.rootname}_{curr_ts:04}{self.suffix}'
if single_folder:
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean that if you are processing images which are in a single folder (without the tilt series named subfolders), the processed data will live in a single folder as well rather than be organised into individual tilt series? We would have to account for this in the downstream plugins as well (maybe you have and I haven't gotten to that part yet...)

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, but only if so wished by the user. I've never had problems with this one as by default they are still organised into subfolders.

'use_rawtlt': 1 if self.params['BatchRunTomo']['setup']['use_rawtlt'] else 0,
'pixel_size': self.params['BatchRunTomo']['setup']['pixel_size'],
'pixel_size': self.params['BatchRunTomo']['setup']['pixel_size'] * self.params['BatchRunTomo']['setup']['stack_bin_factor'],
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this accidentally apply binning twice, since binning is already passed to batchruntomo with <aligned_bin_factor>

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No. What it corrects is the wrong pixels size being passed into IMOD. This is because I've modified the code such that you can pre-bin the unaligned stacks first then do alignment. In that case, the old module would have the unbinned pixel size for alignment which is wrong.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The aligned_bin_factor is for the post-alignment stack (i.e. _.ali.mrc), whereas the stack_bin_factor is for the pre-aligned one (i.e. .st).

src/Ot2Rec/aretomo.py Outdated Show resolved Hide resolved
@@ -277,7 +283,7 @@ def _update_volz(args, aretomo_params):
in nm to automatically calculate VolZ. Currently sample_thickness \
= {args['sample_thickness']} and pixel_size = {args['pixel_size']}")
aretomo_params.params["AreTomo_recon"]["volz"] = int(
(args["sample_thickness"] * args["pixel_size"] * 0.1) + 200 # factor of 0.1 because pixel_size in A
(10 * args["sample_thickness"] // args["pixel_size"]) + 200 # factor of 0.1 because pixel_size in A
Copy link
Contributor

Choose a reason for hiding this comment

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

Does args["pixel_size"] account for bin factors here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, because by definition VolZ is unbinned thickness in pixels

@@ -30,6 +30,12 @@
from . import magicgui as mgMod
from . import params as prmMod
from . import user_args as uaMod
from . import mgui_imod_align as alignMGUI
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it might be clearer to import this as align_args or something similar

meta.get_mc2_temp()
meta.get_acquisition_settings()

master_md_name = new_proj_params.project_name + '_master_md.yaml'
Copy link
Contributor

Choose a reason for hiding this comment

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

not for now but in the future maybe we should be consistent with one of either f strings or the + notation like here (my preference is fstrings but can decide later)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah this is old stuff, I'm using f-strings recently

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think we could leave these minor stylistic polishing till later when the main codebase is more stable. There will be many of them in the modules as well, not just the main API.

setup.py Outdated Show resolved Hide resolved
@@ -290,7 +296,7 @@ def _update_volz(args, aretomo_params):
def _create_stacks_with_imod(args):
# Uses align to create the InMrc and AngFile in correct form
try:
args_in_align = mgMod.get_args_align
args_in_align = alignMGUI.get_args_align
Copy link
Contributor

Choose a reason for hiding this comment

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

would this bring up the magicgui? in main.py you've used return_only=True into get_args

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That would. However I'm not using this subroutine, but my old one directly from IMOD newstack (in align.py) instead so the GUI wouldn't come up like when you do command-line o2r.aretomo.run project 2.

mcMod.run(exclusive=False,
args_in=mc2_params)

time.sleep(2)
Copy link
Contributor

Choose a reason for hiding this comment

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

what's this for?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Leave 2 seconds between processes; I don't like automated to processes to run straight after one another.

max_iter=10,
patch_size=[5,5,20],
use_subgroups=True,
*,
Copy link
Contributor

Choose a reason for hiding this comment

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

what's the * for?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just a separator

MasterVexillen and others added 28 commits March 29, 2023 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants