diff --git a/src/mslice/plotting/plot_window/slice_plot.py b/src/mslice/plotting/plot_window/slice_plot.py index 820aedea..a5e377ca 100644 --- a/src/mslice/plotting/plot_window/slice_plot.py +++ b/src/mslice/plotting/plot_window/slice_plot.py @@ -438,7 +438,7 @@ def get_slice_cache(self): def get_cached_workspace(self): cached_slice = self.get_slice_cache() - return getattr(cached_slice, IntensityCache.get_slice_type(self.intensity_type)) + return getattr(cached_slice, self.intensity_type.name.lower()) def update_workspaces(self): self._slice_plotter_presenter.update_displayed_workspaces() diff --git a/src/mslice/presenters/slice_plotter_presenter.py b/src/mslice/presenters/slice_plotter_presenter.py index d9200b53..a796dd84 100644 --- a/src/mslice/presenters/slice_plotter_presenter.py +++ b/src/mslice/presenters/slice_plotter_presenter.py @@ -10,8 +10,6 @@ from mslice.models.workspacemanager.workspace_provider import get_workspace_handle from mslice.plotting.plot_window.overplot_interface import plot_overplot_line, remove_line from mslice.presenters.presenter_utility import PresenterUtility -from mslice.plotting.pyplot import CATEGORY_SLICE -from mslice.util.intensity_correction import IntensityType, IntensityCache class SlicePlotterPresenter(PresenterUtility): @@ -19,7 +17,6 @@ class SlicePlotterPresenter(PresenterUtility): def __init__(self): self._main_presenter = None self._slice_cache = {} - self._cache_intensity_correction_methods() def plot_slice(self, selected_ws, x_axis, y_axis, intensity_start, intensity_end, norm_to_one, colourmap): workspace = get_workspace_handle(selected_ws) @@ -115,19 +112,3 @@ def set_sample_temperature(self, workspace_name, temp): def workspace_selection_changed(self): pass - - def _cache_intensity_correction_methods(self): - cat = CATEGORY_SLICE - IntensityCache.cache_method(cat, IntensityType.SCATTERING_FUNCTION, self.show_scattering_function) - IntensityCache.cache_method(cat, IntensityType.CHI, self.show_dynamical_susceptibility) - IntensityCache.cache_method(cat, IntensityType.CHI_MAGNETIC, - self.show_dynamical_susceptibility_magnetic) - IntensityCache.cache_method(cat, IntensityType.D2SIGMA, self.show_d2sigma) - IntensityCache.cache_method(cat, IntensityType.SYMMETRISED, self.show_symmetrised) - IntensityCache.cache_method(cat, IntensityType.GDOS, self.show_gdos) - IntensityCache.cache_slice_type(IntensityType.SCATTERING_FUNCTION, "scattering_function") - IntensityCache.cache_slice_type(IntensityType.CHI, "chi") - IntensityCache.cache_slice_type(IntensityType.CHI_MAGNETIC, "chi_magnetic") - IntensityCache.cache_slice_type(IntensityType.D2SIGMA, "d2sigma") - IntensityCache.cache_slice_type(IntensityType.SYMMETRISED, "symmetrised") - IntensityCache.cache_slice_type(IntensityType.GDOS, "gdos") diff --git a/src/mslice/util/intensity_correction.py b/src/mslice/util/intensity_correction.py index 55c3200a..288cb4fd 100644 --- a/src/mslice/util/intensity_correction.py +++ b/src/mslice/util/intensity_correction.py @@ -15,7 +15,6 @@ class IntensityCache: __action_dict = {} __method_dict_cut = {} __method_dict_slice = {} - __slice_cache_type = {} __description_dict = {IntensityType.SCATTERING_FUNCTION: "scattering_function", IntensityType.CHI: "dynamical_susceptibility", IntensityType.CHI_MAGNETIC: "dynamical_susceptibility_magnetic", @@ -63,17 +62,6 @@ def get_method(cls, category, intensity_correction_type): else: raise KeyError("method related to the intensity correction type not found") - @classmethod - def cache_slice_type(cls, intensity_correction_type, name): - if intensity_correction_type not in cls.__slice_cache_type: - cls.__slice_cache_type[intensity_correction_type] = name - - @classmethod - def get_slice_type(cls, intensity_correction_type): - if intensity_correction_type not in cls.__slice_cache_type: - raise KeyError("intensity correction cached type not found") - return cls.__slice_cache_type[intensity_correction_type] - @classmethod def get_intensity_type_from_desc(cls, description): if description in cls._IntensityCache__description_dict.values():