Skip to content

Commit

Permalink
Added mag_to_flux function to juliet.
Browse files Browse the repository at this point in the history
  • Loading branch information
nespinoza committed Oct 2, 2019
1 parent d6ac594 commit 99ea442
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions juliet/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
from astropy.io import fits
import pickle

def mag_to_flux(m,merr):
"""
Convert magnitude to relative fluxes.
"""
fluxes = np.zeros(len(m))
fluxes_err = np.zeros(len(m))
for i in range(len(m)):
dist = 10**(-np.random.normal(m[i],merr[i],1000)/2.51)
fluxes[i] = np.mean(dist)
fluxes_err[i] = np.sqrt(np.var(dist))
return fluxes,fluxes_err

def get_TESS_data(filename, fluxtype = 'PDCSAP_FLUX'):
"""
Given a filename, this function returns an array of times,
Expand Down

0 comments on commit 99ea442

Please sign in to comment.