Skip to content

Conversation

@NJMarchese
Copy link

  • Added new function to allow for different peak detection parameters for different q-spacings on the diffraction pattern.
  • Also enabled the ability to pass a realspace mask onto find_peaks.
  • Added an error catch onto the curve_fit of flowlines to give a more informative error message.
  • Added kwargs.get method to find_peaks_single_pattern so that the figure and axes are passed correctly. Before wouldn't handle correctly, and if figax was passed it would give an error saying there were multiple values for figax (the default in the code and the one passed in kwargs)
  • Added vmin and vmax kwargs pass to show_amorphous_ring_fit
  • Added ability to return data for plot_radial_peaks

**kwargs,
)
if kwargs.get("vmax") is not None:
vmax = kwargs.pop("vmax")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think if you want to do this you need add vmin and max as flags to the function

Copy link
Author

Choose a reason for hiding this comment

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

Changed to add vmin and vmax as flags for the function input, but also had to change other lines of code since variable with names vmin and vmax assigned in line 154.

kwargs_pass=None,
):
"""
Peak detection function for polar transformations. Loop through all probe positions,
Copy link
Collaborator

Choose a reason for hiding this comment

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

missing doc strings...especially for your new contributions with kwargs_pass, it'd be helpful to add detailed docs here!

Copy link
Author

Choose a reason for hiding this comment

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

I put in some doc strings, but as this is built off the original find_peaks function and the docstrings for that function is what is in find_peaks_segmented, I'm not sure if it's best for me to fill in those belonging to the original function. I added docstrings for the parameters I added for find_peaks_segmented.

def find_peaks_segmented(
self,
mask=None,
mask_real=None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this be added to the other find_peaks function too?

Copy link
Author

Choose a reason for hiding this comment

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

Maybe. When I looked at it the first time it seemed like it would break a bunch of things, so made it separate initially to keep everything in tact. I can take another look.

@smribet
Copy link
Collaborator

smribet commented Jul 15, 2025

Hi @NJMarchese, thanks for contributing these features! I have a few small suggestions to your code.

- Updated `find_peaks_single_pattern` to restore intensity scaling for scatter plot.
- Enhanced `find_peaks_segmented` with new mask parameters for improved peak detection.
- Modified `plot_radial_peaks` to allow customizable vertical lines.
- Adjusted orientation histogram calculation to ensure angle conversion is in radians.
- Added vmin and vmax parameters to `show_amorphous_ring_fit` for better visualization control.
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