epyr.baseline.interactive

Interactive region selection for baseline correction.

This module provides matplotlib-based interactive widgets for selecting baseline regions in Jupyter notebooks and desktop environments.

Functions

close_selector_window()

Utility function to close RegionSelector windows in Jupyter notebooks.

interactive_select_regions_1d(x, y[, title])

Convenience function for interactive 1D region selection.

interactive_select_regions_2d(x, y, z[, title])

Convenience function for interactive 2D region selection.

is_interactive_available()

Check if interactive selection is available in the current environment.

jupyter_help()

Display help for using interactive region selection in Jupyter notebooks.

setup_interactive_backend()

Set up the best available interactive backend for the current environment.

Classes

RegionSelector()

Interactive region selector for baseline correction.

class epyr.baseline.interactive.RegionSelector[source]

Interactive region selector for baseline correction.

This class provides matplotlib-based interactive region selection for both 1D and 2D EPR data. It handles matplotlib version compatibility and provides multiple methods to close selection windows.

__init__()[source]
finish_selection()[source]

Manually finish selection and close plot.

select_regions_1d(x, y, title='Select regions to EXCLUDE from baseline fitting')[source]

Interactive selection of 1D regions.

Parameters:
  • x – X-axis data

  • y – Y-axis data

  • title – Plot title with instructions

Returns:

Selected regions as [(x1, x2), …]

Return type:

list

select_regions_2d(x, y, z, title='Select regions to EXCLUDE from baseline fitting')[source]

Interactive selection of 2D regions.

Parameters:
  • x – X-axis coordinates (1D array or meshgrid)

  • y – Y-axis coordinates (1D array or meshgrid)

  • z – 2D data array

  • title – Plot title with instructions

Returns:

Selected regions as [((x1,x2), (y1,y2)), …]

Return type:

list

epyr.baseline.interactive.interactive_select_regions_1d(x, y, title='Select regions to EXCLUDE from baseline fitting')[source]

Convenience function for interactive 1D region selection.

Parameters:
  • x – X-axis data

  • y – Y-axis data

  • title – Plot title

Returns:

Selected regions as [(x1, x2), …]

Return type:

list

epyr.baseline.interactive.interactive_select_regions_2d(x, y, z, title='Select regions to EXCLUDE from baseline fitting')[source]

Convenience function for interactive 2D region selection.

Parameters:
  • x – X-axis coordinates

  • y – Y-axis coordinates

  • z – 2D data array

  • title – Plot title

Returns:

Selected regions as [((x1,x2), (y1,y2)), …]

Return type:

list

epyr.baseline.interactive.close_selector_window()[source]

Utility function to close RegionSelector windows in Jupyter notebooks.

Use this if the interactive region selector gets stuck or won’t close.

epyr.baseline.interactive.jupyter_help()[source]

Display help for using interactive region selection in Jupyter notebooks.

epyr.baseline.interactive.is_interactive_available()[source]

Check if interactive selection is available in the current environment.

Returns:

True if interactive selection should work

Return type:

bool

epyr.baseline.interactive.setup_interactive_backend()[source]

Set up the best available interactive backend for the current environment.