def plot_sn_discovery_ratio_map(log,
                                snSurveyDiscoveryTimes,
                                redshifts,
                                peakAppMagList,
                                snCampaignLengthList,
                                extraSurveyConstraints,
                                pathToOutputPlotFolder):
    """
    *Plot the SN discoveries and non-discoveries in a polar plot as function of redshift*

    **Key Arguments:**
        - ``log`` -- logger
        - ``snSurveyDiscoveryTimes`` --
        - ``redshifts`` --
        - ``peakAppMagList`` -- the list of peakmags for each SN in each filter
        - ``snCampaignLengthList`` -- a list of campaign lengths in each filter
        - ``extraSurveyConstraints`` --
        - ``pathToOutputPlotDirectory`` -- path to add plots to


    **Return:**
        - None
    """
    ################ > IMPORTS ################
    ## STANDARD LIB ##
    import sys
    ## THIRD PARTY ##
    import matplotlib.pyplot as plt
    import numpy as np
    ## LOCAL APPLICATION ##
    import dryxPython.plotting as dp
    filters = ['g', 'r', 'i', 'z']
    faintMagLimit = extraSurveyConstraints['Faint-Limit of Peak Magnitude']

    ################ >ACTION(S) ################
    discovered = []
    tooFaint = []
    shortCampaign = []
    discoveredRedshift = []
    tooFaintRedshift = []
    notDiscoveredRedshift = []
    shortCampaignRedshift = []
    #log.info('len(redshifts) %s' % (len(redshifts),))
    dataDictionary = {}
    for item in range(len(redshifts)):
        if snSurveyDiscoveryTimes[item]['any'] is True:
            discoveryDayList = []
            faintDayList = []
            shortCampaignDayList = []
            for ffilter in filters:
                if snSurveyDiscoveryTimes[item][ffilter]:
                    if peakAppMagList[item][ffilter] < faintMagLimit:
                        if snCampaignLengthList[item]['max'] < extraSurveyConstraints['Observable for at least ? number of days']:
                            shortCampaignDayList.append(
                                snSurveyDiscoveryTimes[item][ffilter])
                        else:
                            discoveryDayList.append(
                                snSurveyDiscoveryTimes[item][ffilter])
                    else:
                        faintDayList.append(
                            snSurveyDiscoveryTimes[item][ffilter])

            if len(discoveryDayList) > 0:
                discovered.append(min(discoveryDayList))
                discoveredRedshift.append(redshifts[item])
            elif len(shortCampaignDayList) > 0:
                shortCampaign.append(min(shortCampaignDayList))
                shortCampaignRedshift.append(redshifts[item])
            else:
                tooFaint.append(min(faintDayList))
                tooFaintRedshift.append(redshifts[item])
        else:
            notDiscoveredRedshift.append(redshifts[item])

    if len(notDiscoveredRedshift) > 0:
        dataDictionary["Undiscovered"] = notDiscoveredRedshift
    if len(tooFaintRedshift) > 0:
        dataDictionary[
            "Detected - too faint to constrain as transient"] = tooFaintRedshift
    if len(discoveredRedshift) > 0:
        dataDictionary["Discovered"] = discoveredRedshift
    if len(shortCampaignRedshift) > 0:
        dataDictionary[
            "Detected - campaign to short to constrain as transient"] = shortCampaignRedshift

    maxInList = max(redshifts) * 1.1

    ################ >ACTION(S) ################
    imageLink = plot_polar(
        log,
        title="Redshift Map of transients Simulated within the Survey Volume",
        dataDictionary=dataDictionary,
        pathToOutputPlotsFolder=pathToOutputPlotFolder,
        dataRange=False,
        ylabel=False,
        radius=maxInList,
        circumference=False,
        circleTicksRange=(0, 360, 60),
        circleTicksLabels=".",
        prependNum=False)

    return imageLink
def plot_sn_discovery_ratio_map ( log , snSurveyDiscoveryTimes , redshifts , peakAppMagList , snCampaignLengthList , extraSurveyConstraints , pathToOutputPlotFolder ) : import sys import matplotlib . pyplot as plt import numpy as np import dryxPython . plotting as dp filters = [ 'g' , 'r' , 'i' , 'z' ] faintMagLimit = extraSurveyConstraints [ 'Faint-Limit of Peak Magnitude' ] discovered = [ ] tooFaint = [ ] shortCampaign = [ ] discoveredRedshift = [ ] tooFaintRedshift = [ ] notDiscoveredRedshift = [ ] shortCampaignRedshift = [ ] dataDictionary = { } for item in range ( len ( redshifts ) ) : if snSurveyDiscoveryTimes [ item ] [ 'any' ] is True : discoveryDayList = [ ] faintDayList = [ ] shortCampaignDayList = [ ] for ffilter in filters : if snSurveyDiscoveryTimes [ item ] [ ffilter ] : if peakAppMagList [ item ] [ ffilter ] < faintMagLimit : if snCampaignLengthList [ item ] [ 'max' ] < extraSurveyConstraints [ 'Observable for at least ? number of days' ] : shortCampaignDayList . append ( snSurveyDiscoveryTimes [ item ] [ ffilter ] ) else : discoveryDayList . append ( snSurveyDiscoveryTimes [ item ] [ ffilter ] ) else : faintDayList . append ( snSurveyDiscoveryTimes [ item ] [ ffilter ] ) if len ( discoveryDayList ) > 0 : discovered . append ( min ( discoveryDayList ) ) discoveredRedshift . append ( redshifts [ item ] ) elif len ( shortCampaignDayList ) > 0 : shortCampaign . append ( min ( shortCampaignDayList ) ) shortCampaignRedshift . append ( redshifts [ item ] ) else : tooFaint . append ( min ( faintDayList ) ) tooFaintRedshift . append ( redshifts [ item ] ) else : notDiscoveredRedshift . append ( redshifts [ item ] ) if len ( notDiscoveredRedshift ) > 0 : dataDictionary [ "Undiscovered" ] = notDiscoveredRedshift if len ( tooFaintRedshift ) > 0 : dataDictionary [ "Detected - too faint to constrain as transient" ] = tooFaintRedshift if len ( discoveredRedshift ) > 0 : dataDictionary [ "Discovered" ] = discoveredRedshift if len ( shortCampaignRedshift ) > 0 : dataDictionary [ "Detected - campaign to short to constrain as transient" ] = shortCampaignRedshift maxInList = max ( redshifts ) * 1.1 imageLink = plot_polar ( log , title = "Redshift Map of transients Simulated within the Survey Volume" , dataDictionary = dataDictionary , pathToOutputPlotsFolder = pathToOutputPlotFolder , dataRange = False , ylabel = False , radius = maxInList , circumference = False , circleTicksRange = ( 0 , 360 , 60 ) , circleTicksLabels = "." , prependNum = False ) return imageLink
*Plot the SN discoveries and non-discoveries in a polar plot as function of redshift*

    **Key Arguments:**
        - ``log`` -- logger
        - ``snSurveyDiscoveryTimes`` --
        - ``redshifts`` --
        - ``peakAppMagList`` -- the list of peakmags for each SN in each filter
        - ``snCampaignLengthList`` -- a list of campaign lengths in each filter
        - ``extraSurveyConstraints`` --
        - ``pathToOutputPlotDirectory`` -- path to add plots to


    **Return:**
        - None