Skip to content

Commit

Permalink
More memory efficiency in new nemoModel
Browse files Browse the repository at this point in the history
  • Loading branch information
mattyowl committed Dec 13, 2023
1 parent ba00792 commit ba573e1
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions nemo/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,8 @@ def makeBeamModelSignalMap(degreesMap, wcs, beam, amplitude = None):

#------------------------------------------------------------------------------------------------------------
def _paintSignalMap(shape, wcs, tckP, beam = None, RADeg = None, decDeg = None, amplitude = None,
maxSizeDeg = 10.0, convolveWithBeam = True, vmin = 1e-12, omap = None):
maxSizeDeg = 10.0, convolveWithBeam = True, vmin = 1e-12, omap = None,
obsFrequencyGHz = None, TCMBAlpha = 0, z = None):
"""Use Sigurd's fast object painter to paint given signal into map.
Notes:
Expand Down Expand Up @@ -671,13 +672,19 @@ def _paintSignalMap(shape, wcs, tckP, beam = None, RADeg = None, decDeg = None,
modelClip=pointsrcs.sim_objects(clip['data'].shape, clip['wcs'].AWCS, poss, amps, (r, abs(rprof)), vmin = vmin,
rmax = np.radians(maxSizeDeg), #prof_equi = False,
pixwin = False)
if obsFrequencyGHz is not None:
modelClip=maps.convertToDeltaT(modelClip, obsFrequencyGHz = obsFrequencyGHz,
TCMBAlpha = TCMBAlpha, z = z)
xMin, xMax, yMin, yMax=clip['clippedSection']
omap[yMin:yMax, xMin:xMax]=omap[yMin:yMax, xMin:xMax]+modelClip
signalMap=omap
else:
signalMap=pointsrcs.sim_objects(shape, wcs.AWCS, poss, amps, (r, abs(rprof)), vmin = vmin,
rmax = np.radians(maxSizeDeg), #prof_equi = False,
pixwin = False)
if obsFrequencyGHz is not None:
signalMap=maps.convertToDeltaT(signalMap, obsFrequencyGHz = obsFrequencyGHz,
TCMBAlpha = TCMBAlpha, z = z)

if rprof[0] < 0:
signalMap=signalMap*-1
Expand All @@ -688,7 +695,7 @@ def _paintSignalMap(shape, wcs, tckP, beam = None, RADeg = None, decDeg = None,
def makeArnaudModelSignalMap(z, M500, shape, wcs, beam = None, RADeg = None, decDeg = None,\
GNFWParams = 'default', amplitude = None, maxSizeDeg = 15.0,\
convolveWithBeam = True, cosmoModel = None, painter = 'pixell',
omap = None):
omap = None, obsFrequencyGHz = None, TCMBAlpha = 0):
"""Makes a 2d signal only map containing an Arnaud model cluster.
Args:
Expand Down Expand Up @@ -759,7 +766,8 @@ def makeArnaudModelSignalMap(z, M500, shape, wcs, beam = None, RADeg = None, dec
#------------------------------------------------------------------------------------------------------------
def makeBattagliaModelSignalMap(z, M500, shape, wcs, beam = None, RADeg = None, decDeg = None,\
GNFWParams = 'default', amplitude = None, maxSizeDeg = 15.0,\
convolveWithBeam = True, cosmoModel = None):
convolveWithBeam = True, cosmoModel = None,\
obsFrequencyGHz = None, TCMBAlpha = 0):
"""Makes a 2d signal only map containing a Battaglia+2012 model cluster (taking into account the redshift
evolution described in Table 1 and equation 11 there).
Expand Down

0 comments on commit ba573e1

Please sign in to comment.