Skip to content

Use EarthLocation instead of GCRS position for TETE observer. - #11061

Merged
mhvk merged 2 commits into
astropy:masterfrom
mhvk:tete-location
Nov 20, 2020
Merged

mhvk merged 2 commits into
astropy:masterfrom
mhvk:tete-location

Conversation

@mhvk

@mhvk mhvk commented Nov 19, 2020

Copy link
Copy Markdown
Contributor

As discussed in #10994 and #10996, the TETE frame that was introduced for 4.2 should more logically use EarthLocation to indicate the location of the observer, instead of obsgeoloc and obsgeovel. This PR makes that change.

One important question is whether this can still be included in 4.2, even though it is very late. The main advantage is that in that case we do not have to deprecate obsgeoloc and obsgeovel. (The PR is only a bug fix in this regard.)

Input from @astropy/core-release-maintainers much appreciated!!

cc @mkbrewer, @StuartLittlefair

@mhvk mhvk added Bug coordinates Affects-dev PRs and issues that do not impact an existing Astropy release labels Nov 19, 2020
@mhvk mhvk added this to the v4.2 milestone Nov 19, 2020
@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GCRS, TETE)
def gcrs_to_tete(gcrs_coo, tete_frame):
# first apply GCRS self transform to correct time and observatory position/velocity
obsgeoloc, obsgeovel = tete_frame.location.get_gcrs_posvel(tete_frame.obstime)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely not the way to go here. You are calculating the BPN matrix twice. This should be done in the same manner as gcrs_to_cirs().

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is why I liked @StuartLittlefair's EarthLocation.get_posvel() method.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, that makes sense. I'll adjust. There is also a real failure in comparison with horizons, so I may be missing more than this...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be sure, is there still a benefit from having the GCRS<->TETE conversion explicitly defined?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(On get_posvel(): only useful if we stick with obsgeoloc, obsgeovel for GCRS...)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On obsgeopos/vel, I think it is mostly a question of whether it should instead be a GCRS instance that holds the position/velocity. Anyway, that is for #10996!

@mhvk mhvk Nov 19, 2020 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p.s. Note that what I'm doing in the new commit is not really quite equivalent to get_gcrs_posvel(rbpn=None) -- am I still missing the main speed-up?

@mkbrewer mkbrewer Nov 19, 2020 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it basically is. It's just that it requires another function whereas all of this could be incorporated into a single EarthLocation.get_gcrs_posvel(rpbn=None) method. Anyway, this looks good for now.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main way to speed this up would be to chain matrices together; since we know this is a transform at the same obstime we are just doing rotations to get from ITRS->GCRS so you can avoid some of the flexibility of transform_to.

You could pass a list - in the correct order - of already calculated matrices to transform ITRS into GCRS like so:

matrix_chain = [matrix_transpose(tete_to_itrs_mat(frame.obstime)), rbpn]
loc_gcrs = get_location_gcrs(frame, matrix_chain)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, that could just be

itrs_to_gcrs = matrix_transpose(tete_to_itrs_mat(frame.obstime) @ rbpn)
loc_gcrs = get_location_gcrs(frame, itrs_to_gcrs))

with indeed a simpler get_location_gcrs. (I may have swapped things...)

Comment thread astropy/coordinates/builtin_frames/intermediate_rotation_transforms.py Outdated

@StuartLittlefair StuartLittlefair left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! Some minor nit-picks but the code is fine IMO.

Comment thread astropy/coordinates/builtin_frames/icrs_cirs_transforms.py Outdated
Comment thread astropy/coordinates/builtin_frames/intermediate_rotation_transforms.py Outdated
@mhvk

mhvk commented Nov 19, 2020

Copy link
Copy Markdown
Contributor Author

Note to self: this will need a separate PR to backport to 4.2, since I now use stuff from #10994.

@mkbrewer

Copy link
Copy Markdown
Contributor

Well, that could be avoided by including #10994 in the yet to be released 4.2.

@mkbrewer

Copy link
Copy Markdown
Contributor

#10994 and this are really one package, after all.

@mhvk

mhvk commented Nov 20, 2020

Copy link
Copy Markdown
Contributor Author

I'll merge this and first of all make a back-port of just this to 4.2, since it is super self-contained, not changing any behaviour, and with, I think, next to zero risk of introducing new problems. But I'm happy to make an alternative that includes #10994.

@mhvk
mhvk merged commit 0d4d65f into astropy:master Nov 20, 2020
@mhvk
mhvk deleted the tete-location branch November 20, 2020 00:13
mhvk added a commit to mhvk/astropy that referenced this pull request Nov 20, 2020
Use EarthLocation instead of GCRS position for TETE observer.
mhvk added a commit to mhvk/astropy that referenced this pull request Nov 20, 2020
Use EarthLocation instead of GCRS position for TETE observer.
@mhvk

mhvk commented Nov 20, 2020

Copy link
Copy Markdown
Contributor Author

Hmm, but a backport without #10994 breaks accuracy tests for TETE... (the backport can be seen at #11065). So, I think a backport is perhaps just too late (though I made one just in case at #11064)

mhvk added a commit to mhvk/astropy that referenced this pull request Nov 20, 2020
Use EarthLocation instead of GCRS position for TETE observer.
@mhvk mhvk modified the milestones: v4.2, v4.3 Nov 20, 2020
@mhvk

mhvk commented Nov 20, 2020

Copy link
Copy Markdown
Contributor Author

Backport was tricky so is done separately in #11065

mhvk added a commit to mhvk/astropy that referenced this pull request Nov 23, 2020
Use EarthLocation instead of GCRS position for TETE observer.
bsipocz added a commit that referenced this pull request Nov 25, 2020
Merge pull request #11061 from mhvk/tete-location
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Affects-dev PRs and issues that do not impact an existing Astropy release Bug coordinates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants