-
Notifications
You must be signed in to change notification settings - Fork 144
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
Maclariz ddf patch 1 #665
Maclariz ddf patch 1 #665
Conversation
Add a new section under process for Digital Dark Field imaging
All DDF functions added
Update DDF.py
Some minor changes to variable naming in one of the functions, and improvement of the inline comments to make them fully consistent with the function variable names |
Adding in the import numpy as np that seems to have triggered the build errors. I foolishly assumed that this was fine as numpy is standard throughout py4dstem.
Update DDF v3.py
I presume reading the errors that it was just import numpy as np that was killing things. I have still used an imported progress bar function as I don't understand yours and don't see any code definition for this anywhere to call. You may wish to advise me about this before running another attempt to merge. |
Thanks for the contribution! Approved the automatic workflow runs, linted the code with black, and switched the progress bar to the internal I'll leave the reviewing for others who work with virtual imaging more, but here's some quick comments:
|
@gvarnavi I don't understand what the init.py is doing. I am not a great programmer and certainly not well up on what the conventions are being used by everyone. And there is little in the way of suitable training at my university to help with that. What I am good at is problem solving and finding mathematically and computationally efficient ways to do stuff that is physically meaningful (i.e. doing physics in a reasonably short amount of time). Quite happy to be educated as to how to make things better fit the larger ecosystem. |
@gvarnavi changing to your docsstrings comments is easy. Will test the approved version, and provided that is now okay, I will make another fork and then edit and make a pull request. |
@maclariz We're very happy to help with adding Perhaps the easiest thing to do is for @cophus (or similar) to review the code for scientific content and once that is sorted, and we've decided on where the best fit is, I'm happy to help with massaging the code structure to fit our conventions. Re: your comment on making a new fork/pull-request: You can simply keep working on your |
@gvarnavi I have now requested that our sysadmin (not me, but someone far more suitable) makes a new venv with a suitable python version for me to run my own fork of py4dstem on for testing. I'll test any further updates in there. |
Creating the init file to make the directory discoverable
Adding the correct imports
updated the comments to better suit style used elsewhere in repository Some slight variable renaming for consistency
Testing notebook using the new DDF syntax: https://drive.google.com/file/d/1WA7DAjBEYpIOk24T7y4NqRPvJj5_Kfpg/view?usp=sharing |
Hi Ian and Colin, Thank you for this PR! I think this will be very helpful for a number of experiments. I am happy to merge but have two small requested changes:
~Steph |
Updated docstrings
Update digital_dark_field.py
Hi Steph,
I have tried updating the docstrings to standard format and being explicit about everything. Some were updated by Colin after he tweaked things. I know there is some repetition for aperture_array_generator but the extra information up top about slight tweaks in how parameters are used in different modes is useful.
I don’t think calibrated pixel sizes causes any issues, as long as calibration is also used in the aperture_array. As noted at the top, tolerance setting will be totally different if we are in calibrated units. That’s pretty much it. The rest is just matching lists of numbers, and the absolute magnitude is irrelevant as long as everything is in the same units.
Best wishes
Ian
On 28 Aug 2024, at 16:29, Stephanie Ribet ***@***.***> wrote:
Hi Ian and Colin,
Thank you for this PR! I think this will be very helpful for a number of experiments. I am happy to merge but have two small requested changes:
1. Can you please add doc strings? They are missing for a few functions. aperture_array_generator has docstrings twice (although I do appreciate the extra notes about mode).
2. bplist.cal will apply all calibrations attached to the braggpeaks, which will create problems if the pixel size of the braggpeaks is calibrated (or it inherits a calibration from a datacube). I would suggest instead of using bplist.cal to follow the design pattern in ACOM<https://github.com/py4dstem/py4DSTEM/blob/2d8ce83cb7beadb1d101fcf0178782e1e4bff5e4/py4DSTEM/process/diffraction/crystal_ACOM.py#L925C9-L932C10> and pass those options to the user as flags.
~Steph
—
Reply to this email directly, view it on GitHub<#665 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/APHUIKULQUMRTJKBW6WDW2TZTXUD7AVCNFSM6AAAAABJ4TPA5CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJVGY3TMNBUGU>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
Dr Ian MacLaren
(he, him, his)
BSc (Hons), PhD, FInstP, CPhys
Reader in Physics
Materials and Condensed Matter Physics
School of Physics and Astronomy / Sgoil Fhiosaigs is Reul-Eòlais
University of Glasgow / Oilthigh Ghlaschu
Glasgow G12 8QQ
http://www.gla.ac.uk/schools/physics/research/groups/mcmp/
https://publons.com/researcher/C-1773-2010/
ORCID: 0000-0002-5334-3010
The University of Glasgow, charity number SC004401
|
Hi Ian, Thanks for making these changes! I agree that all the information in the doc strings is helpful! As you point out, it would be straightforward to account for pixel sizes. Unfortunately, braggvector calibrations are especially confusing, so I tweaked the code to make this a bit more explicit and to give a user more control. The default behavior should match what you had. Let me know if this looks ok to you, and I can merge! ~Steph |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine to me
Here are my functions for Digital Dark Field Imaging. The one thing you might want to change is what progress bar you use to make it consistent with things you use elsewhere. I just used the progress bar library I have been using for a while now. Other than that, it's all just numpy and base python and py4dstem.