Example #1
0
def extractLightcurveTask(clip):
    time = clip['serve.time']
    data = clip['serve.socData']
    numInitialCadencesToIgnore = int(clip['config.numInitialCadencesToIgnore'])
    flagValues = clip.get('serve.flags', data[:, 'SAP_QUALITY'])
    flux = data[:, 'SAP_FLUX'].copy()

    #Convert flags to a boolean, and flag other bad data
    mask = kplrfits.getMaskForBadK2Data()
    flags = (flagValues & mask).astype(bool)
    flags |= ~np.isfinite(time)
    flags |= ~np.isfinite(flux)
    #flags[flux<1] = True
    flags[:numInitialCadencesToIgnore] = True

    #Placeholder. Use the SOC PA data for the lightcurve
    out = dict()
    out['rawLightcurve'] = flux
    out['time'] = time
    clip['extract'] = out
    clip['extract.source'] = "SOC PA Pipeline"
    clip['extract.flags'] = flags

    #Enforce contract
    clip['extract.rawLightcurve']
    clip['extract.flags']
    return clip
Example #2
0
def extractLightcurveTask(clip):
    time = clip['serve.time']
    data = clip['serve.socData']
    numInitialCadencesToIgnore = clip['config.numInitialCadencesToIgnore']
    flagValues = clip.get('serve.flags', data[:, 'SAP_QUALITY'])
    flux = data[:, 'SAP_FLUX'].copy()

    #Convert flags to a boolean, and flag other bad data
    mask = kplrfits.getMaskForBadK2Data()
    flags = (flagValues & mask).astype(bool)
    flags |= ~np.isfinite(time)
    flags |= ~np.isfinite(flux)
    #flags[flux<1] = True
    flags[:numInitialCadencesToIgnore] = True

    #Placeholder. Use the SOC PA data for the lightcurve
    out = dict()
    out['rawLightcurve'] = flux
    out['time'] = time
    clip['extract'] = out
    clip['extract.source'] = "SOC PA Pipeline"
    clip['extract.flags'] = flags

    #Enforce contract
    clip['extract.rawLightcurve']
    clip['extract.flags']
    return clip
Example #3
0
def extractLightcurveFromTpfTask(clip):
    from dave.tpf2lc.tpf2lc import optimalAperture
    time = clip['serve.time']
    fluxcube = clip['serve.cube']
    data = clip['serve.socData']
    socflux = data[:, 'SAP_FLUX']
    numInitialCadencesToIgnore = clip['config.numInitialCadencesToIgnore']
    flagValues = clip.get('serve.flags', data[:, 'SAP_QUALITY'])

    #Convert flags to a boolean, and flag other bad data
    mask = kplrfits.getMaskForBadK2Data()
    flags = (flagValues & mask).astype(bool)
    flags |= ~np.isfinite(time)
    flags |= ~np.isfinite(socflux)
    flags[socflux < 1] = True
    flags[:numInitialCadencesToIgnore] = True

    newtime, flux, xbar, ybar, _, _ = optimalAperture(time[~flags],
                                                      fluxcube[~flags],
                                                      flags[~flags],
                                                      qual_cut=False,
                                                      bg_cut=4)

    newY = socflux.copy()
    newXbar = np.zeros_like(socflux)
    newYbar = np.zeros_like(socflux)
    newY[~flags] = flux
    newXbar[~flags] = xbar
    newYbar[~flags] = ybar

    #Placeholder. Use the SOC PA data for the lightcurve
    out = dict()
    out['rawLightcurve'] = newY
    clip['extract'] = out
    clip['extract.source'] = "Labeled Extraction Pipeline"
    clip['extract.flags'] = flags
    clip['extract.centroid_col'] = newXbar
    clip['extract.centroid_row'] = newYbar

    #Enforce contract
    clip['extract.rawLightcurve']
    clip['extract.flags']
    return clip
Example #4
0
def extractLightcurveFromTpfTask(clip):
    from dave.tpf2lc.tpf2lc import optimalAperture
    time = clip['serve.time']
    fluxcube = clip['serve.cube']
    data = clip['serve.socData']
    socflux = data[:,'SAP_FLUX']
    numInitialCadencesToIgnore = clip['config.numInitialCadencesToIgnore']
    flagValues = clip.get('serve.flags', data[:, 'SAP_QUALITY'])

    #Convert flags to a boolean, and flag other bad data
    mask = kplrfits.getMaskForBadK2Data()
    flags = (flagValues & mask).astype(bool)
    flags |= ~np.isfinite(time)
    flags |= ~np.isfinite(socflux)
    flags[socflux<1] = True
    flags[:numInitialCadencesToIgnore] = True

    newtime, flux, xbar, ybar, _, _ = optimalAperture(time[~flags], fluxcube[~flags], flags[~flags],
        qual_cut=False,
        bg_cut=4)

    newY = socflux.copy()
    newXbar = np.zeros_like(socflux)
    newYbar = np.zeros_like(socflux)
    newY[~flags] = flux
    newXbar[~flags] = xbar
    newYbar[~flags] = ybar

    #Placeholder. Use the SOC PA data for the lightcurve
    out = dict()
    out['rawLightcurve'] = newY
    clip['extract'] = out
    clip['extract.source'] = "Labeled Extraction Pipeline"
    clip['extract.flags'] = flags
    clip['extract.centroid_col'] = newXbar
    clip['extract.centroid_row'] = newYbar

    #Enforce contract
    clip['extract.rawLightcurve']
    clip['extract.flags']
    return clip