Skip to content

Commit

Permalink
Merge pull request #8 from dirac-institute/bernardinelli-patch-1
Browse files Browse the repository at this point in the history
Update sinusoidal_lightcurve.py
  • Loading branch information
mschwamb authored Sep 28, 2023
2 parents f695e7c + 4a8b74e commit 9ea56e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def compute(self, df: pd.DataFrame) -> np.array:
# Verify that the input data frame contains each of the required columns.
self._validate_column_names(df)

modtime = np.mod((df["FieldMJD"] + df["Time0"]) / df["Period"], 2 * np.pi)
return df["LCA"] * np.sin(modtime)
time = 2 * np.pi * (df["FieldMJD"] - df["Time0"]) / df["Period"]
return df["LCA"] * np.sin(time)

@staticmethod
def name_id() -> str:
Expand Down
6 changes: 3 additions & 3 deletions tests/lightcurve/sinusoidal/test_sinusoidal.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ def test_sinusoidal_lightcurve_name():

def test_compute_simple():
data_dict = {
"FieldMJD": [1],
"FieldMJD": [1./4],
"LCA": [1],
"Period": [1],
"Time0": [1],
"Time0": [0],
}

df = pd.DataFrame.from_dict(data_dict)

model = SinusoidalLightCurve()
output = model.compute(df)

assert np.isclose(output.values[0], 0.909297)
assert np.isclose(output.values[0], 1)

0 comments on commit 9ea56e8

Please sign in to comment.