Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frames from Shipp et al 2019 #325

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

nstarman
Copy link
Contributor

@nstarman nstarman commented Jun 26, 2023

Is this is of interest?

Couple possible simplifications:

  • common base class
  • use format_doc to simplify the docstrings

Checklist

  • Did you add tests?
  • Did you add documentation for your changes?
  • Did you reference any relevant issues?
  • Did you add a changelog entry? (see CHANGES.rst)
  • Are the CI tests passing?
  • Is the milestone set?

@adrn
Copy link
Owner

adrn commented Jun 29, 2023

Sure! I think there is some duplication with Cecilia's work in galstreams, but one doesn't always need the full galstreams footprint, so I'm happy to include these here. I left one question as a code comment for consideration. I was about to say "can you make a common base class to simplify all the boilerplate code?" but just noticed you said that in your opening comments :). But yes, please do that! I think it makes sense to have something like a "BaseStreamFrame" or something.

@adrn adrn added this to the v1.7 milestone Jun 29, 2023
@adrn
Copy link
Owner

adrn commented Jun 29, 2023

Oh, and could you add a changelog entry? Thanks for this!

Signed-off-by: Nathaniel Starkman <nstarman@users.noreply.github.com>
Signed-off-by: nstarman <nstarman@users.noreply.github.com>
@nstarman
Copy link
Contributor Author

I made a common base class, but only applied it to the new frames. I didn't want to refactor other frames, which are different in small details (e.g. the representation wrapping mechanics).

Also, what tests do you think should be added? I was thinking at minimum adding 2 point tests that a) the origin and b) a point on the stream map to the correct coordinates in ICRS vs the stream frame.

Possible followups are:

  • moving the other frames to _builtin_frames (or the contents of _builtin_frames out, depending on how you want to PEP8 this)
  • use BaseStreamFrame for other frames.

@adrn adrn modified the milestones: v1.7, v1.8 Aug 15, 2023
@adrn
Copy link
Owner

adrn commented Dec 13, 2023

I totally forgot about this! I'm going to release v1.8 this week -- should we get this in? Rebase and remove the draft status?

@nstarman
Copy link
Contributor Author

nstarman commented Dec 15, 2023

Hm. I've discovered some inconsistencies. The rotation matrices in this PR are from https://iopscience.iop.org/article/10.3847/1538-4357/ab44bf/pdf.
To make the tests I went to https://iopscience.iop.org/article/10.3847/1538-4357/aacdab/pdf, the paper that includes a pole and two end-points on the stream. The endpoints should end up with phi2 of 0.

Highlighting the Atlas frame:

>>> c = ICRS(ra=-6.3 * u.deg, dec=-59.7 * u.deg)
>>> c.transform_to(AtlasShipp19())
<AtlasShipp19 Coordinate: (phi1, phi2) in deg
    (-8.64534171, -35.83870908)>

I thought one possibility is that the rotation matrix and all coordinates are actually FK5 (not ICRS) because the poles and endpoints in https://iopscience.iop.org/article/10.3847/1538-4357/aacdab/pdf are all listed as alpha2000, dec2000. While this might be true (and if it is then this PR needs updated), it doesn't fix the issue. Nor does transposing the rotation matrix to address an active versus passive transformation difference between the paper and Astropy's machinery.

When I define a GreatCircleICRS from the endpoints and test the pole it is much better (but still a little off suggesting rounding differences). So there is internal consistency in https://iopscience.iop.org/article/10.3847/1538-4357/aacdab/pdf, but I'm not getting how that translated into https://iopscience.iop.org/article/10.3847/1538-4357/ab44bf/pdf. Let's ask!

CleanShot 2023-12-14 at 22 10 07@2x

There's something strange happening with the rotation matrix.

@nstarman
Copy link
Contributor Author

As a related note, directly specifying a rotation matrix is inferior to defining the matrix from end-points, the pole, Euler angles, etc, because the rotation matrix must be SO(3) and due to numerical precision none actually are. This normally isn't an issue, but specifying a rotation matrix with float64 precision means that it isn't a rotation matrix for arbitrary-precision math! At some point we should address this in Astropy and downstream, where it should be possible to increase (or decrease) the precision of everything. In the meantime, I can change the classes to be ...Shipp18 and use the endpoints. Is that worth it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants