Skip to content

Commit

Permalink
wrap Series output in Image
Browse files Browse the repository at this point in the history
  • Loading branch information
jmeyers314 committed Feb 16, 2015
1 parent 01aa852 commit 19ff107
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions galsim/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ def getBasisFunc(self, index):

def drawImage(self, *args, **kwargs):
key = (args, tuple(sorted(kwargs.items())))
return np.add.reduce(
[self.cache((key, idx))*c for idx, c in zip(self.indices, self.getCoeffs())])
return galsim.ImageF(np.add.reduce(
[self.cache((key, idx))*c for idx, c in zip(self.indices, self.getCoeffs())]))

def drawKImage(self, *args, **kwargs):
key = (args, tuple(sorted(kwargs.items())))
Expand Down Expand Up @@ -165,7 +165,7 @@ def getCoeffs(self):
def getBasisFunc(self, index):
return galsim.Convolve([obj.getBasisFunc(idx) for obj, idx in zip(self.objlist, index[1])])


class Spergelet(galsim.GSObject):
"""A basis function in the Taylor series expansion of the Spergel profile.
Expand Down Expand Up @@ -262,7 +262,6 @@ def getCoeffs(self):

def getCoeff(self, j, q):
ellip, phi0, Delta = self._decomposeA()
print "ellip:{} phi0:{} Delta:{}".format(ellip, phi0, Delta)
coeffs = []
coeff = 0.0
for m in range(abs(q), j+1):
Expand All @@ -277,7 +276,6 @@ def getCoeff(self, j, q):
num *= ellip**m
den = 2**(m-1) * math.factorial(j-m) * math.factorial(m-n) * math.factorial(n)
coeff += num/den
print "j:{} q:{} m:{} n:{} num:{}, den:{}".format(j, q, m, n, num, den)
if q > 0:
coeff *= self.flux * math.cos(2*q*phi0)
elif q < 0:
Expand Down

0 comments on commit 19ff107

Please sign in to comment.