[Dachs-support] iterOtherAxis error with transformation matrix
Ixaka Labadie
ixakalab at iaa.es
Fri Jun 14 16:20:37 CEST 2024
Thanks Markus,
I just edited the function by hand and it worked. I will inform you if I
try other options.
Best regards,
Ixaka
On 14/06/2024 07:52, Markus Demleitner wrote:
> Ixaka,
>
> On Thu, Jun 13, 2024 at 05:41:36PM +0200, Ixaka Labadie wrote:
>> I am testing a SODA-like service with 3D data where the spectral one can be
>> either wavelength or velocity.
>> I was using "fits_makeWCSParams()" with "axisMetaOverrides" = 3 but with
>> some new cubes I am getting an error.
>> I traced the error to "fitstools.WCSAxis.fromHeader()"
>> inĀ "iterOtherAxisKeys()", which raises a ValueError if the axis is mentioned
>> in the transformation matrix (CPi_j or PCi_j), which it is. The
>> transformation matrix is the identity matrix.
>>
>> I saw that this can be fixed with the "forceSeparable" argument but there is
>> no way to set it in "fits_makeWCSParams()". I could write a new
>> "dataFunction" myself or try using "fits_makeBandMeta" and
>> "fits_VelocityMeta" but with the latter option I do not know how to
>> differentiate between cubes with velocity or wavelength not to raise an
>> error.
>>
>> Is there a proper way to fix this?
> Probably not with the code as it is.
>
> However, after *a bit* of thought (disclaimer: it's been a while
> since I last played with cube WCS in any depth), it would seem to me
> that in protocols.soda.iterOtherAxisKeys, it is safe to pass
> forceSeparable to the WCSAxis constructor; after all, a human has
> asked for it.
>
> So, what happens if you apply the following patch?
>
> diff --git a/gavo/protocols/soda.py b/gavo/protocols/soda.py
> index a6933019..3f12c094 100644
> --- a/gavo/protocols/soda.py
> +++ b/gavo/protocols/soda.py
> @@ -194,7 +194,10 @@ def iterOtherAxisKeys(descriptor, axisMetaOverrides):
> continue
>
> try:
> - ax = fitstools.WCSAxis.fromHeader(descriptor.hdr, fitsAxis)
> + ax = fitstools.WCSAxis.fromHeader(
> + descriptor.hdr,
> + fitsAxis,
> + forceSeparable=True)
> except ValueError:
> # probably botched WCS, or an inseparable axis.
> # Just ignore this axis, operators can add it manually
>
> (well, just edit
> /usr/lib/python3/dist-packages/gavo/protocols/soda.py by hand; if you
> do want to use patch, in Debian it would be <become root> cd
> /usr/lib/python3/dist-packages/gavo/protocols/ patch -p 3 <
> /path/to/patch I think).
>
> If that doesn't do it, it would be great if you could prepare some
> reproducer with the RD and one header of each kind.
>
> Thanks,
>
> Markus
>
More information about the Dachs-support
mailing list