Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NDCubeSequence.cube_like_dimensions Bug #785

Open
PCJY opened this issue Nov 20, 2024 · 0 comments
Open

NDCubeSequence.cube_like_dimensions Bug #785

PCJY opened this issue Nov 20, 2024 · 0 comments

Comments

@PCJY
Copy link

PCJY commented Nov 20, 2024

Describe the bug

When I call NDCubeSequence.cube_like_dimensions, it raises an error. With the following traceback:

Traceback (most recent call last):
  File "C:\Users\junya\ndcube-sandbox\SliceSequence.py", line 66, in <module>
    print('hereeeeeee',my_sequence.cube_like_dimensions)
  File "C:\Users\junya\ndcube-git\ndcube\ndcube_sequence.py", line 87, in cube_like_dimensions
    dimensions = list(self._dimensions)
AttributeError: 'NDCubeSequence' object has no attribute '_dimensions'. Did you mean: 'dimensions'?

To Reproduce

import astropy.units as u

import astropy.wcs

import numpy as np

from ndcube import NDCube, NDCubeSequence

# Define data arrays.

shape = (4, 4, 5)

data0 = np.random.rand(*shape)

data1 = np.random.rand(*shape)

data2 = np.random.rand(*shape)

data3 = np.random.rand(*shape)

# Define WCS transformations. Let all cubes have same WCS.

wcs = astropy.wcs.WCS(naxis=3)

wcs.wcs.ctype = 'WAVE', 'HPLT-TAN', 'HPLN-TAN'

wcs.wcs.cunit = 'Angstrom', 'deg', 'deg'

wcs.wcs.cdelt = 0.2, 0.5, 0.4

wcs.wcs.crpix = 0, 2, 2

wcs.wcs.crval = 10, 0.5, 1

# Instantiate NDCubes.

cube0 = NDCube(data0, wcs=wcs)

cube1 = NDCube(data1, wcs=wcs)

cube2 = NDCube(data2, wcs=wcs)

cube3 = NDCube(data3, wcs=wcs)

# Instantiate NDCubeSequence. Let the common axis be 0.

my_sequence = NDCubeSequence([cube0, cube1, cube2, cube3], common_axis=0)

print(my_sequence.cube_like_dimensions)

Screenshots

No response

System Details

ndcube dev version

Installation method

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant