コード例 #1
0
ファイル: powerMapsMPI.py プロジェクト: giuspugl/HADES
iStart = 0
delta = (iStop - iStart) / size
if delta == 0:
    raise ValueError, 'Too many processors for too small a  loop!'

iMin = iStart + rank * delta
iMax = iStart + (rank + 1) * delta

if iMax > iStop:
    iMax = iStop
elif (iMax > (iStop - delta)) and iMax < iStop:
    iMax = iStop

if doAll:
    powers = aveTools.onedl(nMaps)

    for mapnum in xrange(iMin, iMax):
        # for  mapnum in range(nMaps):
        # for mapnum in ([36]):
        if goodMap[mapnum]:
            tquMaps = [None] * 3
            print 'mapnum', mapnum

            for pol, tqu in enumerate(tqus):

                filename = p['workDir'] + p['basename'] + 'map%s_%05i.fits' % (
                    tqu, mapnum)

                tquMaps[pol] = liteMap.liteMapFromFits(filename)
コード例 #2
0
ファイル: cutoutAndSimulate2.py プロジェクト: giuspugl/HADES
        #    h = True)

        if p['cutoutMask']:
            mask, maskHeaderMask = healpy.fitsfunc.read_map(
                p['workDir'] + p['maskName'], h=True, field=p['maskField'])
        print 'done'

    decVals = np.linspace(
        -90 + p['mapWidthsDeg'] / 2.,
        90 - p['mapWidthsDeg'] / 2.,
        num=(180 / (p['mapWidthsDeg'])
             ))  # num = 180 / (p['mapWidthsDeg'] - 1)) - Philcox edit

    nDecs = len(decVals)

    raVals = aveTools.onedl(nDecs)

    nPoints = np.zeros(nDecs)

    for i, decVal in enumerate(decVals):

        raVals[i] = np.arange(0, 360,
                              p['mapWidthsDeg'] / np.cos(decVal * np.pi / 180))
        nPoints[i] = len(raVals[i])

    # m = liteMap.makeEmptyCEATemplateAdvanced(Ra0Array[i] - buffer, Dec0Array[i] - buffer, \
    #                                              Ra1Array[i] + buffer, Dec1Array[i] + buffer)

    i = 0

    m = liteMap.makeEmptyCEATemplateAdvanced(Ra0Array[i] - buffer, Dec0Array[i] - buffer, \
コード例 #3
0
ファイル: rotateMaps.py プロジェクト: giuspugl/HADES
mapT,mapQ,mapU, mapHeader = healpy.fitsfunc.read_map(p['mapDir'] + p['mapName'], field = (0,1,2),\
                                                     h = True)
mapCelestial = [mapT, mapQ, mapU]

if rotateMask:
    maskCelestial, maskHeaderMask = healpy.fitsfunc.read_map(p['mapDir'] + p['maskName'], h = True)


i = 0



nTQUs = 3

mapGalactic = aveTools.onedl(nTQUs)

for i in range(nTQUs):


    mapGalactic[i] = aveTools.rotateHealpixGtoC(mapCelestial[i], actuallyDoCtoG = True)
    if rotateMask:
        maskGalactic = aveTools.rotateHealpixGtoC(maskCelestial, actuallyDoCtoG = True)


healpy.fitsfunc.write_map(p['workDir'] + p['basename'] + '_map_gal.fits', mapGalactic, coord = 'G') 


# m = liteMap.makeEmptyCEATemplateAdvanced(Ra0Array[i] - buffer, Dec0Array[i] - buffer, \
#                                              Ra1Array[i] + buffer, Dec1Array[i] + buffer)