hyperspy.signal_tools module

class hyperspy.signal_tools.BackgroundRemoval(signal, background_type='Power law', polynomial_order=2, fast=True, plot_remainder=True, zero_fill=False, show_progressbar=None, model=None)

Bases: hyperspy.signal_tools.SpanSelectorInSignal1D

_background_type_changed(old, new)
_fast_changed(old, new)
_fit()
_polynomial_order_changed(old, new)
_ss_left_value_changed(old, new)
_ss_right_value_changed(old, new)
_update_line()
apply()
bg_to_plot(axes_manager=None, fill_with=nan)
create_background_line()
create_remainder_line()
disconnect()
gui(display=True, toolkit=None, **kwargs)

Display or return interactive GUI element if available.

Parameters
  • display (bool) – If True, display the user interface widgets. If False, return the widgets container in a dictionary, usually for customisation or testing.

  • toolkit (str, iterable of strings or None) – If None (default), all available widgets are displayed or returned. If string, only the widgets of the selected toolkit are displayed if available. If an interable of toolkit strings, the widgets of all listed toolkits are displayed or returned.

on_disabling_span_selector()
rm_to_plot(axes_manager=None, fill_with=nan)
set_background_estimator()
span_selector_changed()
class hyperspy.signal_tools.ButterworthFilter(signal)

Bases: hyperspy.signal_tools.Smoothing

_cutoff_frequency_ratio_changed(old, new)
_order_changed(old, new)
_type_changed(old, new)
apply()
gui(display=True, toolkit=None, **kwargs)

Display or return interactive GUI element if available.

Parameters
  • display (bool) – If True, display the user interface widgets. If False, return the widgets container in a dictionary, usually for customisation or testing.

  • toolkit (str, iterable of strings or None) – If None (default), all available widgets are displayed or returned. If string, only the widgets of the selected toolkit are displayed if available. If an interable of toolkit strings, the widgets of all listed toolkits are displayed or returned.

model2plot(axes_manager=None)
class hyperspy.signal_tools.DerivativeTextHandler

Bases: object

legend_artist(legend, orig_handle, fontsize, handlebox)
class hyperspy.signal_tools.DerivativeTextParameters(text, color)

Bases: object

class hyperspy.signal_tools.EdgesRange(signal, active=None)

Bases: hyperspy.signal_tools.SpanSelectorInSignal1D

_clear_markers(edges=None)
_get_edges_info_within_energy_axis()
_keep_valid_edges()
_on_figure_changed()
_plot_labels(active=None, complementary=None)
check_btn_state()
gui(display=True, toolkit=None, **kwargs)

Display or return interactive GUI element if available.

Parameters
  • display (bool) – If True, display the user interface widgets. If False, return the widgets container in a dictionary, usually for customisation or testing.

  • toolkit (str, iterable of strings or None) – If None (default), all available widgets are displayed or returned. If string, only the widgets of the selected toolkit are displayed if available. If an interable of toolkit strings, the widgets of all listed toolkits are displayed or returned.

on_complementary()
update_active_edge(change)
update_table()
class hyperspy.signal_tools.ImageContrastEditor(image)

Bases: traits.has_traits.HasTraits

_auto_changed(old, new)
_gamma_changed(old, new)
_get_current_range()
_get_data()
_get_histogram(data)
_get_line()
_linscale_changed(old, new)
_linthresh_changed(old, new)
_norm_changed(old, new)
_reset(auto=None, indices_changed=True)
_reset_original_settings()
_reset_span_selector()
_set_xaxis()
_show_help_fired()
_sym_log_transform(arr)
_vmax_percentile_changed(old, new)
_vmin_percentile_changed(old, new)
apply()
close()
create_axis()
gui(display=True, toolkit=None, **kwargs)

Display or return interactive GUI element if available.

Parameters
  • display (bool) – If True, display the user interface widgets. If False, return the widgets container in a dictionary, usually for customisation or testing.

  • toolkit (str, iterable of strings or None) – If None (default), all available widgets are displayed or returned. If string, only the widgets of the selected toolkit are displayed if available. If an interable of toolkit strings, the widgets of all listed toolkits are displayed or returned.

mpl_help = 'See the matplotlib SymLogNorm for more information.'
plot_histogram(max_num_bins=250)

Plot a histogram of the data.

Parameters

max_num_bins (int, default 250) – When estimating the bins using one of the str methods, the number of bins is capped by this number to avoid a MemoryError being raised by numpy.histogram().

Returns

Return type

None

reset()
span_selector_switch(on)
update_histogram()
update_line()
update_span_selector(*args, **kwargs)
update_span_selector_traits(*args, **kwargs)
class hyperspy.signal_tools.IntegrateArea(signal, signal_range=None)

Bases: hyperspy.signal_tools.SpanSelectorInSignal1D

apply()
gui(display=True, toolkit=None, **kwargs)

Display or return interactive GUI element if available.

Parameters
  • display (bool) – If True, display the user interface widgets. If False, return the widgets container in a dictionary, usually for customisation or testing.

  • toolkit (str, iterable of strings or None) – If None (default), all available widgets are displayed or returned. If string, only the widgets of the selected toolkit are displayed if available. If an interable of toolkit strings, the widgets of all listed toolkits are displayed or returned.

class hyperspy.signal_tools.LineInSignal1D(signal)

Bases: traits.has_traits.HasTraits

Adds a vertical draggable line to a spectrum that reports its position to the position attribute of the class.

position

The position of the vertical line in the one dimensional signal. Moving the line changes the position but the reverse is not true.

Type

float

on

Turns on and off the line

Type

bool

color

The color of the line. It automatically redraws the line.

Type

wx.Colour

_color_changed(old, new)
draw()
switch_on_off(obj, trait_name, old, new)
update_position(*args, **kwargs)
class hyperspy.signal_tools.Load

Bases: traits.has_traits.HasTraits

class hyperspy.signal_tools.PeaksFinder2D(signal, method, peaks=None, **kwargs)

Bases: traits.has_traits.HasTraits

_find_peaks_current_index(method)
_get_parameters(method)
_method_changed(old, new)
_normalise_method_name(method)
_parameter_changed(old, new)
_parse_paramaters_initial_values(**kwargs)
_peaks_to_marker(markersize=20, add_numbers=True, color='red')
_plot_markers()
_set_parameters_observer()
_update_peak_finding(method=None)
close()
compute_navigation()
disconnect()
gui(display=True, toolkit=None, **kwargs)

Display or return interactive GUI element if available.

Parameters
  • display (bool) – If True, display the user interface widgets. If False, return the widgets container in a dictionary, usually for customisation or testing.

  • toolkit (str, iterable of strings or None) – If None (default), all available widgets are displayed or returned. If string, only the widgets of the selected toolkit are displayed if available. If an interable of toolkit strings, the widgets of all listed toolkits are displayed or returned.

set_random_navigation_position()
xc_template = None
class hyperspy.signal_tools.Signal1DCalibration(signal)

Bases: hyperspy.signal_tools.SpanSelectorInSignal1D

_left_value_changed(old, new)
_right_value_changed(old, new)
_update_calibration(*args, **kwargs)
apply()
gui(display=True, toolkit=None, **kwargs)

Display or return interactive GUI element if available.

Parameters
  • display (bool) – If True, display the user interface widgets. If False, return the widgets container in a dictionary, usually for customisation or testing.

  • toolkit (str, iterable of strings or None) – If None (default), all available widgets are displayed or returned. If string, only the widgets of the selected toolkit are displayed if available. If an interable of toolkit strings, the widgets of all listed toolkits are displayed or returned.

class hyperspy.signal_tools.Signal1DRangeSelector(signal)

Bases: hyperspy.signal_tools.SpanSelectorInSignal1D

class hyperspy.signal_tools.SimpleMessage(text='')

Bases: traits.has_traits.HasTraits

gui(display=True, toolkit=None, **kwargs)

Display or return interactive GUI element if available.

Parameters
  • display (bool) – If True, display the user interface widgets. If False, return the widgets container in a dictionary, usually for customisation or testing.

  • toolkit (str, iterable of strings or None) – If None (default), all available widgets are displayed or returned. If string, only the widgets of the selected toolkit are displayed if available. If an interable of toolkit strings, the widgets of all listed toolkits are displayed or returned.

class hyperspy.signal_tools.Smoothing(signal)

Bases: traits.has_traits.HasTraits

_differential_order_changed(old, new)
_line_color_changed(old, new)
_line_color_ipy_changed()
close()
diff_model2plot(axes_manager=None)
property line_color_rgb
plot()
turn_diff_line_off()
turn_diff_line_on(diff_order)
update_lines()
class hyperspy.signal_tools.SmoothingLowess(*args, **kwargs)

Bases: hyperspy.signal_tools.Smoothing

_number_of_iterations_changed(old, new)
_smoothing_parameter_changed(old, new)
apply()
gui(display=True, toolkit=None, **kwargs)

Display or return interactive GUI element if available.

Parameters
  • display (bool) – If True, display the user interface widgets. If False, return the widgets container in a dictionary, usually for customisation or testing.

  • toolkit (str, iterable of strings or None) – If None (default), all available widgets are displayed or returned. If string, only the widgets of the selected toolkit are displayed if available. If an interable of toolkit strings, the widgets of all listed toolkits are displayed or returned.

model2plot(axes_manager=None)
class hyperspy.signal_tools.SmoothingSavitzkyGolay(signal)

Bases: hyperspy.signal_tools.Smoothing

_decrease_window_length_fired()
_differential_order_changed(old, new)
_increase_window_length_fired()
_polynomial_order_changed(old, new)
_window_length_changed(old, new)
apply()
diff_model2plot(axes_manager=None)
gui(display=True, toolkit=None, **kwargs)

Display or return interactive GUI element if available.

Parameters
  • display (bool) – If True, display the user interface widgets. If False, return the widgets container in a dictionary, usually for customisation or testing.

  • toolkit (str, iterable of strings or None) – If None (default), all available widgets are displayed or returned. If string, only the widgets of the selected toolkit are displayed if available. If an interable of toolkit strings, the widgets of all listed toolkits are displayed or returned.

model2plot(axes_manager=None)
class hyperspy.signal_tools.SmoothingTV(signal)

Bases: hyperspy.signal_tools.Smoothing

_smoothing_parameter_changed(old, new)
apply()
gui(display=True, toolkit=None, **kwargs)

Display or return interactive GUI element if available.

Parameters
  • display (bool) – If True, display the user interface widgets. If False, return the widgets container in a dictionary, usually for customisation or testing.

  • toolkit (str, iterable of strings or None) – If None (default), all available widgets are displayed or returned. If string, only the widgets of the selected toolkit are displayed if available. If an interable of toolkit strings, the widgets of all listed toolkits are displayed or returned.

model2plot(axes_manager=None)
class hyperspy.signal_tools.SpanSelectorInSignal1D(signal)

Bases: traits.has_traits.HasTraits

property is_span_selector_valid
on_disabling_span_selector()
reset_span_selector()
span_selector_switch(on)
update_span_selector_traits(*args, **kwargs)
class hyperspy.signal_tools.SpikesRemoval(signal, navigation_mask=None, signal_mask=None)

Bases: hyperspy.signal_tools.SpanSelectorInSignal1D

_add_noise_changed(old, new)
_click_to_show_instructions_fired()
_index_changed(old, new)
_interpolator_kind_changed(old, new)
_reset_line()
_show_derivative_histogram_fired()
_spline_order_changed(old, new)
_ss_left_value_changed(old, new)
_ss_right_value_changed(old, new)
_threshold_changed(old, new)
apply()
create_interpolation_line()
detect_spike()
find(back=False)
get_interpolated_spectrum(axes_manager=None)
get_interpolation_range()
gui(display=True, toolkit=None, **kwargs)

Display or return interactive GUI element if available.

Parameters
  • display (bool) – If True, display the user interface widgets. If False, return the widgets container in a dictionary, usually for customisation or testing.

  • toolkit (str, iterable of strings or None) – If None (default), all available widgets are displayed or returned. If string, only the widgets of the selected toolkit are displayed if available. If an interable of toolkit strings, the widgets of all listed toolkits are displayed or returned.

interpolator = None
on_disabling_span_selector()
span_selector_changed()
update_plot()
update_spectrum_line()
hyperspy.signal_tools._get_background_estimator(background_type, polynomial_order=1)

Assign 1D component to specified background type.

Parameters
  • background_type (str) – The name of the component to model the background.

  • polynomial_order (int, optional) – The polynomial order used in the polynomial component

Raises

ValueError – When the background type is not a valid string.

Returns

  • background_estimator (Component1D) – The component mdeling the background.

  • bg_line_range (‘full’ or ‘from_left_range’) – The range to draw the component (used in the BackgroundRemoval tool)