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

Update polar_analysis.py #676

Merged
merged 5 commits into from
Sep 5, 2024
Merged

Conversation

maclariz
Copy link
Contributor

Updated to allow calculation of rdfs from single points or small areas

Main point was to replace calls to self.radial_mean with defining Ik either as self.radial_mean or areas selected/averaged from self.radial_all

Some minor updates were also needed in plot_background_fits

Some doc strings added

The one weakness in my code is that the rdf from the sub area is then attached to self as representative of whole dataset. This doesn't worry me for now. If I want a different sub-area, I can recalculate. But you may wish to do point by point calculation over entire dataset at some point.

Updated to allow calculation of pdfs from single points or small areas

Main point was to replace calls to self.radial_mean with defining Ik either as self.radial_mean or areas selected/averaged from self.radial_all

Some minor updates were also needed in plot_background_fits

Some doc strings added
Fixed ylim scaling issue in plot_background_fits
@smribet
Copy link
Collaborator

smribet commented Sep 2, 2024

This is great, thanks @maclariz!

Should we update the initial guess for the background coefficients to use Ik as well (line 346/346) of polar_analysis.py?

 const_bg = np.min(self.radial_mean) / int_mean
 int0 = np.median(self.radial_mean) / int_mean - const_bg

@maclariz
Copy link
Contributor Author

maclariz commented Sep 2, 2024

You're absolutely right. These were initial guess for an optimisation so it probably didn't make any difference when I ran it since it probably found the minimum anyway. However, this is probably closer for sub-areas and better practice.

@smribet
Copy link
Collaborator

smribet commented Sep 5, 2024

Awesome, thanks!

@smribet smribet merged commit 02448ee into py4dstem:dev Sep 5, 2024
6 checks passed
@maclariz maclariz deleted the maclariz_rdf_patch branch September 5, 2024 18:17
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