Beispiel #1
0
 def test_compute_reds_tol(self):
     antpos = np.zeros((65,3), dtype=np.float)
     antpos[3]  = np.array([ 3373240.12832542,   540919.61      ,  5674198.83539668])
     antpos[49] = np.array([ 3373240.64412165,   540904.7       ,  5674198.52887711])
     antpos[10] = np.array([ 3373240.90712842,   540889.64      ,  5674198.38421393])
     antpos[64] = np.array([ 3373240.51728633,   540874.74      ,  5674198.51119087])
     reds = Oa.filter_reds(Oa.compute_reds(antpos, tol=1.0), ants=(3,10,49,64))
     self.assertNotEqual(reds, [[(49, 64), (3, 10)], [(3, 49), (10, 64), (49, 10)]])
     reds = Oa.filter_reds(Oa.compute_reds(antpos, tol=1.5), ants=(3,10,49,64))
     self.assertEqual(reds, [[(49, 64), (3, 10)], [(3, 49), (10, 64), (49, 10)]])
def saveQuantitiesForArrayComparison(resultsDirectory):
    """Computes and saves interesting quantities for the outrigger comparsion in the same folder as the mapmaking results."""
    print "Now computing other interesting mapmaking and array quantities..."
    s, times, ps, Dmatrix, PSF, coaddedMap, pointSourcePSF = MapMats.loadAllResults(resultsDirectory)

    #Info about calibratability    
    redundantInfo = oi.RedundantInfo()
    reds = oai.compute_reds(s.antennaPositions)
    redundantInfo.init_from_reds(reds, s.antennaPositions)
    AtransA = redundantInfo.At.dot(redundantInfo.At.T).toarray()
    BtransB = redundantInfo.Bt.dot(redundantInfo.Bt.T).toarray()    
    np.save(resultsDirectory + "omniAtransA",AtransA)
    np.save(resultsDirectory + "omniBtransB",BtransB)
    gainVariances = np.diag(np.linalg.pinv(AtransA)[0:s.nAntennas,0:s.nAntennas])
    np.save(resultsDirectory + "gainVariances",gainVariances)
    np.savetxt(resultsDirectory + "nZeroEVs.txt", [np.sum(np.abs(np.linalg.eigvals(XtransX)<1e-10)) for XtransX in [AtransA, BtransB]], fmt='%.d')    
    
    coords = Geometry.Coordinates(s)
    if s.useAdaptiveHEALPixForPSF: coords.convertToAdaptiveHEALPix(s, times)
    print "There are " + str(coords.nPSFPixels) + " pixels in the PSF and " + str(coords.nFacetPixels) + " in the map."
    pickle.dump(coords, open(resultsDirectory + "coords.p","wb"), protocol = -1)    
    mapNoiseCovariance = np.dot(PSF[:,coords.facetIndexLocationsInPSFIndexList],np.transpose(np.diag(Dmatrix)))
    AtransNinvA = np.dot(np.diag(Dmatrix**-1),PSF[:,coords.facetIndexLocationsInPSFIndexList])
    posVarIndicies = (np.diag(AtransNinvA)>0)
    AtransNinvA = AtransNinvA[posVarIndicies,:][:,posVarIndicies] #Deal with the fact that if I map the whole sky, some pixels are not sampled.
    mapNoiseCovariance = mapNoiseCovariance[posVarIndicies,:][:,posVarIndicies]
    evals, evecs = SortedEigensystem(AtransNinvA)
    np.save(resultsDirectory + "mapNoiseCovariance",mapNoiseCovariance)
    np.save(resultsDirectory + "AtransNinvA", AtransNinvA)
    np.save(resultsDirectory + "noiseEvals", evals)
    np.save(resultsDirectory + "noiseEvecs", evecs)
    np.save(resultsDirectory + "posVarIndicies", posVarIndicies)    
    print "Finished with " + resultsDirectory + "\n\n\n"
Beispiel #3
0
#     plt.xlim(-350,350); plt.ylim(-350,350)
# #        plt.colorbar()
#     plt.title('Baseline Redundancy')
#     #datacursor(display='single',formatter="x={x:.4f}\ny={y:.4f}".format)
#     #plt.axis('equal')
#     return np.asarray(positions), np.asarray(positions[0:nCore])

# if __name__ == "__main__":
#     positions,corePos = HexArray(hexNum = 11, SplitCore = True, SplitCoreOutriggers = True, CutDownTo = None, SpreadOut128 = False)

if True:                
    import omnical.info as oi
    import omnical.arrayinfo as oai
    redundantInfo = oi.RedundantInfo()
    positions = np.asarray(positions)
    reds = oai.compute_reds(positions)
    redundantInfo.init_from_reds(reds, positions)
    
    AtransA = redundantInfo.At.dot(redundantInfo.At.T).toarray()
    BtransB = redundantInfo.Bt.dot(redundantInfo.Bt.T).toarray()    
    gainVariances = np.diag(np.linalg.pinv(AtransA)[0:len(positions),0:len(positions)])
    print "Gain and phase modes that can't be Omnicaled:"
    print [len(XtransX) - np.linalg.matrix_rank(XtransX, tol=1e-10) for XtransX in [AtransA, BtransB]]
    plt.figure(3)
    plt.clf()
    hexScatter = plt.scatter(positions[:,0], positions[:,1], c=np.sqrt(gainVariances), s=100)
    plt.colorbar()
    plt.title('Antenna Relative Gain Errors')
#%%
if True:
    import omnical.info as oi
Beispiel #4
0
#     plt.xlim(-350,350); plt.ylim(-350,350)
# #        plt.colorbar()
#     plt.title('Baseline Redundancy')
#     #datacursor(display='single',formatter="x={x:.4f}\ny={y:.4f}".format)
#     #plt.axis('equal')
#     return np.asarray(positions), np.asarray(positions[0:nCore])

# if __name__ == "__main__":
#     positions,corePos = HexArray(hexNum = 11, SplitCore = True, SplitCoreOutriggers = True, CutDownTo = None, SpreadOut128 = False)

if True:
    import omnical.info as oi
    import omnical.arrayinfo as oai
    redundantInfo = oi.RedundantInfo()
    positions = np.asarray(positions)
    reds = oai.compute_reds(positions)
    redundantInfo.init_from_reds(reds, positions)

    AtransA = redundantInfo.At.dot(redundantInfo.At.T).toarray()
    BtransB = redundantInfo.Bt.dot(redundantInfo.Bt.T).toarray()
    gainVariances = np.diag(
        np.linalg.pinv(AtransA)[0:len(positions), 0:len(positions)])
    print "Gain and phase modes that can't be Omnicaled:"
    print[
        len(XtransX) - np.linalg.matrix_rank(XtransX, tol=1e-10)
        for XtransX in [AtransA, BtransB]
    ]
    plt.figure(3)
    plt.clf()
    hexScatter = plt.scatter(positions[:, 0],
                             positions[:, 1],
Beispiel #5
0
    plt.savefig(prefix + 'base.png', dpi=300)
#%%
else:
    plt.figure(1, figsize=(8, 8))
    plt.clf()
    plt.scatter(np.asarray(positions)[:, 0], np.asarray(positions)[:, 1])
    plt.xlabel('Position (m)')
    plt.ylabel('Position (m)')
    plt.axis('square')

if False:
    import omnical.info as oi
    import omnical.arrayinfo as oai
    redundantInfo = oi.RedundantInfo()
    positions = np.asarray(positions)
    reds = oai.compute_reds(positions)
    redundantInfo.init_from_reds(reds, positions)

    AtransA = redundantInfo.At.dot(redundantInfo.At.T).toarray()
    BtransB = redundantInfo.Bt.dot(redundantInfo.Bt.T).toarray()
    gainVariances = np.diag(
        np.linalg.pinv(AtransA)[0:len(positions), 0:len(positions)])
    print "Gain and phase modes that can't be Omnicaled:"
    print[
        len(XtransX) - np.linalg.matrix_rank(XtransX, tol=1e-10)
        for XtransX in [AtransA, BtransB]
    ]
    #%%
    plt.figure(3)
    plt.clf()
    hexScatter = plt.scatter(positions[:, 0],
Beispiel #6
0
        return np.asarray(positions)

if __name__ == "__main__":
#    positions = HexArray(hexNum = 11, LoadHERAOutriggers = True, fiducialInriggers = True)
#    positions = HexArray(hexNum = 11, RedundantOutriggers = False, fullCornerInriggers = False)
#    positions = HexArray(hexNum = 7, SplitCore = False, SplitCoreOutriggers = True)
    positions = HexArray(hexNum = 11, SplitCore = True, SplitCoreOutriggers = True)
#    positions = HexArray(hexNum = 6, SplitCore = False, fullCornerInriggers = False)

    
    
    if False:
        import omnical.info as oi
        import omnical.arrayinfo as oai
        redundantInfo = oi.RedundantInfo()
        reds = oai.compute_reds(positions)
        redundantInfo.init_from_reds(reds, positions)
        AtransA = redundantInfo.At.dot(redundantInfo.At.T).toarray()
        BtransB = redundantInfo.Bt.dot(redundantInfo.Bt.T).toarray()    
        gainVariances = np.diag(np.linalg.pinv(AtransA)[0:len(positions),0:len(positions)])
#        gainVariances = gainVariances/gainVariances.min()
        print "Gain and phase modes that can't be Omnicaled:"
#        print [np.sum(np.abs(np.linalg.eigvals(XtransX)<1e-10)) for XtransX in [AtransA, BtransB]]
        print [len(XtransX) - np.linalg.matrix_rank(XtransX, tol=1e-10) for XtransX in [AtransA, BtransB]]
#%%
        plt.figure(3)
        plt.clf()
        hexScatter = plt.scatter(positions[:,0], positions[:,1], c=np.sqrt(gainVariances), s=100)
        plt.colorbar()
        plt.title('Antenna Relative Gain Errors')