Closed astrofrog closed 1 year ago
@astrofrog some cases with result
shapes like (1, N)
needed an extra check to pass.
broadcast_to
should have outlived its existence for some time now, although since it's not strictly private, there's perhaps some small risk to break something downstream (I did test glue-jupyter and glue-astronomy against this branch).
@dhomeier - I had to revert https://github.com/glue-viz/glue/pull/2345/commits/a1d114c3ec11f99478189abaf162b96684cef7c7 in my latest commit - what use case required your fix?
This for example – result
at that point was created from e.g. a length-3 array, but constructed as shape (1, 3)
, so the slicing result[0]
was still required.
https://github.com/glue-viz/glue/actions/runs/3687605543/jobs/6241424695#step:9:584 or
https://github.com/glue-viz/glue/actions/runs/3903134088/jobs/6667109278#step:9:389
Maybe have to check additionally for something like result.shape[0] == 1
– what case was failing for you with the old commit?
Still a WIP, but getting closer
@dhomeier the remaining issue was that IdentityCoordinates, for single coordinates, should return a scalar or array, not a tuple with one element (this is prescribed by the APE 14 API)
Yes, that seemed weird, but it wasn't clear to me that came from inside glue.
But are you sure it is always a tuple? The self.pixel_n_dim == 1
case still does not seem to catch it.
a1d114c was triggered on np.ndim(result) > 1
, that would mean that value is different from self.pixel_n_dim
?
But are you sure it is always a tuple?
In principle APE 14 mandates that a tuple is returned if there are >coordinates. But there may still be cases where this doesn't happen?
The self.pixel_n_dim == 1 case still does not seem to catch it.
Is there a test failure still where this is not caught? Or can you come up with a failing example?
Is there a test failure still where this is not caught? Or can you come up with a failing example?
Strangely it seems to pass in most of the py310 envs, but none of the others. But on my Mac it's passing Pythons 3.9-3.11... Very weird. I thought about directly testing for a tuple, but that is failing elsewhere.
I think this should be fixed - it was an issue with LegacyCoordinates. Not quite sure why it would fail only on some Python versions though... Let's see if the CI is happy.
I think this broke Jdaviz, see log at https://github.com/spacetelescope/jdaviz/actions/runs/3954350017/jobs/6771598108
ValueError: input operand has more dimensions than allowed by the axis remapping
Investigating!
Seems they are all failing on glue_astronomy.spectral_coordinates.SpectralCoordinates
instances of shape (1, N)
which are using their own pixel_to_world_values
method (even if they were subclassed on LegacyCoordinates
).
In principle APE 14 mandates that a tuple is returned if there are >coordinates. But there may still be cases where this doesn't happen?
Does this mean it must not return a tuple for the single coordinate case? Specifically should
SpectralCoordinates
withn_dim=1
always returnnp.interp(...)[0]
ortuple(np.interp(...)[0])
? Either change does fix thejdaviz
tests.
I have fixed this in a glue-astronomy PR, could you take a look at it? (Can't link to it on phone)
glue-core needs a release. We see failure in Jdaviz now because glue-astronomy is released but not this PR.
These are the updates currently in
But in addition there is a new regression in
Found this while working on the tick labels in profile viewer.