Skip to content

Added new Examples#253

Open
Lulus792 wants to merge 47 commits intoLumiSpy:mainfrom
Lulus792:examples
Open

Added new Examples#253
Lulus792 wants to merge 47 commits intoLumiSpy:mainfrom
Lulus792:examples

Conversation

@Lulus792
Copy link
Contributor

@Lulus792 Lulus792 commented Feb 5, 2026

Added new example map_function, energie_conversion, ROIs, peak_analysis, basic_model_fitting, custom_model_fitting and restructured the old position of the index example. And changed all the data_cleaning examples to use the build in data module of lumispy

Progress of the PR

  • added new example map_function
  • add a changelog entry in the upcoming_changes folder ,
  • ready for review.

@jlaehne jlaehne mentioned this pull request Feb 9, 2026
# ^^^^^^^^^^^^
#
# It returns a structured array that contains ``position``, ``height`` and ``width`` of the found peaks.
peaks[0, 0]

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
@Lulus792 Lulus792 force-pushed the examples branch 3 times, most recently from c13c7ae to ce51762 Compare February 13, 2026 14:30
@Lulus792 Lulus792 force-pushed the examples branch 3 times, most recently from 568f59e to ff32909 Compare February 23, 2026 12:14
@jlaehne
Copy link
Contributor

jlaehne commented Feb 26, 2026

can you merge in the updated main branch to resolve conflicts with the examples that have been updated in the previous PR

@Lulus792
Copy link
Contributor Author

syncing with main didnt quite work so i will have to do it manually i will make the changes in the morning and put the arrow for ready for review once i fixed it.

@Lulus792
Copy link
Contributor Author

syncing with main didnt quite work so i will have to do it manually i will make the changes in the morning and put the arrow for ready for review once i fixed it.

should be ready now for review

"""
Indexing
========
Indexing is achieved using `inav <HS_inav_>`__ or `isig <HS_isig_>`__, which allows the navigation- and signalaxes to be accessed independently.

Choose a reason for hiding this comment

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

space between signal and axes

# Creating a small example signal
# -------------------------------
#
# We create a simple ``Signal1D`` with a total shape of ``(2, 3, 4)``:

Choose a reason for hiding this comment

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

replace total shape with axes shape

Indexing
========
Indexing is achieved using `inav <HS_inav_>`__ or `isig <HS_isig_>`__, which allows the navigation- and signalaxes to be accessed independently.
The index operation returns a view of the original signal.

Choose a reason for hiding this comment

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

maybe needs to be clarified/reworded - not sure if I understand what is meant here

Choose a reason for hiding this comment

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

I find the example easy to follow until the isig section. I find the indexing of the array a bit confusing when dealing with isig, maybe annotations to the output arrays or a graphical illustration could improve this

"""
Region of Interest (ROI)
========================
This example demonstrates how to use ROIs from Hyperspy. ROIs are used to select a subset of the data for further analysis. It can be done interactively aswell as non interactively.
Copy link

@aidanc151 aidanc151 Mar 2, 2026

Choose a reason for hiding this comment

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

replace with "This example demonstrates use of HyperSpy ROIs for a hyperspectral luminescence dataset. ROIs are used to select a subset of the data for analysis, this can be done interactively as well as non interactively."

# -------------------
#
# For non-interactove ROIs we have to specify the type of ROI we want to use. In this case we'll use
# ``Line2DROI(x1=, y1=, x2=, y2=, linewidth=)``.

Choose a reason for hiding this comment

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

I would remove then equals signs from here: Line2DROI(x1=, y1=, x2=, y2=, linewidth=)

ax1 = s2.axes_manager[0]
ax2 = s2.axes_manager[1]

# define start params

Choose a reason for hiding this comment

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

Can a units argument be used here to avoid multiplying by scale factors? I think if cx, cy were not defined the default position of the circle should also place within the bounds of the signal

Choose a reason for hiding this comment

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

HyperSpy does have a nice example gallery for ROIs already, in order to not overlap too much I wonder if these examples can be a little more specific to luminescence data analysis. One thing I think could also be included is a computation of calculating the mean of a signal extracted from a ROI - though this is also included in a hyperspy example

Choose a reason for hiding this comment

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

These examples are nice but I wonder if they would be more suited to the HyperSpy example gallery? They don't seem specific to luminescence data, one idea would be to keep the Mathematical Expression header but define a exponential convolved with a gaussian (since this is useful for modelling time-resolved luminescence transients)

Choose a reason for hiding this comment

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

The image at the top of the page has a spike in it, could be better to use a different image to not confuse the which peak the width is being estimated of

# %%
# Return Value
# ^^^^^^^^^^^^
# Returns float or lists of floats: ``[width, left, right]``. In our case we get a list of width since we have a map of spectra.

Choose a reason for hiding this comment

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

replace "In our case we get a list of width since we have a map of spectra." with some along the lines of "We update our metadata of the new signal containing our FWHM's and plot the results"

Choose a reason for hiding this comment

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

Maybe also better suited as a hyperspy example?

I don't love that the ohaver function returns a structured array instead of hyperspy signals, if this was changed I think it would make this example better as well.

Choose a reason for hiding this comment

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

The Line2D ROI example also appears under Plotting - Extraction of Linescan example

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.

4 participants