Skip to content

Commit

Permalink
Merge pull request #66 from ericpre/hyperspy2.0
Browse files Browse the repository at this point in the history
Hyperspy 2.0
  • Loading branch information
ericpre authored Oct 29, 2023
2 parents b48aa52 + 810af75 commit 732caf3
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 9 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,18 @@ jobs:
PIP_SELECTOR: '[tests, coverage]'
LABEL: -RnMajor-coverage
PYTEST_ARGS_COVERAGE: --cov=. --cov-report=xml
- os: ubuntu
PYTHON_VERSION: '3.8'
- PYTHON_VERSION: '3.8'
OLDEST_SUPPORTED_VERSION: true
# Matching setup.py
DEPENDENCIES: traits==5.0 traitsui==6.1 pyqt5==5.12.0
PIP_SELECTOR: '[tests]'
# Hang at the end of the test suite run...
#PYTEST_ARGS_COVERAGE: --cov=. --cov-report=xml
LABEL: -RnMajor-oldest
- PYTHON_VERSION: '3.8'
PIP_ARGS: --pre --upgrade
LABEL: -mininum-RnMajor
PIP_SELECTOR: '[tests]'

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -91,6 +94,12 @@ jobs:
run: |
pip install https://github.com/hyperspy/hyperspy/archive/RELEASE_next_patch.zip
- name: Install exSpy
if: "!contains( matrix.LABEL, 'mininum')"
shell: bash
run: |
pip install https://github.com/hyperspy/exspy/archive/main.zip
- name: Install Dependencies
run: |
pip install pyqt5
Expand Down
9 changes: 6 additions & 3 deletions hyperspy_gui_traitsui/hyperspy_extension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ GUI:
hyperspy.Preferences:
module: hyperspy_gui_traitsui.preferences
function: preferences_traitsui
exspy.Preferences:
module: hyperspy_gui_traitsui.preferences
function: exspy_preferences_traitsui
hyperspy.DataAxis:
module: hyperspy_gui_traitsui.axes
function: axis_gui
Expand Down Expand Up @@ -55,13 +58,13 @@ GUI:
hyperspy.Model1D.fit_component:
module: hyperspy_gui_traitsui.model
function: fit_component_traitsui
hyperspy.microscope_parameters_EELS:
exspy.microscope_parameters_EELS:
module: hyperspy_gui_traitsui.microscope_parameters
function: microscope_parameters_EELS
hyperspy.microscope_parameters_EDS_SEM:
exspy.microscope_parameters_EDS_SEM:
module: hyperspy_gui_traitsui.microscope_parameters
function: microscope_parameters_EDS_SEM
hyperspy.microscope_parameters_EDS_TEM:
exspy.microscope_parameters_EDS_TEM:
module: hyperspy_gui_traitsui.microscope_parameters
function: microscope_parameters_EDS_TEM
hyperspy.SpanROI:
Expand Down
16 changes: 14 additions & 2 deletions hyperspy_gui_traitsui/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ def save(self, info):
label='GUIs'),
tui.Group(tui.Item('Plot', style='custom', show_label=False, ),
label='Plot'),
title='Preferences',
buttons=[SaveButton, CancelButton],
handler=PreferencesHandler,)


@add_display_arg
def preferences_traitsui(obj, **kwargs):
obj.trait_view("traits_view", PREFERENCES_VIEW)
return obj, {}


EXSPY_PREFERENCES_VIEW = tui.View(
tui.Group(tui.Item('EELS', style='custom', show_label=False, ),
label='EELS'),
tui.Group(tui.Item('EDS', style='custom', show_label=False, ),
Expand All @@ -29,6 +41,6 @@ def save(self, info):


@add_display_arg
def preferences_traitsui(obj, **kwargs):
obj.trait_view("traits_view", PREFERENCES_VIEW)
def exspy_preferences_traitsui(obj, **kwargs):
obj.trait_view("traits_view", EXSPY_PREFERENCES_VIEW)
return obj, {}
5 changes: 3 additions & 2 deletions hyperspy_gui_traitsui/tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# along with HyperSpy. If not, see <http://www.gnu.org/licenses/>.

import numpy as np
import pytest

import hyperspy.api as hs
from hyperspy.signal_tools import (
Expand Down Expand Up @@ -54,8 +55,8 @@ def test_image_contrast_tool():


def test_remove_background_tool():

s = hs.datasets.artificial_data.get_core_loss_eels_signal(True, False)
exspy = pytest.importorskip("exspy")
s = exspy.data.EELS_MnFe(True, False)
s.plot()

BgR = BackgroundRemoval(s)
Expand Down

0 comments on commit 732caf3

Please sign in to comment.