Skip to content

Acceleration fit - #450

Open
rt538-del wants to merge 10 commits into
sblunt:v4from
rt538-del:acceleration-fit
Open

rt538-del wants to merge 10 commits into
sblunt:v4from
rt538-del:acceleration-fit

Conversation

@rt538-del

@rt538-del rt538-del commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

These are changes made into the system.py and basis.py so the users are able to choose to whether they would like to do a acceleration only fit or a aceeleration+keplerian fit. This is related to issue #435

Add Basis.set_acceleration_priors (acc_ra, acc_dec) and System options
acceleration_only and acceleration_and_keplerian_fit, with the
acceleration model, setup, and save support in system.py.
@sblunt
sblunt changed the base branch from main to v4 October 20, 2026 22:37
@rt538-del

Copy link
Copy Markdown
Collaborator Author

Unit tests pass on 3.10/3.12/3.14. The notebook job fails on Eps_Eri_Joint_Fit (data file path) and Gaia_DR4_EAS (3000 s timeout). Neither notebook uses the new acceleration code. The only change to existing code in plot_dr4_orbit is behind the new remove_acceleration=False option.

Comment thread orbitize/system.py Outdated
use_rebound=False,
acceleration_only=False,
acceleration_and_keplerian_fit=False,
alpha0=None,

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.

Rather than passing these (alpha0, delta0, alphadec0_epoch) into System, can you access them directly from the Gaia object?

Comment thread orbitize/system.py Outdated
X, Y, Z = predictor.X, predictor.Y, predictor.Z
else:
bary_pos, _ = get_body_barycentric_posvel(
"earth", Time(epochs, format="decimalyear")

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.

make sure to use julian year instead of decimalyear throughout

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.

Say you wrote the tutorial at the top!

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.

Feel free to not address this if you don't have time, but I think it would be very interesting to do the long-period fit using an acceleration parametrization and with a full keplerian parametrization to see how different the posterior predicted accelerations are.

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.

Never mind, I got to the later part of the tutorial and saw that you're fitting the same dataset with both a keplerian and an acceleration term (which is super interesting-- I'll be excited to see those results once they converge)

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.

In the "Likelihood object" cell, you write plot._model_along_scan_dr4 returns w_i for one parameter vector-- presumably you really want to reference gaia.compute_lnlike or some such?

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 is mentioned a few places throughout the tutorial

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.

stellar_or_system_mass and plx are placeholders that aren't used -- we should really make this syntax better for users. What if we create plx_prior and stellar_or_system_mass_prior kwargs in System that overwrite plx, stellar_or_system_mass and their associated errors if they are passed in? That will allow us to maintain backwards compatibility but make it easier for users to set priors on these params.

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.

In "Starting point," follow Clarissa's updated tutorial which uses an orbitize function for performing the linear fit and choosing the starting point for the model.

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.

Same for Keplerian + acceleration starting point

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

What notebook.. sorry I couldn't find it

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.

I moved it to docs/tutorials!

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.

np.hypot! I've never seen that function before. Very useful, thanks for teaching me.

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.

We should make it so that the Delta t^2 coefficient is the second derivative of the motion, not half the second derivative of the motion.

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.

add default axis labels for acc_ra/acc_dec

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.

don't need plt.show in notebooks

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.

in the along-scan data and residuals, can you make the model smoother (i.e. plot at a greater number of epochs, not just the observation epochs)

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.

Nvm, realized afterward that's nonsensical. I liked the way you visualized it lower down in the notebook with the point-to-point comparison rather than the jagged line.

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.

The notebook takes quite a long time to run (which is fine for actually performing the fit, but the version that needs to run in real time when we do continuous integration testing should be faster). Can you run for fewer steps, but leave the number of steps you would need for convergence in there commented out?

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.

"The OHP files only give the along-scan parallax factor $f_{\rm AL}$, not separate RA and Dec factors, so $\varpi f_{\rm AL}$ is subtracted from the data before plotting."
--> you can reconstruct the parallax factors given the scan angle, so it would be nice to add in the parallactic motion too.

Comment thread orbitize/plot.py

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.

Big picture thoughts about plots (ccing @clarissardoo):

My "subtract each component" plot doesn't look great. Can you work on the aesthetics? Some ideas:

  • bigger fonts by default
  • thicker error bars
  • label each y axis (i.e. communicate to the viewer what is actually being plotted more clearly)
  • think about the color scheme. Can you create more contrast? Make sure the thick vs thin error bars are more visible.
  • By default, this should also work for the kepler-only or kepler+accel fits.

sblunt and others added 5 commits November 3, 2026 17:57
Read star position and reference epoch from the Gaia object. Use Julian years. Define acc_ra and acc_dec as the second derivative of the motion. Add plx_prior and stellar_or_system_mass_prior to System. Add DR4LogProb.linear_fit for choosing starting points. Add default corner labels for the accelerations. Improve plot_dr4_acceleration, add parallax to it, and support Keplerian-only fits. Update the tutorial and tests.

This branch has not been deployed

No deployments
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.

3 participants