*Given the observed frame lightcurve, determine when the discovered SNe become too faint to be detected.*

    **Key Arguments:**
        - ``log`` -- logger
        - ``redshiftArray`` -- the array of random redshifts
        - ``observedFrameLightCurveInfo`` -- the observed franme lightcurve info (dictionary)
        - ``ripeDayList`` -- a list of dictionaries describing if the object is discoverable in each filter and finally if it is discoverable in any filter.
        - ``plot`` -- generate plots?

    **Return:**
        - ``disappearDayList`` -- a list of dictionaries describing the time relative to peak that the SN reaches the limiting mag of the survey

def determine_when_discovered_sne_disappear(
        log,
        redshiftArray,
        limitingMags,
        observedFrameLightCurveInfo,
        ripeDayList,
        plot=True):
    """
    *Given the observed frame lightcurve, determine when the discovered SNe become too faint to be detected.*

    **Key Arguments:**
        - ``log`` -- logger
        - ``redshiftArray`` -- the array of random redshifts
        - ``observedFrameLightCurveInfo`` -- the observed franme lightcurve info (dictionary)
        - ``ripeDayList`` -- a list of dictionaries describing if the object is discoverable in each filter and finally if it is discoverable in any filter.
        - ``plot`` -- generate plots?

    **Return:**
        - ``disappearDayList`` -- a list of dictionaries describing the time relative to peak that the SN reaches the limiting mag of the survey
    """
    ################ > IMPORTS ################
    ## STANDARD LIB ##
    import math
    ## THIRD PARTY ##
    ## LOCAL APPLICATION ##

    ################ >ACTION(S) ################
    filters = ['g', 'r', 'i', 'z']
    models = ['he80', 'he100', 'he130']

    disappearDayList = []
    for item in range(len(redshiftArray)):
        #log.info("I AM HERE %s" % (item,))
        disappearDayDict = {}
        if not ripeDayList[item]["any"]:
            disappearDayDict["any"] = False
            for ffilter in filters:
                disappearDayDict[ffilter] = False
        else:
            for ffilter in filters:
                if not ripeDayList[item][ffilter]:
                    disappearDayDict[ffilter] = False
                else:
                    lightCurveEndDay = observedFrameLightCurveInfo[
                        item]['endOfLightcurveDay']
                    lowerLimit = 0.
                    upperLimit = lightCurveEndDay
                    disappearDay = upperLimit
                    magGuess = observedFrameLightCurveInfo[item][
                        'lightCurves'][ffilter](disappearDay)
                    magDiff = limitingMags[ffilter] - magGuess
                    log.info('item %s disappearDay %s magGuess %s - going higher' %
                             (item, disappearDay, magGuess))

                    if magGuess > limitingMags[ffilter]:
                        while math.fabs(magDiff) > 0.01:
                            if magGuess > limitingMags[ffilter]:
                                log.info(
                                    'item %s disappearDay %s magGuess %s - going higher' % (item, disappearDay, magGuess))
                                upperLimit = disappearDay
                                disappearDay = lowerLimit + \
                                    (upperLimit - lowerLimit) / 2.
                                magGuess = observedFrameLightCurveInfo[item][
                                    'lightCurves'][ffilter](disappearDay)
                            elif magGuess < limitingMags[ffilter]:
                                log.info('item %s disappearDay %s' %
                                         (item, disappearDay))
                                lowerLimit = disappearDay
                                disappearDay = lowerLimit + \
                                    (upperLimit - lowerLimit) / 2.
                                magGuess = observedFrameLightCurveInfo[item][
                                    'lightCurves'][ffilter](disappearDay)
                            magDiff = limitingMags[ffilter] - magGuess
                    else:
                        disappearDay = "N.E.D."
                        log.warning(
                            """not enough data to determine when the SN disappears fainter than the survey's limiting mag""")

                    if type(disappearDay) != str:
                        disappearDay = float("%5.3f" % (disappearDay,))
                    # log.info('SN#%s, filter %s, disappearDay %s' % (item,
                    # ffilter, disappearDay,))
                    disappearDayDict[ffilter] = disappearDay
            disappearDayDict["any"] = False
            for ffilter in filters:
                if disappearDayDict[ffilter] and disappearDayDict[ffilter] != "N.E.D.":
                    disappearDayDict["any"] = True
        disappearDayList.append(disappearDayDict)

    log.info('disappearDayList %s' % (disappearDayList,))

    return disappearDayList