Skip to content

Implement Finite Difference Velocity Transformations - #13

Closed
eteq wants to merge 189 commits into
adrn:coordinates/frame-velocity-supportfrom
eteq:coordinates/finite-diff-vels
Closed

eteq wants to merge 189 commits into
adrn:coordinates/frame-velocity-supportfrom
eteq:coordinates/finite-diff-vels

Conversation

@eteq

@eteq eteq commented Jun 15, 2017

Copy link
Copy Markdown

WIP...

@eteq eteq changed the title Coordinates/finite diff vels Implement Finite Difference Velocity Transformations Jun 15, 2017
@eteq
eteq force-pushed the coordinates/finite-diff-vels branch from dc15777 to 8f82c3d Compare June 15, 2017 16:03
@adrn

adrn commented Jun 15, 2017

Copy link
Copy Markdown
Owner

Sick!! Have you tried this going from GCRS to ICRS to see if it produces the correct Barycentric velocity correction?

@eteq

eteq commented Jun 15, 2017

Copy link
Copy Markdown
Author

Have you tried this going from GCRS to ICRS to see if it produces the correct Barycentric velocity correction?

Just what I'm looking at right now actually! It doesn't work, but I think due to some straightforward-to-fix bugs. Will push a few more tests up soon hopefully, including that.

@adrn
adrn force-pushed the coordinates/frame-velocity-support branch 2 times, most recently from 856e89b to 68457ec Compare June 16, 2017 04:27
@eteq
eteq force-pushed the coordinates/finite-diff-vels branch 2 times, most recently from 32c8c86 to 52f28b4 Compare June 16, 2017 07:50
@eteq
eteq force-pushed the coordinates/finite-diff-vels branch 2 times, most recently from 17fbb3e to 867b685 Compare June 18, 2017 05:31
@adrn
adrn force-pushed the coordinates/frame-velocity-support branch from bc3247b to 472f385 Compare June 18, 2017 19:26
…support

Add velocity support to coordinate frames and transformations
class LSR2(LSR):
obstime = TimeFrameAttribute(default=J2000)

dt = 1*u.s

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This overrides the dt passed in to the test function.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

oops! fortunately it passes either way...

ax2.set_title('total')


sd = frame.data.differentials['s'].represent_as(SphericalDifferential, frame.data)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

SphericalDifferential isn't imported

# if its a lot bigger than this, finite-difference noise has ruined things
assert np.ptp(rv) < 65*u.km/u.s

def diff_info_plot(frame, times):

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

times should be time to work with variables in function.

@adrn

adrn commented Jun 27, 2017

Copy link
Copy Markdown
Owner

You should be able to implement a test that checks this against some of the matrix transforms. For example:

def test_faux_fk5_galactic():
    class Galactic2(Galactic):
        pass

    dt = 1*u.s

    @frame_transform_graph.transform(FunctionTransformWithFiniteDifference,
                                     FK5, Galactic2, finite_difference_dt=dt,
                                     symmetric_finite_difference=True,
                                     finite_difference_frameattr_name=None)
    def fk5_to_gal2(fk5_coo, gal_frame):
        trans = DynamicMatrixTransform(fk5_to_gal, FK5, Galactic2)
        return trans(fk5_coo, gal_frame)

    @frame_transform_graph.transform(FunctionTransformWithFiniteDifference,
                                     Galactic2, ICRS, finite_difference_dt=dt,
                                     symmetric_finite_difference=True,
                                     finite_difference_frameattr_name=None)
    def gal2_to_fk5(gal_coo, fk5_frame):
        trans = DynamicMatrixTransform(_gal_to_fk5, Galactic2, FK5)
        return trans(gal_coo, fk5_frame)

    c1 = FK5(ra=150*u.deg, dec=-17*u.deg, radial_velocity=83*u.km/u.s,
             pm_ra_cosdec=-41*u.mas/u.yr, pm_dec=16*u.mas/u.yr,
             distance=150*u.pc)
    c2 = c1.transform_to(Galactic2)
    c3 = c1.transform_to(Galactic)
    
    # compare the values below
    c2.pm_l_cosb.to(u.mas/u.yr), c2.pm_b.to(u.mas/u.yr)
    c3.pm_l_cosb.to(u.mas/u.yr), c3.pm_b.to(u.mas/u.yr)

I was finding ~0.3% accuracy.

@eteq

eteq commented Jun 27, 2017

Copy link
Copy Markdown
Author

Alright, I think all the comments above have been addressed!

@eteq
eteq force-pushed the coordinates/finite-diff-vels branch from e2d4f1c to 6bfd3d0 Compare June 27, 2017 05:33
@eteq

eteq commented Jun 27, 2017

Copy link
Copy Markdown
Author

Closing this in favor of astropy#6226

@eteq eteq closed this Jun 27, 2017
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.