Commit aa64e862 authored by Richard O'Shaughnessy's avatar Richard O'Shaughnessy

ILE: debugging --vectorized . Needs testing

parent 5f7286e6
......@@ -880,7 +880,7 @@ if not opts.time_marginalization:
res, var, neff, dict_return = sampler.integrate(likelihood_function, *unpinned_params, **pinned_params)
else: # Sum over time for every point in other extrinsic params
if not opts.rom_integrate_intrinsic:
if not (opts.rom_integrate_intrinsic or opts.vectorized) :
def likelihood_function(right_ascension, declination, phi_orb, inclination,
psi, distance):
dec = numpy.copy(declination).astype(numpy.float64) # get rid of 'object', and allocate space
......@@ -916,30 +916,42 @@ else: # Sum over time for every point in other extrinsic params
args = likelihood_function.func_code.co_varnames[:likelihood_function.func_code.co_argcount]
print " --------> Arguments ", args
res, var, neff, dict_return = sampler.integrate(likelihood_function, *unpinned_params, **pinned_params)
elif opts.vectorized: # integrate over intrinsic variables. Right now those variables ahave HARDCODED NAMES, alas
elif opts.vectorized: # use array-based multiplications, fewer for loops
lookupNKDict = {}
lookupKNDict={}
lookupKNconjDict={}
ctUArrayDict = {}
ctVArrayDict={}
rholmArrayDict={}
rholms_intpArrayDict={}
epochDict={}
nEvals=0
for det in rholms_intp.keys():
print " Packing ", det
lookupNKDict[det],lookupKNDict[det], lookupKNconjDict[det], ctUArrayDict[det], ctVArrayDict[det], rholmArrayDict[det], rholms_intpArrayDict[det], epochDict[det] = factored_likelihood.PackLikelihoodDataStructuresAsArrays( rholms[det].keys(), rholms_intp[det], rholms[det], crossTerms[det],crossTermsV[det])
def likelihood_function(right_ascension, declination,t_ref, phi_orb, inclination,
lookupNKDict[det],lookupKNDict[det], lookupKNconjDict[det], ctUArrayDict[det], ctVArrayDict[det], rholmArrayDict[det], rholms_intpArrayDict[det], epochDict[det] = factored_likelihood.PackLikelihoodDataStructuresAsArrays( rholms[det].keys(), rholms_intp[det], rholms[det], cross_terms[det],cross_terms_V[det])
def likelihood_function(right_ascension, declination, phi_orb, inclination,
psi, distance):
global nEvals
global lnLOffsetValue
tvals = numpy.linspace(-t_ref_wind,t_ref_wind,int((t_ref_wind)*2/P.deltaT)) # choose an array at the target sampling rate. P is inherited globally
# use EXTREMELY many bits
lnL = np.zeros(right_ascension.shape,dtype=np.float128)
tvals = np.linspace(tWindowExplore[0],tWindowExplore[1],int((tWindowExplore[1]-tWindowExplore[0])/P.deltaT)) # choose an array at the target sampling rate. P is inherited globally
lnL = numpy.zeros(right_ascension.shape,dtype=numpy.float128)
P.phi = right_ascension.astype(float) # cast to float
P.theta = declination.astype(float)
P.tref = float(theEpochFiducial)
P.tref = float(fiducial_epoch)
P.phiref = phi_orb.astype(float)
P.incl = inclination.astype(float)
P.psi = psi.astype(float)
P.dist = (distance* 1.e6 * lalsimutils.lsu_PC).astype(float) # luminosity distance
lnL = factored_likelihood.DiscreteFactoredLogLikelihoodViaArrayVector(tvals,
P, lookupNKDict, rholmArrayDict, ctUArrayDict, ctVArrayDict,epochDict,Lmax=Lmax)
P, lookupNKDict, rholmArrayDict, ctUArrayDict, ctVArrayDict,epochDict,Lmax=opts.l_max)
nEvals +=len(right_ascension)
return np.exp(lnLOffsetValue)*np.exp(lnL-lnLOffsetValue)
return numpy.exp(lnL-manual_avoid_overflow_logarithm)
args = likelihood_function.func_code.co_varnames[:likelihood_function.func_code.co_argcount]
print " --------> Arguments ", args
res, var, neff, dict_return = sampler.integrate(likelihood_function, *unpinned_params, **pinned_params)
else: # integrate over intrinsic variables. Right now those variables ahave HARDCODED NAMES, alas
def likelihood_function(right_ascension, declination, phi_orb, inclination,
psi, distance,q):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment