pycroscopy / sidpy

Python utilities for storing, processing, and visualizing spectroscopic and imaging data
https://pycroscopy.github.io/sidpy/
MIT License
11 stars 14 forks source link

Dimension not working when extending Numpy array #61

Closed ssomnath closed 4 years ago

ssomnath commented 4 years ago

@gduscher - The switch to extending numpy array for Dimension broke all unit tests. We have to fix whatever is necessary to get the tests to work again before the gerd_dev branch can be merged into master. I haven't spent much time on this topic yet but I tried a handful of very simple instantiations and all of them failed. See below:

>>> sidpy.Dimension(np.arange(4), "hello")
Traceback (most recent call last):
  File "/anaconda/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 3326, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-8-5a256713eea0>", line 1, in <module>
    sidpy.Dimension(np.arange(4), "hello")
  File "/anaconda/lib/python3.5/site-packages/sidpy/sid/dimension.py", line 53, in __init__
    self.name = name
  File "/anaconda/lib/python3.5/site-packages/sidpy/sid/dimension.py", line 66, in name
    self._name = validate_single_string_arg(value, 'name')
  File "/anaconda/lib/python3.5/site-packages/sidpy/base/string_utils.py", line 165, in validate_single_string_arg
    raise TypeError(name + ' should be a string')
TypeError: name should be a string

>>> sidpy.Dimension(np.arange(4), name="hello")
Traceback (most recent call last):
  File "/anaconda/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 3326, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-9-d369ee763d15>", line 1, in <module>
    sidpy.Dimension(np.arange(4), name="hello")
TypeError: __init__() got multiple values for argument 'name'

>>> sidpy.Dimension(5, name="hello")
Traceback (most recent call last):
  File "/anaconda/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 3326, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-10-be94113a21d0>", line 1, in <module>
    sidpy.Dimension(5, name="hello")
TypeError: __init__() got multiple values for argument 'name'

>>> sidpy.Dimension(5)
Traceback (most recent call last):
  File "/anaconda/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 3326, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-11-af1343755764>", line 1, in <module>
    sidpy.Dimension(5)
TypeError: __init__() missing 1 required positional argument: 'values'
ssomnath commented 4 years ago

Addressed in #73