Beispiel #1
0
def main():
    ar = mastio2.K2Archive()

    kepid = 206011438 #WD
    kepid = 206103150 #WASP star

    fits = ar.getLongCadence(kepid, 3)
    time = fits['TIME']
    cin = fits['CADENCENO']
    flags = fits['SAP_QUALITY']
    pa = fits['SAP_FLUX']
    pdc = fits['PDCSAP_FLUX']
    cent1 = fits['MOM_CENTR1']
    cent2 = fits['MOM_CENTR2']
    badIdx = flags > 0

    #Compute roll phase
    centColRow = np.vstack((cent1, cent2)).transpose()
    rot = roll.computeArcLength(centColRow, flags>0)
    rollPhase = rot[:,0]
    rollPhase[flags>0] = -9999    #A bad value

    fits, hdr = ar.getLongTpf(kepid, 3, header=True)
    cube = tpf.getTargetPixelArrayFromFits(fits, hdr)
    gain = hdr['gain']
    cube *= gain

#    i0 = np.random.randint(0, len(cin))
    i0 = 2622

    mp.figure(1)
    itr = cube[i0]
    oot = diffimg.getInterpolatedOotImage(cube, rollPhase, flags, i0)
    diff = itr-oot
    diffimg.plotDiffDiagnostic(diff, oot, itr)
Beispiel #2
0
def oldStuff():
    ar = mastio2.K2Archive()

    kepid = 206103150
    period = 4.16
    t0 = 2154.14

    fits = ar.getLongCadence(kepid, 3)
    data = kplrfits.getNumpyArrayFromFitsRec(fits)
    time = fits['TIME']
    cin = fits['CADENCENO']
    flags = fits['SAP_QUALITY']
    pa = fits['SAP_FLUX']
    pdc = fits['PDCSAP_FLUX']

    print fits.dtype
    mp.clf()
    mp.plot( fits['MOM_CENTR1'], fits['MOM_CENTR2'], 'k.')
    return


    mp.figure(2)
    mp.clf()
    pkf.plotKeplerFlags(flags, time)
    mp.axvline(t0, color='r')
    mp.xlim(2153, 2156)


    mp.figure(3)
    mp.clf()
    mp.plot(cin, pdc, 'k.')
    wh = np.where( flags & kplrfits.SapQuality['DefiniteThruster'])[0]
    for w in wh:
        mp.axvline(cin[w])
    mp.xlim(100200, 103600)

#    epochs = np.arange(-10,10)
#    print epochs
#    for e in epochs:
#        t = t0 + e*period
#        mp.axvline(t, color='r')
    return


    fits, hdr = ar.getTargetPixelFile(kepid, 3, header=True)
    cube = tpf.getTargetPixelArrayFromFits(fits, hdr)

    diff, oot, intr = diffimg.generateDifferenceImage(time, cube, t0, 4.0)

    mp.figure(1)
    diffimg.plotDiffDiagnostic(diff, oot, intr)

    mp.figure(3)
    idx = (time > t0-1) & (time < t0+1)
    plotTpf.plotTpfLc(cube[idx, :, :], hdr, big=True)
Beispiel #3
0
def oldStuff():
    ar = mastio2.K2Archive()

    kepid = 206103150
    period = 4.16
    t0 = 2154.14

    fits = ar.getLongCadence(kepid, 3)
    data = kplrfits.getNumpyArrayFromFitsRec(fits)
    time = fits['TIME']
    cin = fits['CADENCENO']
    flags = fits['SAP_QUALITY']
    pa = fits['SAP_FLUX']
    pdc = fits['PDCSAP_FLUX']

    print fits.dtype
    mp.clf()
    mp.plot(fits['MOM_CENTR1'], fits['MOM_CENTR2'], 'k.')
    return

    mp.figure(2)
    mp.clf()
    pkf.plotKeplerFlags(flags, time)
    mp.axvline(t0, color='r')
    mp.xlim(2153, 2156)

    mp.figure(3)
    mp.clf()
    mp.plot(cin, pdc, 'k.')
    wh = np.where(flags & kplrfits.SapQuality['DefiniteThruster'])[0]
    for w in wh:
        mp.axvline(cin[w])
    mp.xlim(100200, 103600)

    #    epochs = np.arange(-10,10)
    #    print epochs
    #    for e in epochs:
    #        t = t0 + e*period
    #        mp.axvline(t, color='r')
    return

    fits, hdr = ar.getTargetPixelFile(kepid, 3, header=True)
    cube = tpf.getTargetPixelArrayFromFits(fits, hdr)

    diff, oot, intr = diffimg.generateDifferenceImage(time, cube, t0, 4.0)

    mp.figure(1)
    diffimg.plotDiffDiagnostic(diff, oot, intr)

    mp.figure(3)
    idx = (time > t0 - 1) & (time < t0 + 1)
    plotTpf.plotTpfLc(cube[idx, :, :], hdr, big=True)
Beispiel #4
0
def main():
    ar = mastio2.K2Archive()

    kepid = 206103150
    period = 4.16
    t0 = 2168.43 #2154.14

    fits = ar.getLongCadence(kepid, 3)
    time = fits['TIME']
    cin = fits['CADENCENO']
    flags = fits['SAP_QUALITY']
    pa = fits['SAP_FLUX']
    pdc = fits['PDCSAP_FLUX']
    cent1 = fits['MOM_CENTR1']
    cent2 = fits['MOM_CENTR2']
    badIdx = flags > 0

    i0 = np.random.randint(0, len(cin))

    fits, hdr = ar.getLongTpf(kepid, 3, header=True)
    cube = tpf.getTargetPixelArrayFromFits(fits, hdr)
    gain = hdr['gain']
#    cube *= gain

    #Compute roll phase
    centColRow = np.vstack((cent1, cent2)).transpose()
    rot = computeArcLength(centColRow, flags>0)
    rollPhase = rot[:,0]
    rollPhase[flags>0] = -9999    #A bad value


    diffimg.constructK2DifferenceImage(cube,  578, rollPhase, flags)
    return
    for i in range(180, len(rollPhase)):
        mp.clf()
        try:
            diffimg.constructK2DifferenceImage(cube,  [i], rollPhase, flags)
        except ValueError:
            continue

        mp.savefig('fig-%05i.png' %(i))
Beispiel #5
0
def oldStuff():
    #Compute roll phase
    centColRow = np.vstack((cent1, cent2)).transpose()
    rot = computeArcLength(centColRow, flags > 0)
    rollPhase = rot[:, 0]
    rollPhase[flags > 0] = -9999  #A bad value

    #Index of transit
    mp.clf()
    time[~np.isfinite(time)] = -1
    i = np.argmin(np.fabs(time - t0))

    i0 = i
    indexBefore, indexAfter = diffimg.getIndicesOfOotImages(
        rollPhase, i0, flags)
    if True:
        mp.figure(1)
        mp.clf()
        rp0 = rollPhase[i]
        mp.axvline(time[i], color='r')
        mp.axhline(rp0, color='grey')
        mp.axvline(time[indexBefore], color='g')
        mp.axvline(time[indexAfter], color='g')
        mp.plot(time[~badIdx], rollPhase[~badIdx], 'k.')
        mp.plot(time[~badIdx], rot[~badIdx, 1], 'r.')
        plotThrusterFirings(flags, time)
        #            mp.xlim([2150, 2160])
        #            mp.savefig('diag%+i.png' %(i0))
        mp.xlim(2162, 2172)

    fits, hdr = ar.getTargetPixelFile(kepid, 3, header=True)
    cube = tpf.getTargetPixelArrayFromFits(fits, hdr)

    mp.figure(2)
    mp.clf()
    #    indexInTransit = np.arange(i-4, i+5)
    indexInTransit = [i0]
    diff, oot = diffimg.constructK2DifferenceImage(cube, indexInTransit,
                                                   rollPhase, flags)
    diffimg.plotDiffDiagnostic(diff, oot, cube[i])
Beispiel #6
0
def main():
    ar = mastio2.K2Archive()

    kepid = 206103150
    period = 4.16
    t0 = 2168.43  #2154.14

    fits = ar.getLongCadence(kepid, 3)
    time = fits['TIME']
    cin = fits['CADENCENO']
    flags = fits['SAP_QUALITY']
    pa = fits['SAP_FLUX']
    pdc = fits['PDCSAP_FLUX']
    cent1 = fits['MOM_CENTR1']
    cent2 = fits['MOM_CENTR2']
    badIdx = flags > 0

    i0 = np.random.randint(0, len(cin))

    fits, hdr = ar.getLongTpf(kepid, 3, header=True)
    cube = tpf.getTargetPixelArrayFromFits(fits, hdr)
    gain = hdr['gain']
    #    cube *= gain

    #Compute roll phase
    centColRow = np.vstack((cent1, cent2)).transpose()
    rot = computeArcLength(centColRow, flags > 0)
    rollPhase = rot[:, 0]
    rollPhase[flags > 0] = -9999  #A bad value

    diffimg.constructK2DifferenceImage(cube, 578, rollPhase, flags)
    return
    for i in range(180, len(rollPhase)):
        mp.clf()
        try:
            diffimg.constructK2DifferenceImage(cube, [i], rollPhase, flags)
        except ValueError:
            continue

        mp.savefig('fig-%05i.png' % (i))
Beispiel #7
0
def oldStuff():
    #Compute roll phase
    centColRow = np.vstack((cent1, cent2)).transpose()
    rot = computeArcLength(centColRow, flags>0)
    rollPhase = rot[:,0]
    rollPhase[flags>0] = -9999    #A bad value

    #Index of transit
    mp.clf()
    time[ ~np.isfinite(time)] = -1
    i = np.argmin( np.fabs( time-t0))

    i0 = i
    indexBefore, indexAfter = diffimg.getIndicesOfOotImages(rollPhase, i0, flags)
    if True:
        mp.figure(1)
        mp.clf()
        rp0 = rollPhase[i]
        mp.axvline(time[i], color='r')
        mp.axhline(rp0, color='grey')
        mp.axvline(time[indexBefore], color='g')
        mp.axvline(time[indexAfter], color='g')
        mp.plot(time[~badIdx], rollPhase[~badIdx], 'k.')
        mp.plot(time[~badIdx], rot[~badIdx, 1], 'r.')
        plotThrusterFirings(flags,time)
#            mp.xlim([2150, 2160])
#            mp.savefig('diag%+i.png' %(i0))
        mp.xlim(2162,2172)

    fits, hdr = ar.getTargetPixelFile(kepid, 3, header=True)
    cube = tpf.getTargetPixelArrayFromFits(fits, hdr)

    mp.figure(2)
    mp.clf()
#    indexInTransit = np.arange(i-4, i+5)
    indexInTransit = [i0]
    diff, oot = diffimg.constructK2DifferenceImage(cube, indexInTransit, rollPhase, flags)
    diffimg.plotDiffDiagnostic(diff, oot, cube[i])