Skip to content

Record data size in the WCS object #5461

Closed

Description

@nden

It is clear that there are practical reasons to have a record of the original data size in the WCS object. This in the past has been recorded in public attributes naxis1 and naxis2 and subsequently in the private _naxis1 and _naxis2. There's along thread on why this should or should not be done in #4662.
More recently #5411 expanded this attribute to more than 2 axes. It also broke the ability to set the private attributes which was subsequently fixed in #5454 as a stop gap measure.

We need to fix this permanently starting with v 1.3. There are two proposed ways to do it.

  1. Add public naxisj attributes, populated by the FITS header NAXISj keywords.
  2. Introduce a subclass of WCS which adds those and leave the original WCS to represent strictly the FITS WCS standard and nothing more.

Either way a deprecation process will accompany the change.

The purpose of this issue is to collect votes. I don't want to start a new long discussion. Keep in mind that #4662 is available for reference and only share new arguments.

Since 1.3 is approaching we need to make a fast decision. So please share your preference here and volunteer for the work if possible.

Activity

  1. added this to the v1.3.0 milestone on Nov 4, 2016
  2. nden commented on Nov 4, 2016

    @nden
    ContributorAuthor

    I support #1 of the two choices for reasons I mentioned in #5454.

    In addition I want to mention that we already deviated from the FITS standard by adding the d2im distortion.

  3. saimn commented on Nov 7, 2016

    @saimn
    Contributor

    👍 for solution 1, for the reasons explained by @nden in #5411 (comment)

  4. MSeifert04 commented on Nov 13, 2016

    @MSeifert04
    Contributor

    hm, I'm sure that #4662 does not contain the extended discussion.

  5. mcara commented on Nov 24, 2016

    @mcara
    Contributor

    @MSeifert04 I think the "long discussion" was in #4669

  6. mcara commented on Nov 24, 2016

    @mcara
    Contributor

    👍 for solution 1

  7. mwcraig commented on Nov 28, 2016

    @mwcraig
    Member

    Also 👍 for solution 1. Looking forward to having those keywords update when I slice...

  8. astrofrog commented on Nov 29, 2016

    @astrofrog
    Member

    With apologies to @nden (who asked to not start a discussion), I want to make a case for option 2 (following discussion on e.g. #5455). But I'll keep it short.

    WCS objects allow slicing, including by floating-point values. For instance, I can do:

    In [5]: wcs[::0.2333,::0.2333]
    Out[5]: 
    WCS Keywords
    
    Number of WCS axes: 2
    CTYPE : 'GLON-CAR'  'GLAT-CAR'  
    CRVAL : 0.0  0.0  
    CRPIX : 1282.6603086155164  1281.6573081868839  
    NAXIS    : 599 599
    
    In [6]: wcs[::0.2333,::0.2333].wcs.cdelt
    Out[6]: array([-0.00038883,  0.00038883])
    
    In [7]: wcs.wcs.cdelt
    Out[7]: array([-0.00166667,  0.00166667])

    I can see the motivation for this and it looks like people are relying on this. However, this causes issues when the image size is present in the WCS because it's no longer possible to necessarily scale the image size to an integer size. So the presence or not of image dimensions changes how slicing works.

    Furthermore, another example where the presence/absence of image shape matters is negative indices. If I do wcs[::-1,::-1], this can only work if I have an image size.

    Because the slicing behaves so differently between the two cases, I'm 👍 on option 2 because it will allow the behavior to be more predictable and separates the two different use cases.

    Note: I didn't say that WCS has to be the 'pure' class though. WCS could be the class with image shape if there is a superclass that does not (we'd just need to find a good name). So just to be clear, there's a difference between separating the classes versus which one should be the 'default'.

  9. nden commented on Dec 1, 2016

    @nden
    ContributorAuthor

    @astrofrog My main concern is giving an option to users to choose between two classes when they want to implement a WCS pipeline for an instrument. How would I choose which one to subclass?

  10. astrofrog commented on Dec 1, 2016

    @astrofrog
    Member

    @nden - I see your point. It seems I'm in the minority anyway, so I'd say just go with the majority opinion rather than try and get everyone to agree :)

  11. modified the milestones: v1.3.0, v1.3.1 on Jan 4, 2017
  12. modified the milestones: v2.0.0, v1.3.1 on Feb 15, 2017
  13. modified the milestones: Future, v2.0.0 on Jun 12, 2017
  14. nden commented on Jun 12, 2017

    @nden
    ContributorAuthor

    It'd be good to coordinate the interface for this with the interface used in GWCS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions