Support single N-D Time and Quantity lookup tables in extra_coords#941
Open
nabobalis wants to merge 2 commits into
Open
Support single N-D Time and Quantity lookup tables in extra_coords#941nabobalis wants to merge 2 commits into
nabobalis wants to merge 2 commits into
Conversation
A single N-D table now represents one coordinate varying over N pixel dimensions, e.g. a 2-D Time table indexed by (raster scan, raster step). N-D table models expose their inputs in pixel order to match the APE-14 convention assumed by NDCube world-coordinate generation, and slicing drops integer-sliced axes from a table's axes when the table loses pixel dimensions. Also fixes a latent Length1Tabular dispatch bug for tables of shape (1, n).
nabobalis
commented
Jun 12, 2026
|
|
||
|
|
||
| @pytest.mark.xfail(reason=">1D Tables not supported") | ||
| def test_2d_nout_1_no_mesh(lut_2d_distance_no_mesh): |
nabobalis
commented
Jun 12, 2026
|
|
||
|
|
||
| @pytest.mark.xfail(reason=">1D Tables not supported") | ||
| def test_2d_nout_1_no_mesh_slice(lut_2d_distance_no_mesh): |
nabobalis
commented
Jun 12, 2026
|
|
||
|
|
||
| @pytest.mark.xfail(reason=">1D Tables not supported") | ||
| def test_mtc_dropped_quantity_table(lut_1d_time, lut_2d_distance_no_mesh): |
nabobalis
commented
Jun 12, 2026
|
|
||
|
|
||
| @pytest.mark.xfail(reason=">1D Tables not supported") | ||
| def test_mtc_dropped_quantity_inside_table_no_mesh(lut_2d_distance_no_mesh): |
nabobalis
commented
Jun 12, 2026
| ec_shape = cube.data.shape[1:3] | ||
| data = np.arange(np.prod(ec_shape)).reshape(ec_shape) * u.m / u.s | ||
|
|
||
| # The lookup table has to be in world order so transpose it. |
Member
Author
There was a problem hiding this comment.
Should this still be the case?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Description
TimeTableCoordinateandQuantityTableCoordinatenow accept a single N-Dtable, representing one physical coordinate that varies over N pixel
dimensions. For example, a 2-D
Timetable indexed by (raster scan, rasterstep) can now be attached with:
Previously
QuantityTableCoordinateraised "Currently all tables must be1-D" and
TimeTableCoordinatewas hardwired to one dimension, so per-exposuretimes on a multi-scan cube could not be expressed as an extra coord at all.
Implementation notes:
order).
NDCube._generate_world_coordstransposes world values assumingthe APE-14 pixel-axis convention, so an array-ordered model produces
transposed
axis_world_coordsoutput.ExtraCoords.mappingreverses theconverted axes for such coordinates to stay consistent (see the new
BaseTableCoordinate._model_inputs_are_pixel_orderedproperty).ExtraCoords._getitem_lookup_tablesnow drops integer-sliced axes from atable's axes tuple when the sliced table actually loses pixel dimensions.
Previously the axes tuple kept stale (even negative) entries; this was
latent for existing coordinate types but breaks N-D tables. Range slices
keep the table N-D, integer slices reduce it, and slicing away all table
dimensions drops the coordinate into
dropped_tablesas before.interpolatesupports N-D tables viascipy.interpolate.interpn(
TimeTableCoordinate.interpolatenow takes*new_array_grids, matchingthe other table coordinate types; the old single-grid call still works).
Length1Tabulardispatch bug: a table of shape(1, n)wasrouted to the length-1 1-D model because the check used
len(table) == 1instead of
table.shape == (1,).AI Assistance Disclosure
AI tools were used for: