Skip to content

Commit

Permalink
Merge pull request #48 from FRBs/more_spline_debug
Browse files Browse the repository at this point in the history
Fixed log10 issue in repeat_grid.py
  • Loading branch information
cwjames1983 authored Jan 12, 2024
2 parents 5d343cb + 3326911 commit 9616401
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions zdm/repeat_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,19 +640,28 @@ def calc_singles_exactly(self):
norms1 = -avals**effGamma / effGamma # this is the "too low" value
analytic = (SET_REP_ZERO**effGamma - avals[NotTooLowb]**effGamma)/effGamma
if NTLb:
norms1[NotTooLowb] = interpolate.splev([SET_REP_ZERO], energetics.igamma_splines[effGamma])
if energetics.SplineLog:
norms1[NotTooLowb] = 10.**interpolate.splev(np.log10([SET_REP_ZERO]), energetics.igamma_splines[effGamma])
else:
norms1[NotTooLowb] = interpolate.splev([SET_REP_ZERO], energetics.igamma_splines[effGamma])
norms1[NotTooLowb] += analytic
if NTL:
norms1[NotTooLow] = interpolate.splev(avals[NotTooLow], energetics.igamma_splines[effGamma])

if energetics.SplineLog:
norms1[NotTooLow] = 10.**interpolate.splev(np.log10(avals[NotTooLow]), energetics.igamma_splines[effGamma])
else:
norms1[NotTooLow] = interpolate.splev(avals[NotTooLow], energetics.igamma_splines[effGamma])
self.snorms1[self.Nth] = norms1
# now do calculations
if self.newRmax == False and self.newRgamma == False:
norms2 = self.snorms2[self.Nth]
else:
norms2 = -bvals**effGamma / effGamma
if NTLb:
norms2[NotTooLowb] = interpolate.splev(bvals[NotTooLowb], energetics.igamma_splines[effGamma])

if energetics.SplineLog:
norms2[NotTooLowb] = 10.**interpolate.splev(np.log10(bvals[NotTooLowb]), energetics.igamma_splines[effGamma])
else:
norms2[NotTooLowb] = interpolate.splev(bvals[NotTooLowb], energetics.igamma_splines[effGamma])
self.snorms2[self.Nth] = norms2
# subtract components
norms = norms1 - norms2
Expand Down Expand Up @@ -738,11 +747,18 @@ def calc_zeroes_exactly(self,singles):
analytic = (SET_REP_ZERO**effGamma - avals[NotTooLowb]**effGamma)/effGamma

if NTLb:
norms1[NotTooLowb] = interpolate.splev([SET_REP_ZERO], energetics.igamma_splines[effGamma])

if energetics.SplineLog:
norms1[NotTooLowb] = 10.**interpolate.splev(np.log10([SET_REP_ZERO]), energetics.igamma_splines[effGamma])
else:
norms1[NotTooLowb] = interpolate.splev([SET_REP_ZERO], energetics.igamma_splines[effGamma])
norms1[NotTooLowb] += analytic
# the below over-writes the above
if NTL:
norms1[NotTooLow] = interpolate.splev(avals[NotTooLow], energetics.igamma_splines[effGamma])
if energetics.SplineLog:
norms1[NotTooLow] = 10.**interpolate.splev(np.log10(avals[NotTooLow]), energetics.igamma_splines[effGamma])
else:
norms1[NotTooLow] = interpolate.splev(avals[NotTooLow], energetics.igamma_splines[effGamma])
self.znorms1[self.Nth] = norms1


Expand All @@ -752,7 +768,11 @@ def calc_zeroes_exactly(self,singles):
else:
norms2 = -bvals**effGamma / effGamma
if NTLb:
norms2[NotTooLowb] = interpolate.splev(bvals[NotTooLowb], energetics.igamma_splines[effGamma])
if energetics.SplineLog:
norms2[NotTooLowb] = 10.**interpolate.splev(np.log10(bvals[NotTooLowb]), energetics.igamma_splines[effGamma])
else:
norms2[NotTooLowb] = interpolate.splev(bvals[NotTooLowb], energetics.igamma_splines[effGamma])

self.znorms2[self.Nth] = norms2

# integral is in units of R'=R*Rmult
Expand Down

0 comments on commit 9616401

Please sign in to comment.