Sinusoidal Lightcurve Example

[1]:
# Import the SinusoidalLightCurve class into the current scope
from sorcha_addons.lightcurve.sinusoidal.sinusoidal_lightcurve import SinusoidalLightCurve
from sorcha.lightcurves.lightcurve_registration import update_lc_subclasses, LC_METHODS
[2]:
# Update the `LC_METHODS` registration dictionary
update_lc_subclasses()

# Show that SinusoidalLightcurve is now registered and available.
print(LC_METHODS['sinusoidal'])
<class 'sorcha_addons.lightcurve.sinusoidal.sinusoidal_lightcurve.SinusoidalLightCurve'>
[3]:
# make a small pandas dataframe with ~5 rows
import pandas as pd

data_dict = {
    'fieldMJD_TAI': [60277.351867, 60289.319749, 60289.330920, 60292.334497, 60292.346208],
    'LCA': [1, 1, 1, 1, 1],
    'Period': [0.001, 0.001, 0.001, 0.001, 0.001],
    'Time0': [60277.351867, 60277.351867, 60277.351867, 60277.351867, 60277.351867],
    }

df = pd.DataFrame.from_dict(data_dict)
print(df)
   fieldMJD_TAI  LCA  Period         Time0
0  60277.351867    1   0.001  60277.351867
1  60289.319749    1   0.001  60277.351867
2  60289.330920    1   0.001  60277.351867
3  60292.334497    1   0.001  60277.351867
4  60292.346208    1   0.001  60277.351867
[4]:
# instantiate the sinusoidal class
lc_model = LC_METHODS['sinusoidal']()

# compute the change in magnitude using the dataframe created above
output = lc_model.compute(df)

print(output)
0    0.000000
1   -0.675333
2    0.326888
3   -0.728969
4    0.840945
dtype: float64