`ExtraCoords` half works if not attached to a `NDCube`
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start in ndcube/extra_coords/extra_coords.py at ExtraCoords.mapping, then run the standalone reproduction using ExtraCoords.from_lookup_tables and compare ec.wcs with ec.mapping. Determine and document the intended behavior for an ExtraCoords object without an attached NDCube, and add tests covering that behavior.
Written by the indexing model from the issue text.
Description
Describe the bug
I came across this due to this conversation. We should decide what we want the behaviour to be for a standalone ExtraCoords object.
To Reproduce
import astropy.units as u
from ndcube import ExtraCoords
ec = ExtraCoords.from_lookup_tables(('hello', 'bye'),
(1, 1),
(list(range(3)) * u.m,
list(range(3)) * u.keV,
)
)
ec.wcs
<WCS(output_frame=CompositeFrame, input_frame=PixelFrame, forward_transform=Model: CompoundModel
Inputs: ('x0', 'x1')
Outputs: ('y0', 'y1')
Model set size: 1
Expression: [0] & [1]
Components:
[0]: <Tabular1D(points=(<Quantity [0., 1., 2.] pix>,), lookup_table=[0. 1. 2.] m)>
[1]: <Tabular1D(points=(<Quantity [0., 1., 2.] pix>,), lookup_table=[0. 1. 2.] keV)>
Parameters:)>
ec.mapping
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[6], line 1
----> 1 ec.mapping
File ~/Git/ndcube/ndcube/extra_coords/extra_coords.py:264, in ExtraCoords.mapping(self)
261 # The mapping is from the array index (position in the list) to the
262 # pixel dimensions (numbers in the list)
263 lts = [list([lt[0]] if isinstance(lt[0], Integral) else lt[0]) for lt in self._lookup_tables]
--> 264 converter = partial(convert_between_array_and_pixel_axes, naxes=len(self._ndcube.shape))
265 pixel_indicies = [list(converter(np.array(ids))) for ids in lts]
266 return tuple(reduce(list.__add__, pixel_indicies))
AttributeError: 'NoneType' object has no attribute 'shape'
Screenshots
No response
System Details
No response
Installation method
No response
- Dominant language
- Python
- Stars
- 49
- Forks
- 56
- Avg merge
- 5h 54m
- Merged PRs (30d)
- 9
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sunpy/ndcube
-
Bug
Difficulty 4/5 3-5 days Newbie friendliness 38/100
-
Bug
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Feature Request
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Feature Request
Difficulty 4/5 3-5 days Newbie friendliness 42/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100