analyzer#
- pyleem.analyzer.find_onset(profiles)[source]#
Find the onset of a profile.
The profiles can be full images or line profiles. Here we look at the “relative difference”. The np.gradient is not used because it tracks two steps at a time.
- Parameters:
profiles (list) – List of profiles to find the onset of.
- Returns:
Index of the profile with the steepest rise.
- Return type:
int
- class pyleem.analyzer.Analyzer(readers, roi=None, onset=0)[source]#
Bases:
objectBase analyzer class for LEEM data analysis.
Provides core functionality for domain-specific LEEM analysis. Raw images come from readers. Processed images default to raw images. Annotated images default to processed images.
All variable access should be index aware.
- Parameters:
readers (iterable) – Reader objects used by the analyzer.
- Variables:
readers (list) – List of readers after onset.
roi (ROI) – ROI for measuring the image.
onset (int) – Index of the onset of the image.
- annotate_image(index, ax)[source]#
Annotate the image for matplotlib plotting.
Override to annotate the image. Currently, the annotate_image method does not take additional arguments. The idea is that the whole image stack should be annotated the same way.
- plot_image(index, ax=None, annotate=False, autolevel=False)[source]#
Plot image data.
- Parameters:
ax (matplotlib.axes.Axes) – Matplotlib axes object.
autolevel (bool) – auto leveling the image. Act as auto-contrast.
- get_processed_image(index)[source]#
Return the processed image.
The method should be overridden if the processed image is not the same.
- analyze(**kwargs)[source]#
Perform the analysis.
The method is not required if the analyzer does not need to work with configuration and workflow logic. The analyze method is recommended to be stack analysis logic instead of acting on individual readers.
For large data output, it is recommended for analyze to save the result to a file.