Skip to content

Commit

Permalink
Fix time mixing in the new lightcurve generation
Browse files Browse the repository at this point in the history
  • Loading branch information
ebachelet committed Nov 19, 2024
1 parent a0c02c1 commit 08b1254
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pyLIMA/fits/LM_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def fit(self):
gtol=10 ** -10,
x_scale=scaling)

fit_results = lm_fit['x'].tolist()
fit_results = lm_fit['x']
fit_chi2 = lm_fit['cost'] * 2 # chi2

try:
Expand Down
2 changes: 1 addition & 1 deletion pyLIMA/fits/TRF_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def fit(self):
loss=loss, xtol=10**-10, ftol=10**-10,
gtol=10**-10,
x_scale=scaling)
fit_results = trf_fit['x'].tolist()
fit_results = trf_fit['x']
fit_chi2 = trf_fit['cost'] * 2 # chi2

try:
Expand Down
14 changes: 8 additions & 6 deletions pyLIMA/telescopes.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,20 @@ def __init__(self, name='NDG', camera_filter='I', pixel_scale=1, lightcurve=None
self.ld_a2 = 0

if lightcurve is not None:

data = construct_time_series(lightcurve, lightcurve_names,
lightcurve_units)
values = [data[key].value for key in data.keys()]


if 'mag' in lightcurve_names:

lightcurve_magnitude = lightcurve
lightcurve_magnitude = np.c_[values].T

lightcurve_flux = self.lightcurve_in_flux(data)

else:

lightcurve_flux = lightcurve
lightcurve_flux = np.c_[values].T

if 'inv_err_flux' not in lightcurve_names:

Expand All @@ -121,11 +122,12 @@ def __init__(self, name='NDG', camera_filter='I', pixel_scale=1, lightcurve=None


lightcurve_tot = np.c_[lightcurve_magnitude,lightcurve_flux[:,1:]]
data = construct_time_series(lightcurve_tot, ['time','mag','err_mag','flux','err_flux','inv_err_flux'],
data_tot = construct_time_series(lightcurve_tot, ['time','mag','err_mag',
'flux','err_flux','inv_err_flux'],
['JD','mag','mag','W/m^2','W/m^2','m^2/W'])
good_lines, non_finite_lines, non_unique_lines = clean_time_series(data)
good_lines, non_finite_lines, non_unique_lines = clean_time_series(data_tot)

self.lightcurve = data[good_lines]
self.lightcurve = data_tot[good_lines]

bad_data = {}
bad_data['non_finite_lines'] = non_finite_lines
Expand Down

0 comments on commit 08b1254

Please sign in to comment.