Provide numpy-like constructors #23

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
@llvilanova
Contributor

llvilanova commented Sep 6, 2010

This should close bug fperez/datarray#19.

Lluís Vilanova
Provide two constructors, following numpy's semantics.
This provides numpy-like constructors:
     - array: create a new array from existing contents
     - DataArra: create a new array with given shape

This is meant to close bug http://github.com/fperez/datarray/issues/#issue/19
@fperez

This comment has been minimized.

Show comment
Hide comment
@fperez

fperez Oct 6, 2010

Collaborator

I tried to merge your code, but unfortunately it breaks the test suite very badly... We do have a couple of minor failures right now in trunk, but after applying your commit I get:

((98c5238...))maqroll[tests]> python -c 'import datarray;datarray.test()'
Running unit tests for datarray
NumPy version 1.3.0
NumPy is installed in /usr/lib/python2.6/dist-packages/numpy
Python version 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3]
nose version 0.11.1
.E..........F.EEEF.EFEFE......EEEEEEEEEEEEEEEEEEEEEEE..EEEEE
======================================================================
ERROR: Failure: ValueError (Dimension mismatch between ticks and data at index 0)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/nose/loader.py", line 224, in generate
    for test in g():
  File "/home/fperez/usr/opt/lib/python2.6/site-packages/datarray/testing/tests/test_utils.py", line 22, in test_assert_datarray_equal
    y = DataArray([1, 2], [('a', ['a', 'b'])])
  File "/home/fperez/usr/opt/lib/python2.6/site-packages/datarray/datarray.py", line 621, in __new__
    _init_axes(res, None, labels)
  File "/home/fperez/usr/opt/lib/python2.6/site-packages/datarray/datarray.py", line 452, in _init_axes
    axes.append(Axis(label, i, dest, ticks=ticks))
  File "/home/fperez/usr/opt/lib/python2.6/site-packages/datarray/datarray.py", line 82, in __init__
    self._tick_dict = self._validate_ticks(ticks)
  File "/home/fperez/usr/opt/lib/python2.6/site-packages/datarray/datarray.py", line 148, in _validate_ticks
    raise ValueError(e)
ValueError: Dimension mismatch between ticks and data at index 0


Lots more output, snipped...


======================================================================
FAIL: datarray.tests.test_data_array.test_1d(False,)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/nose/case.py", line 183, in runTest
    self.test(*self.arg)
AssertionError

----------------------------------------------------------------------
Ran 60 tests in 0.026s

FAILED (errors=35, failures=4)

Could you ensure that the test suite passes, at least at the level it passes in current trunk, and ping us again?

Thanks,

f

Collaborator

fperez commented Oct 6, 2010

I tried to merge your code, but unfortunately it breaks the test suite very badly... We do have a couple of minor failures right now in trunk, but after applying your commit I get:

((98c5238...))maqroll[tests]> python -c 'import datarray;datarray.test()'
Running unit tests for datarray
NumPy version 1.3.0
NumPy is installed in /usr/lib/python2.6/dist-packages/numpy
Python version 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3]
nose version 0.11.1
.E..........F.EEEF.EFEFE......EEEEEEEEEEEEEEEEEEEEEEE..EEEEE
======================================================================
ERROR: Failure: ValueError (Dimension mismatch between ticks and data at index 0)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/nose/loader.py", line 224, in generate
    for test in g():
  File "/home/fperez/usr/opt/lib/python2.6/site-packages/datarray/testing/tests/test_utils.py", line 22, in test_assert_datarray_equal
    y = DataArray([1, 2], [('a', ['a', 'b'])])
  File "/home/fperez/usr/opt/lib/python2.6/site-packages/datarray/datarray.py", line 621, in __new__
    _init_axes(res, None, labels)
  File "/home/fperez/usr/opt/lib/python2.6/site-packages/datarray/datarray.py", line 452, in _init_axes
    axes.append(Axis(label, i, dest, ticks=ticks))
  File "/home/fperez/usr/opt/lib/python2.6/site-packages/datarray/datarray.py", line 82, in __init__
    self._tick_dict = self._validate_ticks(ticks)
  File "/home/fperez/usr/opt/lib/python2.6/site-packages/datarray/datarray.py", line 148, in _validate_ticks
    raise ValueError(e)
ValueError: Dimension mismatch between ticks and data at index 0


Lots more output, snipped...


======================================================================
FAIL: datarray.tests.test_data_array.test_1d(False,)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/nose/case.py", line 183, in runTest
    self.test(*self.arg)
AssertionError

----------------------------------------------------------------------
Ran 60 tests in 0.026s

FAILED (errors=35, failures=4)

Could you ensure that the test suite passes, at least at the level it passes in current trunk, and ping us again?

Thanks,

f

@fperez

This comment has been minimized.

Show comment
Hide comment
@fperez

fperez Sep 20, 2015

Collaborator

Sorry, closing this...

Collaborator

fperez commented Sep 20, 2015

Sorry, closing this...

@fperez fperez closed this Sep 20, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment