Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed log10 issue in repeat_grid.py #48

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading