Add a differentiable refine template#106
Add a differentiable refine template#106jdickerson95 merged 26 commits intojd_movie_refine_templatefrom
Conversation
|
I'm thinking the pydantic_models utils.py is too large and not super descriptive, and might be worth splitting into smaller, more descriptive files. |
| device = ref_img_rfft.device | ||
| whitening_filter_tensor = wf_config.calculate_whitening_filter( | ||
| ref_img_rfft=ref_img_rfft, output_shape=output_shape | ||
| ) | ||
| ).to(device) | ||
| bandpass_filter_tensor = bf_config.calculate_bandpass_filter( | ||
| output_shape=output_shape | ||
| ) | ||
| ).to(device) | ||
| arbitrary_curve_filter_tensor = ac_config.calculate_arbitrary_curve_filter( | ||
| output_shape=output_shape | ||
| ) | ||
| ).to(device) |
There was a problem hiding this comment.
Should update docstring to specify that this method will return a tensor on the same device as the reference image
src/leopard_em/pydantic_models/managers/refine_template_manager.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
@jdickerson95 is there anything functionally different in the DifferentiableRefineManager class as compared to RefineTemplateManager? If not, it may make more sense to expose the differentiable refine template backed through another method (e.g. RefineTemplateManager.run_differentiable_refine)
There was a problem hiding this comment.
Have been considering this as well.
It just needs everything on the GPU instead of any cpu pre-processing.
I think it will work better as a function in the refine manager.
src/leopard_em/utils/ctf_utils.py
Outdated
| # Raises | ||
| # ------ | ||
| # ValueError | ||
| # If not all the required parameters are passed as additional keyword arguments. |
There was a problem hiding this comment.
No raise statement in this function, can remove this part of docstring
Lets us optimize things by using refine template output as the loss.