Beispiel #1
0
def getCatchData(ra, dec, cache):
    r1 = int(ra / 5) * 5
    r2 = r1 + 5

    d1 = int(dec / 5) * 5
    if dec < 0:
        if d1 <= 0:
            d1 -= 5
    d2 = d1 + 5

    fileName = "ucal_magsqw_r%d-%d_d%d-%d.fits" % (r1, r2, d1, d2)

    data = getCache(cache, fileName)

    if data is not None:
        return data

    filePath = os.path.join(pastarrDir, fileName)

    if not os.path.exists(filePath):
        return None

    fitsInfo = astroUtil.getFitsInfo(filePath)
    data = fitsInfo[1].data
    cacheValue = []

    for row in data:
        mags = row[6]
        rowValue = [row[0], row[1], mags[0], mags[1], mags[2], mags[3], mags[4]]
        cacheValue.append(rowValue)

    addCache(cache, fileName, cacheValue)
    return cacheValue
Beispiel #2
0
    def fitsToDatabase(self, strategy):
        strategy.preHandle()

        filePaths = util.listDirFiles(strategy.dirPath, ".fits")
        for filePath in filePaths:
            try:
                fitsInfo = astroUtil.getFitsInfo(filePath)
                strategy.handle(fitsInfo)
            except Exception, ex:
                exUtil.printTagMessage(ex, "Fits handle error", filePath)