示例#1
0
def dispositionTask(clip):
    """Decide whether an event is a planet candidate or not

    TODO:
    Much of this should be parcelled off into a function
    """

    #Thresholds
    snrThreshold = clip['config.minSnrForDetection']
#    lppThreshold = clip['config.maxLppForTransit']
    offsetThreshold_sigma = clip['config.minCentroidSignifForFp']

    #Data on which to make a decision
    snr = clip['trapFit.snr']
    modshiftDict = clip['modshift']
    centroidArray = clip['diffImg.centroid_timeseries']

    out = clipboard.Clipboard(isSignificantEvent=True, isCandidate=True, \
        reasonForFail="None")
    if snr < snrThreshold:
        out['isSignificantEvent'] = False
        out['isCandidate'] = False
        out['reasonForFail'] = "SNR (%.1f) below threshold %.1f" \
            %(snr, snrThreshold)
        return out


    #Parse modshift results
    fluxVetDict = RoboVet.roboVet(modshiftDict)
    out['fluxVet'] = fluxVetDict
    assert(fluxVetDict['disp'] in ["candidate", "false positive"])

    if fluxVetDict['disp'] == "false positive":
        out['isCandidate'] = False
        out['reasonForFail'] = fluxVetDict['comments']
        return out

    #Compute centroid offset and significance
    result = cent.measureOffsetInTimeseries(centroidArray)
    out['centroidVet'] = result
    signif = result['signif']
    offset = result['offset']

    if signif > offsetThreshold_sigma:
        out['isCandidate'] = False
        out['reasonForFail'] = "Centroid offset of %.2f (%.1f sigma) detected" \
            %( offset, signif)
        return out

    clip['disposition'] = out

    #Enforce contract
    clip['disposition.isSignificantEvent']
    clip['disposition.isCandidate']
    clip['disposition.reasonForFail']
    return clip
示例#2
0
def vetTask(clip):

    print "WARN: vetTask is deprecated. Use dispostionTask instead"

    snr = clip['trapFit.snr']
    snrThreshold = clip['config.minSnrForDetection']
    lppThreshold = clip['config.maxLppForTransit']
    offsetThreshold_sigma = clip['config.minCentroidSignifForFp']

    out = clipboard.Clipboard(isCandidate=True, reasonForFail="None")
    if snr < snrThreshold:
        out['isCandidate'] = False
        out['reasonForFail'] = "SNR (%.1f) below threshold %.1f" \
            %(snr, snrThreshold)
#        clip['vet'] = out
#        return clip

    clip = lppMetricTask(clip)
    if 'exception' in clip.keys():
        return clip

#    Tlpp = clip['lpp.TLpp']
#    if Tlpp > lppThreshold:
#        out['isCandidate'] = False
#        out['reasonForFail'] = "TLpp (%.1f) above threshold %.1f" \
#            %(Tlpp, lppThreshold)
##        clip['vet'] = out
##        return clip

    clip = modshiftTask(clip)
    if 'exception' in clip.keys():
        return clip
    modshift = clip['modshift']
    fluxVetDict = RoboVet.roboVet(modshift)
    out['fluxVet'] = fluxVetDict

    assert(fluxVetDict['disp'] in ["candidate", "false positive"])

    if fluxVetDict['disp'] == "false positive":
        out['isCandidate'] = False
        out['reasonForFail'] = fluxVetDict['comments']
#        clip['vet'] = out
#        return clip

    clip = measureDiffImgCentroidsTask(clip)
    if 'exception' in clip.keys():
        return clip
    centroids = clip['diffImg.centroid_timeseries']

    result = cent.measureOffsetInTimeseries(centroids)
    out['centroidVet'] = result
    signif = result['signif']
    offset = result['offset']

    if signif > offsetThreshold_sigma:
        out['isCandidate'] = False
        out['reasonForFail'] = "Centroid offset of %.2f (%.1f sigma) detected" \
            %( offset, signif)
#        clip['vet'] = out
#        return clip


    clip['vet'] = out

    #Enforce contract
    clip['vet.isCandidate']
    clip['vet.reasonForFail']
    return clip