diff --git a/sidpy/sid/dataset.py b/sidpy/sid/dataset.py index 58cc6bf2..2ce7743c 100644 --- a/sidpy/sid/dataset.py +++ b/sidpy/sid/dataset.py @@ -651,7 +651,7 @@ def plot(self, verbose=False, figure=None, **kwargs): raise NotImplementedError('Datasets with data_type {} cannot be plotted, yet.'.format(self.data_type)) elif len(self.shape) == 3: if verbose: - print('3D dataset') + print('3D dataset:', self.data_type) if self.data_type == DataType.IMAGE: self.view = ImageVisualizer(self, figure=figure, **kwargs) elif self.data_type == DataType.IMAGE_MAP: @@ -663,6 +663,12 @@ def plot(self, verbose=False, figure=None, **kwargs): self.view = ComplexSpectralImageVisualizer(self, figure=figure, **kwargs) else: self.view = SpectralImageVisualizer(self, figure=figure, **kwargs) + elif self.data_type.name == 'SPECTRAL_IMAGE': + print('spec3') + if 'complex' in self.dtype.name: + self.view = ComplexSpectralImageVisualizer(self, figure=figure, **kwargs) + else: + self.view = SpectralImageVisualizer(self, figure=figure, **kwargs) elif self.data_type == DataType.POINT_CLOUD: self.view = PointCloudVisualizer(self, figure=figure, **kwargs) else: diff --git a/sidpy/viz/dataset_viz.py b/sidpy/viz/dataset_viz.py index e53d46be..506aff55 100644 --- a/sidpy/viz/dataset_viz.py +++ b/sidpy/viz/dataset_viz.py @@ -957,10 +957,6 @@ def __init__(self, dset, figure=None, horizontal=True, **kwargs): self.button.observe(self._pw_uw, 'value') #pixel or unit wise - widg = ipywidgets.HBox([self.button]) - #widg - display(widg) - def _pw_uw(self, event): pw_uw = event.new self.update_image(pw_uw) diff --git a/tests/sid/test_dataset.py b/tests/sid/test_dataset.py index f1bf0ece..3bd73b62 100644 --- a/tests/sid/test_dataset.py +++ b/tests/sid/test_dataset.py @@ -6,7 +6,6 @@ """ from __future__ import division, print_function, unicode_literals, \ absolute_import -from os import name import unittest import numpy as np @@ -14,11 +13,11 @@ import string import ase.build import sys -from copy import copy, deepcopy +from copy import deepcopy sys.path.insert(0, "../../sidpy/") -from sidpy.sid.dimension import Dimension, DimensionType +from sidpy.sid.dimension import Dimension from sidpy.sid.dataset import DataType, Dataset if sys.version_info.major == 3: @@ -176,7 +175,6 @@ def test_dset_with_variance(self): validate_dataset_properties(self, descriptor, values, variance=variance) - class TestDatasetConstructor(unittest.TestCase): def test_minimal_inputs(self): @@ -428,13 +426,14 @@ def test_changing_size(self): def test_variance(self): values = np.ones([4, 5]) - var = np.random.normal(size=(4,5)) + var = np.random.normal(size=(4, 5)) source_dset = Dataset.from_array(values, variance=var) descriptor = source_dset.like_data(values) self.assertEqual(descriptor.variance, None) descriptor = source_dset.like_data(values, variance=var) self.assertEqual(descriptor.variance.all(), source_dset.variance.all()) + class TestCopy(unittest.TestCase): def test_minimal_inputs(self): @@ -701,7 +700,7 @@ def test_any_keepdims_multiple_axes(self): keepdims_multiple_axes_test(self, 'any', title_prefix='any_aggregate_') -class Testminmethod(unittest.TestCase): +class TestMinMethod(unittest.TestCase): def test_min_single_axis(self): single_axis_test(self, 'min', title_prefix='min_aggregate_') @@ -715,7 +714,7 @@ def test_min_keepdims_multiple_axes(self): keepdims_multiple_axes_test(self, 'min', title_prefix='min_aggregate_') -class Testmaxmethod(unittest.TestCase): +class TestMaxMethod(unittest.TestCase): def test_max_single_axis(self): single_axis_test(self, 'max', title_prefix='max_aggregate_') @@ -729,7 +728,7 @@ def test_min_keepdims_multiple_axes(self): keepdims_multiple_axes_test(self, 'max', title_prefix='max_aggregate_') -class Testsummethod(unittest.TestCase): +class TestSumMethod(unittest.TestCase): def test_sum_single_axis(self): single_axis_test(self, 'sum', title_prefix='sum_aggregate_') @@ -747,7 +746,7 @@ def test_sum_dtype(self): pass -class Testmeanmethod(unittest.TestCase): +class TestMeanMethod(unittest.TestCase): def test_mean_single_axis(self): single_axis_test(self, 'mean', title_prefix='mean_aggregate_')