Skip to content

Correct DR4 stellar orbit sign and add Gaia-4 and BH3 tutorials - #462

Open
clarissardoo wants to merge 23 commits into
v4from
dr4-sign-and-tutorials-v4
Open

clarissardoo wants to merge 23 commits into
v4from
dr4-sign-and-tutorials-v4

Conversation

@clarissardoo

@clarissardoo clarissardoo commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Correct the stellar orbit sign in DR4 likelihood, plotting, and simulation; update regression tests; add Gaia-4 and BH3 notebooks and Gaia-4 RV data.

@clarissardoo
clarissardoo marked this pull request as ready for review November 5, 2026 05:58

@sblunt sblunt left a comment

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.

Hey, in general this looks good, but why are you saving the orbit sign? I don't think we want users to be able to change the sign; it should always be the same. I'd suggest removing the sign hdf5 attribute and also removing the global variable from the top of simualte_dr4.py

@sblunt

sblunt commented Nov 11, 2026

Copy link
Copy Markdown
Owner

Other comments (pasting from our convo on slack):

  • Fix timeout issues in notebooks (decrease # steps but keep a comment with the # of steps needed to reach convergence)
  • Mention in readme that the data sources should be cited

EAS tutorial:

  • Don’t modify the path at all in orbitize tutorials. Everything should be accessible from anywhere. Re: the file not found issue— make sure you’re not referencing any files that only exist on your computer (i.e. there shouldn’t be any /Users/clary paths)
  • “During the orientation search, we solve those four linear terms after subtracting each trial orbit and parallax. They remain sampled in the joint MCMC fit.” --> this wording is a little confusing. What do you mean by “orientation search?”
  • “Gaia constrains the sky-plane orientation and true companion mass; the RVs retain the precise spectroscopic orbit.” --> this is also a little misleading. Maybe “the RVs enable constraints on the sky plane orientation (inc and Omega) and dynamical mass.”
  • “Inclination and node remain broad, with no published orientation used for initialization.” --> be specific about “position angle of nodes,” and, maybe also say “with no available prior information about these parameters”
  • “Each candidate gets a conditional position/proper-motion solve.” --> is this true? I thought we were currently fitting separately for the astrometric parameters. Eshel’s branch is doing this. Let’s remove this line for clarity atm
  • y## 4. Inspect the joint posterior --> typo
  • in the dr4 eas tutorial, can you use orbitize’s corner function instead of writing it yourself?
  • sort of minor, but I don't love warm_names as a variable name. Can you use something more descriptive?
  • importlib.reload(orbitize.plot)--> remove. I know these are helpful for debugging but shouldn't be in the final tutorial
  • ylabel in the residuals plot looks like it got a little messed up
  • in general we shouldn't have big plotting code blocks in tutorials. Can you define functions in plot.py to do make the compact plots?
  • I like the compact plot! As a side note, it would be nice to add the std and mu of the gaussian fitted to the residuals.

@sblunt

sblunt commented Nov 11, 2026

Copy link
Copy Markdown
Owner
  • one more thing-- we should incorporate the Gaia plotting functions into the Plotter class

@sblunt

sblunt commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

BH3 tutorial:

  • no path modifications
  • remove unused imports (ruff should do this for you)
  • "This is a first exploratory fit, not a claim of convergence." --> I'd suggest moving this to the mcmc convergence inspection section, and also include mcmc hyperparams you'd actually need for convergence in a comment.
  • in general, commit notebooks with outputs (i.e. don't clear the outputs). This will prevent readthedocs from having to rerun them in order to generate the html
  • define variables in sec 3 of the nb
  • "The linear terms are freely sampled once MCMC starts." --> remove this line; we're going to shortly change how we do this sampling with eshel's pr
  • minor stylistic point, but I generally prefer all imports at the top
  • use orbitize corner rather than corner.corner-- we do a lot of the setting things automatically, like making nice looking latex axis labels, converting radians to degrees, etc

@sblunt

sblunt commented Nov 11, 2026

Copy link
Copy Markdown
Owner
  • in several of the tutorials, you have language like "rv fits everything except sky orientation and dynamical mass." This isn't quite true-- it's truly a joint fit; it's true that rv alone can't constrain sky orientation and dynamical mass, but it's also true that Gaia astrometry alone can't constrain dynamical mass. I'd suggest looking for statements like this in each of the tutorials and changing to something like "Jointly fit parameters. Some parameters (e.g. ecc) are influenced by both the Gaia astrometry and the RVs, while others (e.g. PAN) are influenced by the Gaia astrometry alone. RVs constrain msin(i), and astrometry alone constrains m/mtot^2/3." (or something like that-- I suggest to just be more specific)

@sblunt

sblunt commented Nov 11, 2026

Copy link
Copy Markdown
Owner

OHP tutorial:

  • add information at top about where data comes from, similar to the EAS one
  • use orbitize corner

Comment thread orbitize/basis.py
"""

for body_num in np.arange(self.num_secondary_bodies) + 1:
# Cache these before their slots become periods and K.

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.

can you make this comment more descriptive?

Comment thread orbitize/basis.py
m_n = param_arr[self.standard_basis_idx[f"m{body_num}"]]
m0 = param_arr[self.standard_basis_idx["m0"]]
mtot = m_n + m0
mtot = m0 + np.sum(np.where(all_smas <= sma, all_masses, 0.0), axis=0)

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 don't love that this logic is repeated wrt the Jacobi logic in system, but don't have a great idea of how to abstract it out. maybe we could define jacobi_mtot, and use that in system?

@sblunt

sblunt commented Nov 17, 2026

Copy link
Copy Markdown
Owner

I took a look at the semiamp basis changes, and those look good. It's good we're being more consistent about using jacobi coordinates throughout. I made a small suggestion about trying to abstract out some code.

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.

2 participants