hyperspy.api.samfire.local_strategies#

hyperspy.api.samfire.local_strategies.LocalStrategy(name)

A SAMFire strategy that operates in "pixel space" - i.e calculates the starting point estimates based on the local averages of the pixels.

hyperspy.api.samfire.local_strategies.ReducedChiSquaredStrategy()

Reduced chi-squared Local strategy of the SAMFire.

class hyperspy.api.samfire.local_strategies.LocalStrategy(name)#

Bases: SamfireStrategy

A SAMFire strategy that operates in “pixel space” - i.e calculates the starting point estimates based on the local averages of the pixels. Requires some weighting method (e.g. reduced chi-squared).

clean()#

Purges the currently saved values.

plot(fig=None)#

Plots the current marker in a flat image

Parameters:
fighyperspy.api.signals.Signal2D or numpy.ndarray

if an already plotted image, then updates. Otherwise creates a new one.

Returns:
hyperspy.api.signals.Signal2D

The resulting 2D signal. If passed again, will be updated (computationally cheaper operation).

property radii#

A tuple of >=0 floats that show the “radii of relevance”

refresh(overwrite, given_pixels=None)#

Refreshes the marker - recalculates with the current values from scratch.

Parameters:
overwritebool

If True, all but the given_pixels will be recalculated. Used when part of already calculated results has to be refreshed. If False, only use pixels with marker == -scale (by default -1) to propagate to pixels with marker >= 0. This allows “ignoring” pixels with marker < -scale (e.g. -2).

given_pixelsnumpy.ndarray of bool

Pixels with True value are assumed as correctly calculated.

remove()#

Removes this strategy from its SAMFire

property samf#

The SAMFire that owns this strategy.

update(ind, isgood)#

Updates the database and marker with the given pixel results

Parameters:
indtuple

the index with new results

isgoodbool

if the fit was successful.

values(ind)#

Returns the current starting value estimates for the given pixel. Calculated as the weighted local average. Only returns components that are active, and parameters that are free.

Parameters:
indtuple

the index of the pixel of interest.

Returns:
valuesdict

A dictionary of estimates, structured as {component_name: {parameter_name: value, …}, …} for active components and free parameters.

property weight#

A Weight object, able to assign significance weights to separate pixels or maps, given the model.

class hyperspy.api.samfire.local_strategies.ReducedChiSquaredStrategy#

Bases: LocalStrategy

Reduced chi-squared Local strategy of the SAMFire. Uses reduced chi-squared as the weight, and exponential decay as the decay function.

clean()#

Purges the currently saved values.

plot(fig=None)#

Plots the current marker in a flat image

Parameters:
fighyperspy.api.signals.Signal2D or numpy.ndarray

if an already plotted image, then updates. Otherwise creates a new one.

Returns:
hyperspy.api.signals.Signal2D

The resulting 2D signal. If passed again, will be updated (computationally cheaper operation).

property radii#

A tuple of >=0 floats that show the “radii of relevance”

refresh(overwrite, given_pixels=None)#

Refreshes the marker - recalculates with the current values from scratch.

Parameters:
overwritebool

If True, all but the given_pixels will be recalculated. Used when part of already calculated results has to be refreshed. If False, only use pixels with marker == -scale (by default -1) to propagate to pixels with marker >= 0. This allows “ignoring” pixels with marker < -scale (e.g. -2).

given_pixelsnumpy.ndarray of bool

Pixels with True value are assumed as correctly calculated.

remove()#

Removes this strategy from its SAMFire

property samf#

The SAMFire that owns this strategy.

update(ind, isgood)#

Updates the database and marker with the given pixel results

Parameters:
indtuple

the index with new results

isgoodbool

if the fit was successful.

values(ind)#

Returns the current starting value estimates for the given pixel. Calculated as the weighted local average. Only returns components that are active, and parameters that are free.

Parameters:
indtuple

the index of the pixel of interest.

Returns:
valuesdict

A dictionary of estimates, structured as {component_name: {parameter_name: value, …}, …} for active components and free parameters.

property weight#

A Weight object, able to assign significance weights to separate pixels or maps, given the model.