Skip to content

Commit 84e3dea

Browse files
new function to estimate a/b & a/c (#118)
* new function to estimate a/b & a/c * Apply Ruff --------- Co-authored-by: JulienPeloton <[email protected]>
1 parent 7f4ed12 commit 84e3dea

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

fink_utils/sso/utils.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,36 @@ def compute_light_travel_correction(jd, d_obs):
437437
return jd_lt
438438

439439

440+
def estimate_axes_ratio(residuals, R):
441+
"""Estimate the axes ratio of a SSO from the residuals of the sHG1G2 model and its oblateness R.
442+
443+
Parameters
444+
----------
445+
residuals: np.array
446+
Residuals (observed - model) of the SSO with sHG1G2 model
447+
R: float
448+
Oblateness parameter of the sHG1G2 model
449+
450+
Returns
451+
-------
452+
a_b, a_c: float
453+
a/b and a/c axes ratio
454+
"""
455+
# Estimate the amplitude of the lightcurve from residuals
456+
# Taken at 2 sigma
457+
amplitude = np.std(residuals) * 2.0
458+
459+
# Estimate the a/b ratio
460+
a_b = 10 ** (0.4 * (amplitude * 2))
461+
462+
# Estimate the a/c ratio (and force c<b)
463+
a_c = (a_b + 1) / (2 * R)
464+
if a_c < a_b:
465+
a_c = a_b
466+
467+
return a_b, a_c
468+
469+
440470
if __name__ == "__main__":
441471
"""Execute the unit test suite"""
442472

0 commit comments

Comments
 (0)