Skip to content

Marg lnlike - #453

Closed
eshelDror wants to merge 22 commits into
sblunt:v4from
eshelDror:marg_lnlike
Closed

eshelDror wants to merge 22 commits into
sblunt:v4from
eshelDror:marg_lnlike

Conversation

@eshelDror

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread orbitize/marginalizer.py Outdated
def apply(self, param_arr, jitter_arr=None, calculated_values={}):
pass

class Marg1(Marginalizer):

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.

It would be nice to put these test classes in the appropriate test file instead of the main code

Comment thread orbitize/marginalizer.py
+ np.diag(self.covar_seps_pas, k=self.n_obs)
+ np.diag(self.covar_seps_pas, k=-self.n_obs)
)
self.W_inv = np.linalg.inv(self.W)

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.

nice pre-calculation here

Comment thread orbitize/marginalizer.py
MARG_PARAMS = ["sma1", "pan1"]
QUANT_TYPES = ["seppa"]
LNLIKE_TYPE = "chi2"

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 know this is on your todo list but just reminder to include the docstrings

Comment thread orbitize/marginalizer.py
fs (np.array of float): (defined in \ref{eq:f_and_g} in PASP review), values at observation epochs
gs (np.array of float): (defined in \ref{eq:f_and_g} in PASP review), values at observation epochs
W: 2n x 2n covariance matrix corresponding to observations y

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 W_inv docstring

Comment thread orbitize/marginalizer.py
W: 2n x 2n covariance matrix corresponding to observations y

Returns:
float: log(abs(determinant of cov matrix))

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 other return vars

Comment thread orbitize/marginalizer.py

_, logabsdet_covmatrix = np.linalg.slogdet(
cov_matrix
) # NOTE: the 2pi factor in the APW paper is constant; doesn't affect overall 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.

this comment was more for myself-- maybe instead we say "constant factor of 2pi ignored"

Comment thread orbitize/marginalizer.py
def lnlike(y, X, beta_hat, W, W_inv=None, add_error_norm=False):
"""
Compute log likelihood, excluding volume in marginalization integral (first two terms in \ref{eq:marg_like} in
PASP review):

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 assume readers don't know what the PASP review is-- maybe give a little more context "PASP review by Blunt 2026"

Comment thread orbitize/marginalizer.py
X: 2*n_obs x 2 design matrix
beta_hat: length 2 array of conditional MAP values of sma and pan (respectively)
W: 2n x 2n covariance matrix corresponding to observations y
add_error_term: if True, include the -1/2 log|W| term (needed if fitting for jitter). Default False.as_integer_ratio

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 looks like add_error_norm

@sblunt

sblunt commented Nov 17, 2026

Copy link
Copy Markdown
Owner

all code pulled in in PR #459

@sblunt sblunt closed this Nov 17, 2026
@sblunt
sblunt deleted the marg_lnlike branch November 17, 2026 22:55
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