Skip to content

Add brigtness calc to comp all orbits#384

Merged
sblunt merged 68 commits into
mainfrom
add-brigtness-calc-to-comp-all-orbits
Jul 20, 2026
Merged

Add brigtness calc to comp all orbits#384
sblunt merged 68 commits into
mainfrom
add-brigtness-calc-to-comp-all-orbits

Conversation

@Farrmol

@Farrmol Farrmol commented Feb 4, 2025

Copy link
Copy Markdown
Collaborator

No description provided.

Farrmol and others added 30 commits July 22, 2024 10:36
@sblunt
sblunt requested a review from semaphoreP July 1, 2026 20:38

@semaphoreP semaphoreP left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice, I like it. I think we have some documentation updates (especially since this is a breaking change to compute_all_orbits(). I also had some questions below about how this will work in the future.

Comment thread orbitize/kepler.py

return mean_anom

def times2trueanom_and_eccanom(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

missing docstring

Comment thread orbitize/system.py

alpha = (1/np.pi)*(np.sin(B)+(np.pi-B)*np.cos(B))

albedo = 0.5 # NOTE: we're only fitting relative changes in brightness, so the actual value of albedo doesn't matter

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

if we're fitting relative changes, how will that work? Are we going to analytically marginalize over some linear scale factor term in the future in lnlike?

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.

Great question. Noting for posterity here our offline conversation that it indeed makes sense to fit a linear scale factor. I just raised issue #416 in response to this comment.

Comment thread orbitize/system.py
Comment on lines +500 to +512
tanom, eanom = kepler.times2trueanom_and_eccanom(sma, epochs, mtot, ecc, tau, tau_ref_epoch=self.tau_ref_epoch)


R = (sma*(1-ecc**2))/(1+ecc*np.cos(tanom))

z = (R)*(-np.cos(argp)*np.sin(inc)*np.sin(tanom)-np.cos(tanom)*np.sin(inc)*np.sin(argp))

B = np.arctan2(-R, z)+ np.pi

alpha = (1/np.pi)*(np.sin(B)+(np.pi-B)*np.cos(B))

albedo = 0.5 # NOTE: we're only fitting relative changes in brightness, so the actual value of albedo doesn't matter
brightness = albedo*alpha/R**2

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

maybe not for this PR, but we should make this part of code customizable: we can replace it with a user-provided function or class, so that we can handle custom and non-Lambertian models. We could refactor this into a separate function here or make an issue to do 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.

Agreed! I raised issue #417 to keep track. Let's do it in a future PR.

Comment thread orbitize/system.py
Comment on lines 372 to 373
vz (np.array of float): N_epochs x N_bodies x N_orbits array of
radial velocities at each epoch.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

update docstring to add fourth return element. I think we also (maybe separately) need to update the orbitize release notes about this breaking function signature change for compute_all_orbits(). It may break people's code that use 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.

Good call. I'll update the release notes after I pull into main, and will be sure to note this is a breaking change.

Comment thread tests/test_brightness.py Outdated

def test_compute_posteriors():
"""
Test that a short mcmc runs to completion

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is this test just to show that adding brightness to the csv doesn't break anything? are we actually fitting for it right now?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Update the docstring to explain the purpose of the test

@sblunt

sblunt commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Thanks for the review @semaphoreP! I'm going to pull the changes to main and release a new version now. The CI tests on this branch are broken because they're using an old version of the coveralls action. They should be fixed when pulled into main.

@sblunt
sblunt merged commit 2b4a75c into main Jul 20, 2026
1 of 9 checks passed
@sblunt
sblunt deleted the add-brigtness-calc-to-comp-all-orbits branch July 20, 2026 21:36
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