Skip to content

Commit

Permalink
correct chi2 calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
wbalmer committed Jan 3, 2024
1 parent 111d685 commit 465c0f3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backtracks/backtracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def __init__(self, target_name: str, candidate_file: str, nearby_window: float =
self.stationary_params = [self.ra0, self.dec0, 0, 0, 0, self.rao, self.deco, self.pmrao, self.pmdeco, self.paro, self.radvelo]
# Compute useful chi2 value
self.stationary_loglike = self.loglike(self.stationary_params)
self.stationary_chi2_red = np.log(-2.*self.stationary_loglike)/(len(self.epochs)-self.ndim)
self.stationary_chi2_red = -2.*self.stationary_loglike/((2*(len(self.epochs)-1))-self.ndim)

jd_start, jd_end, number = ephem_open()
print('[BACKTRACK INFO]: Opened ephemeris file')
Expand Down Expand Up @@ -582,7 +582,7 @@ def fit(self, dlogz=0.5, npool=4, dynamic=False, nlive=200, mpi_pool=False, resu

# Compute useful chi2 value
self.median_loglike = self.loglike(self.run_median)
self.median_chi2_red = np.log(-2.*self.median_loglike)/(len(self.epochs)-self.ndim)
self.median_chi2_red = -2.*self.median_loglike/((2*len(self.epochs))-self.ndim)

return self.results

Expand All @@ -604,7 +604,7 @@ def load_results(self, fileprefix: str = './'):

# recompute useful chi2 value
self.median_loglike = self.loglike(self.run_median)
self.median_chi2_red = np.log(-2.*self.median_loglike)/(len(self.epochs)-self.ndim)
self.median_chi2_red = -2.*self.median_loglike/((2*len(self.epochs))-self.ndim)

def generate_plots(
self,
Expand Down

0 comments on commit 465c0f3

Please sign in to comment.