Skip to content

Commit

Permalink
Returning More Deleted Functions (#366)
Browse files Browse the repository at this point in the history
More functions for the OConnell Effect that were removed.
  • Loading branch information
kjkoeller authored Apr 28, 2024
1 parent bc33314 commit a964aa7
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions EclipsingBinaries/vseq_updated.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,16 @@ def red_X2(obslist, modellist, obserror):
X2v += ((obslist[n] - modellist[n]) / obserror[n]) ** 2
return X2v

def truncnorm(size, lower=-3.0, upper=3.0, mean=0.0, sigma=1.0):
"""
Returns a list (of specified size) of Gaussian deviates
from a capped standard deviation range.
Defaults to the traditional 3 sigma rule.
"""
import scipy.stats as sci
return sci.truncnorm.rvs(lower, upper, loc=mean, scale=sigma, size=size)

# -------------------
class astro:
class convert:
Expand Down Expand Up @@ -859,6 +869,22 @@ def FT_plotlist(a, b, order, resolution):
phase += (1 / resolution)
return FTphaselist, FTfluxlist, FTderivlist

def sim_ob_flux(FT, ob_fluxerr, lower=-3.0, upper=3.0):
"""
Modifies a pre-generated synthetic Fourier light-curve amplitude list,
and alters each value by a capped 3 sigma Gaussian deviate of the observational
error given the index in ob_fluxerr. The two lists should be sorted by the same
phase, but sim_FT_curve does this naturally.
This is really only for the sim_FT_curve program, and not a standalone fucntion.
"""
obs = len(ob_fluxerr)
devlist = calc.error.truncnorm(obs, lower=lower, upper=upper)
sim_ob_flux = []
for n in range(obs):
sim_ob_flux.append(FT[n] + devlist[n] * ob_fluxerr[n])
return sim_ob_flux

def synth(a, b, ob_phaselist, order):
"""
Similar to FT_plotlist, but instead of equal spacing throughout
Expand Down

0 comments on commit a964aa7

Please sign in to comment.