Skip to content

Commit

Permalink
Merge pull request #199 from pycroscopy/gerd4
Browse files Browse the repository at this point in the history
update visualizer
  • Loading branch information
gduscher authored Jan 20, 2024
2 parents fb94bdc + ab95f3b commit 375e216
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
8 changes: 7 additions & 1 deletion sidpy/sid/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
4 changes: 0 additions & 4 deletions sidpy/viz/dataset_viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 8 additions & 9 deletions tests/sid/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@
"""
from __future__ import division, print_function, unicode_literals, \
absolute_import
from os import name
import unittest

import numpy as np
import dask.array as da
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:
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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_')

Expand All @@ -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_')

Expand All @@ -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_')

Expand All @@ -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_')

Expand Down

0 comments on commit 375e216

Please sign in to comment.