Skip to content

Commit

Permalink
fixed path bug
Browse files Browse the repository at this point in the history
  • Loading branch information
apetri committed May 16, 2016
1 parent 480de8a commit 73768fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lenstools/pipeline/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2355,13 +2355,13 @@ def loadTransferFunction(self):
raise ValueError("Transfer functions have not been computed yet!")

#Look for the wavenumbers in the first file
k = np.loadtxt(tfr_files[0],usecols=(0,))*self.cosmology.h*(self.Mpc_over_h**-1)
k = np.loadtxt(self.path(tfr_files[0],"home"),usecols=(0,))*self.cosmology.h*(self.Mpc_over_h**-1)
tfr = CAMBTransferFunction(k)

#Add transfer function information from each redshift
for f in tfr_files:
z, = re.search(r"z([0-9.]+)",f).groups()
transfer_values = np.loadtxt(f,usecols=(1,))
transfer_values = np.loadtxt(self.path(f,"home"),usecols=(1,))
tfr.add(float(z.rstrip(".")),transfer_values)

#Return to user
Expand Down
6 changes: 3 additions & 3 deletions lenstools/simulations/camb.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def add(self,z,T):
"""

assert T.shape==k.shape,"There should be exactly one transfer function value for each wavenumber! len(T)={0} len(k)={1}".format(len(T),len(self.k))
assert T.shape==self._k.shape,"There should be exactly one transfer function value for each wavenumber! len(T)={0} len(k)={1}".format(len(T),len(self._k))
self._transfer[z] = T

def compute(self,z,k):
Expand All @@ -373,9 +373,9 @@ def compute(self,z,k):
if z not in self._interpolated:

if z not in self._transfer:
raise ValueError("There is no information at redshift {0:.3f}".format(z))
raise ValueError("There is no transfer function information at redshift {0:.3f}".format(z))

self._interpolated[z] = interpolate.interp1d(self._k.value,self._transfer[z])

#Use interpolator to compute the transfer function
return self._interpolated[z](k.to((u.Mpc)**-1).value)
return self._interpolated[z](k.to((u.Mpc)**-1).value)

0 comments on commit 73768fe

Please sign in to comment.