Exemplo n.º 1
0
def main():

	ara_logeV, ara_200m_aeff = detector.get_aeff('ara_200m_1year_fromlimit')
	phased_logeV, phased_aeff = detector.get_aeff('ara_phased_fromlimit')

	fig = plt.figure(figsize=(2.*11,8.5))
	ax_limit = fig.add_subplot(1,2,2)

	ax_aeff.plot(np.power(10.,ara_logeV),ara_200m_aeff,'-<', linewidth=2.0,color='blue',label=r'1 ARA 200m Station @ SP')
	beautify_aeff(ax_aeff)
	fig.savefig("try_super_station.png",edgecolor='none',bbox_inches="tight") #save the figure
def main():

    ara_logeV, ara_200m_limit = detector.get_limit('ara_200m_1year')
    arianna_logeV, arianna_limit = detector.get_limit(
        'arianna_hra3_singlestation_1year')
    testbed_logeV, testbed_limit = detector.get_limit('ara_testbed_1year')
    ara_100m_logeV, ara_100m_limit = detector.get_limit('ara_100m_1year')
    phased_logeV, phased_limit = detector.get_limit('ara_phased_1year')

    ara_logeV, ara_200m_aeff = detector.get_aeff('ara_200m_1year_fromlimit')
    arianna_logeV, arianna_aeff = detector.get_aeff(
        'arianna_hra3_single_fromlimit')
    testbed_logeV, testbed_aeff = detector.get_aeff('ara_testbed_fromlimit')
    ara_100m_logeV, ara_100m_aeff = detector.get_aeff(
        'ara_100m_1year_fromlimit')
    phased_logeV, phased_aeff = detector.get_aeff('ara_phased_fromlimit')

    #set up some theory stuff
    ahlers_data = np.genfromtxt("data/ahlers_2012.csv",
                                delimiter=',',
                                skip_header=1,
                                names=['energy', 'flux'])
    ahlers_energy_logev = ahlers_data['energy']
    ahlers_energy = np.power(10., ahlers_energy_logev)
    ahlers_limit_log = ahlers_data['flux']
    ahlers_limit = np.power(10., ahlers_limit_log)
    ahlers_interpolator = splrep(ahlers_energy_logev, ahlers_limit_log, k=4)

    icecube_energy_logev = np.array(
        [15.5, 16, 16.5, 17, 17.5, 18, 18.5, 19, 19.5, 20, 20.5])
    icecube_energy = np.power(10., icecube_energy_logev)

    #we can first have the IceCube thru-mu fluxes
    #we can have the nomina, and upper and lower 1 sigma possibilities
    def icecube_thrumu_function(E):
        return 3.03 * ((E / 1.e14)**-2.19) * 1e-27

    def icecube_thrumu_upper_function(E):
        return 3.81 * ((E / 1.e14)**-2.09) * 1e-27

    def icecube_thrumu_lower_function(E):
        return 2.34 * ((E / 1.e14)**-2.29) * 1e-27

    def icecube_combined_function(E):
        return 6.7 * ((E / 1.e14)**-2.50) * 1e-27

    def icecube_combined_upper_function(E):
        return 7.8 * ((E / 1.e14)**-2.41) * 1e-27

    def icecube_combined_lower_function(E):
        return 5.5 * ((E / 1.e14)**-2.59) * 1e-27

    #to compute to a curve on EF(E) we have to multiply by energy
    icecube_thrumu_efe = icecube_thrumu_function(
        icecube_energy) * icecube_energy
    icecube_thrumu_upper_efe = icecube_thrumu_upper_function(
        icecube_energy) * icecube_energy
    icecube_thrumu_lower_efe = icecube_thrumu_lower_function(
        icecube_energy) * icecube_energy

    icecube_combined_efe = icecube_combined_function(
        icecube_energy) * icecube_energy
    icecube_combined_upper_efe = icecube_combined_upper_function(
        icecube_energy) * icecube_energy
    icecube_combined_lower_efe = icecube_combined_lower_function(
        icecube_energy) * icecube_energy

    fig = plt.figure(figsize=(2. * 11, 8.5))
    ax_limit = fig.add_subplot(1, 2, 2)
    ax_aeff = fig.add_subplot(1, 2, 1)

    # ax_limit.plot(ahlers_energy,ahlers_limit,'-', linewidth=3.0,color='gray',label="Ahlers 2012")
    # ax_limit.fill_between(icecube_energy,icecube_thrumu_lower_efe,icecube_thrumu_upper_efe,facecolor='orange',alpha=0.3)
    # ax_limit.fill_between(icecube_energy,icecube_combined_lower_efe,icecube_combined_upper_efe,facecolor='magenta',alpha=0.3)
    # ax_limit.plot(icecube_energy,icecube_thrumu_efe,'-.', linewidth=3.0,color='orange',label=r'IceCube Thru-Mu (E$^{-2.19}$)')
    # ax_limit.plot(icecube_energy,icecube_combined_efe,':', linewidth=3.0,color='magenta',label='IceCube Combined (E$^{-2.50}$)')
    ax_limit.plot(np.power(10., phased_logeV),
                  phased_limit,
                  '-v',
                  linewidth=2.0,
                  color='magenta',
                  label=r'1 ARA Phased 200m Station @ SP, 1 Year')
    ax_limit.plot(np.power(10., ara_logeV),
                  ara_200m_limit,
                  '-<',
                  linewidth=2.0,
                  color='blue',
                  label=r'1 ARA 200m Station @ SP, 1 Year')
    ax_limit.plot(np.power(10., ara_100m_logeV),
                  ara_100m_limit,
                  '->',
                  linewidth=2.0,
                  color='black',
                  label=r'1 ARA 100m Station @ SP, 1 Year (approx)')
    ax_limit.plot(np.power(10., arianna_logeV),
                  arianna_limit / 0.58,
                  '-o',
                  linewidth=2.0,
                  color='green',
                  label=r'1 ARIANNA Surface Station @ MB, 0.58 Year')
    ax_limit.plot(np.power(10., testbed_logeV),
                  testbed_limit,
                  '-^',
                  linewidth=2.0,
                  color='red',
                  label=r'1 ARA Testbed Surface Station @ SP, 1 Year')
    beautify_limit(ax_limit)

    ax_aeff.plot(np.power(10., phased_logeV),
                 phased_aeff,
                 '-<',
                 linewidth=2.0,
                 color='magenta',
                 label=r'1 ARA Phased 200m Station @ SP')
    ax_aeff.plot(np.power(10., ara_logeV),
                 ara_200m_aeff,
                 '-<',
                 linewidth=2.0,
                 color='blue',
                 label=r'1 ARA 200m Station @ SP')
    ax_aeff.plot(np.power(10., ara_100m_logeV),
                 ara_100m_aeff,
                 '->',
                 linewidth=2.0,
                 color='black',
                 label=r'1 ARA 100m Station @ SP (approx)')
    ax_aeff.plot(np.power(10., arianna_logeV),
                 arianna_aeff,
                 '-o',
                 linewidth=2.0,
                 color='green',
                 label=r'1 ARIANNA Surface Station @ MB')
    ax_aeff.plot(np.power(10., testbed_logeV),
                 testbed_aeff,
                 '-^',
                 linewidth=2.0,
                 color='red',
                 label=r'1 ARA Testbed Surface Station @ SP')
    beautify_aeff(ax_aeff)
    fig.savefig("current_single_station_limits_and_aeff.png",
                edgecolor='none',
                bbox_inches="tight")  #save the figure

    #now,determine total sensitivity

    #need to set up joing limit energy bins
    total_energy_logeV = np.array(
        [16., 16.5, 17., 17.5, 18., 18.5, 19, 19.5, 20., 20.5, 21.])

    #need to insert two zeros in both ARA testbed and ARIANNA station
    #for 16 and 16.5 energy bins (no data there)
    testbed_aeff = np.insert(ara_200m_aeff, 0, 0., axis=0)
    testbed_aeff = np.insert(ara_200m_aeff, 0, 0., axis=0)

    #need to insert two zeros for 20.5 and 21 in phased array station
    phased_aeff = np.append(phased_aeff, 0.)
    phased_aeff = np.append(phased_aeff, 0.)

    #need to insert a 21 bin in ARA200m, ARA100m, ARIANNA
    ara_200m_aeff = np.append(ara_200m_aeff, 0.)
    ara_100m_aeff = np.append(ara_100m_aeff, 0.)

    # arianna_limit = np.insert(arianna_limit,0,0.,axis=0)
    # arianna_limit = np.insert(arianna_limit,0,0.,axis=0)
    # arianna_aeff = np.append(arianna_aeff,0.)

    #number of stations of each type of station
    num_testbed = 1.
    num_100m = 1.
    num_200m = 3.
    num_phased = 1.

    #livetime in seconds for each type of station
    live_testbed = 632. * const.SecPerDay
    live_100m = 731. * const.SecPerDay
    live_200m = 2991. * const.SecPerDay
    live_phased = 186. * const.SecPerDay

    #we multiply the number of stations by the livetime
    testbed_app_total = num_testbed * live_testbed * testbed_aeff
    ara_100m_app_total = num_100m * live_100m * ara_100m_aeff
    ara_200m_app_total = num_200m * live_200m * ara_200m_aeff
    phased_app_total = num_phased * live_phased * phased_aeff

    #units here are seconds * cm^2 * sr
    total_aeff = (num_testbed * testbed_aeff) + (num_100m * ara_100m_aeff) + (
        num_200m * ara_200m_aeff) + (num_phased * phased_aeff)
    total_app = testbed_app_total + ara_100m_app_total + ara_200m_app_total + phased_app_total
    total_limit = 1. / np.log(10) / 0.5 / total_app

    arianna_total_aeff = 8. * arianna_aeff
    arianna_total_app = ((3. * 170. * const.SecPerDay) +
                         (3. * 0.6 * const.SecPerYear) +
                         (4. * 170. * const.SecPerDay) +
                         (3. * 0.6 * const.SecPerYear) +
                         (7. * 0.6 * const.SecPerYear) +
                         (7. * 0.6 * const.SecPerYear) +
                         (7. / 12. * const.SecPerYear)) * arianna_aeff

    arianna_total_limit = 1. / np.log(10) / 0.5 / arianna_total_app

    fig2 = plt.figure(figsize=(2. * 11, 8.5))
    ax2_aeff = fig2.add_subplot(1, 2, 1)
    ax2_lim = fig2.add_subplot(1, 2, 2)

    ax2_lim.plot(ahlers_energy,
                 ahlers_limit,
                 '-',
                 linewidth=3.0,
                 color='gray',
                 label="Ahlers 2012")
    ax2_lim.fill_between(icecube_energy,
                         icecube_thrumu_lower_efe,
                         icecube_thrumu_upper_efe,
                         facecolor='orange',
                         alpha=0.3)
    ax2_lim.fill_between(icecube_energy,
                         icecube_combined_lower_efe,
                         icecube_combined_upper_efe,
                         facecolor='magenta',
                         alpha=0.3)
    ax2_lim.plot(icecube_energy,
                 icecube_thrumu_efe,
                 '-.',
                 linewidth=3.0,
                 color='orange',
                 label=r'IceCube Thru-Mu (E$^{-2.19}$)')
    ax2_lim.plot(icecube_energy,
                 icecube_combined_efe,
                 ':',
                 linewidth=3.0,
                 color='magenta',
                 label='IceCube Combined (E$^{-2.50}$)')
    ax2_lim.plot(np.power(10., total_energy_logeV),
                 total_limit,
                 '-o',
                 linewidth=2.0,
                 color='blue',
                 label=r'Total Time-Integrated ARA Sensitivity')
    ax2_lim.plot(np.power(10., arianna_logeV),
                 arianna_total_limit,
                 '-o',
                 linewidth=2.0,
                 color='green',
                 label=r'Total Time-Integrated ARIANNA Sensitivity')

    ax2_aeff.plot(np.power(10., total_energy_logeV),
                  phased_app_total,
                  '-o',
                  linewidth=2.0,
                  color='magenta',
                  label=r'PA')
    ax2_aeff.plot(np.power(10., total_energy_logeV),
                  total_aeff,
                  '-o',
                  linewidth=2.0,
                  color='blue',
                  label=r'Total Deployed ARA Sensitivity')
    ax2_aeff.plot(np.power(10., arianna_logeV),
                  arianna_total_aeff,
                  '-o',
                  linewidth=2.0,
                  color='green',
                  label=r'Total Deployed ARIANNA Sensitivity')

    beautify_aeff(ax2_aeff)
    beautify_limit_withtheory(ax2_lim, 3)
    ax2_aeff.set_ylim([1e2, 1e12])
    ax2_lim.set_ylim([1e-22, 1e-10])
    fig2.savefig("current_total_limits_and_aeff.png",
                 edgecolor='none',
                 bbox_inches="tight")  #save the figure

    #need interpolator for ARA deployed sensitivity
    total_ara_app_interpolator = splrep(total_energy_logeV,
                                        np.log10(total_app),
                                        k=4)

    #integrate up all the ARA sensitivity
    counts_ara_icecubethrumu = []
    counts_ara_icecubecombined = []
    counts_ara_ahlers = []
    energy_bins = []
    bins = np.arange(16, 20.5, 0.5)
    for bin in bins:
        temp_logev = np.arange(bin, bin + 0.5, 0.01)
        temp_energy = np.power(10., temp_logev)
        #the ara sensitivity
        temp_ara_aeff = np.power(10.,
                                 splev(temp_logev, total_ara_app_interpolator))

        #the flux estimates
        temp_icecube_thrumu = icecube_thrumu_function(temp_energy)
        temp_icecube_combined = icecube_combined_function(temp_energy)
        temp_ahlers = np.power(10., splev(temp_logev,
                                          ahlers_interpolator)) / temp_energy
        #the counts
        temp_counts_thrumu = np.trapz(temp_icecube_thrumu * temp_ara_aeff,
                                      temp_energy)
        temp_counts_combined = np.trapz(temp_icecube_combined * temp_ara_aeff,
                                        temp_energy)
        temp_counts_ahlers = np.trapz(temp_ahlers * temp_ara_aeff, temp_energy)

        counts_ara_icecubethrumu.append(temp_counts_thrumu)
        counts_ara_icecubecombined.append(temp_counts_combined)
        counts_ara_ahlers.append(temp_counts_ahlers)

        energy_bins.append(np.power(10., bin))

    counts_ara_icecubethrumu = np.array(counts_ara_icecubethrumu)
    counts_ara_icecubecombined = np.array(counts_ara_icecubecombined)
    counts_ara_ahlers = np.array(counts_ara_ahlers)
    energy_bins = np.array(energy_bins)

    #what's the phased array contribution
    pa_total_energy_logeV_for_interp = total_energy_logeV[:-2]
    pa_total_app_for_interp = phased_app_total[:-2]
    total_pa_app_interpolator = splrep(pa_total_energy_logeV_for_interp,
                                       np.log10(pa_total_app_for_interp),
                                       k=4)
    counts_pa_icecubethrumu = []
    counts_pa_icecubecombined = []
    counts_pa_ahlers = []
    pa_energy_bins = []
    bins = np.arange(16, 20.5, 0.5)
    for bin in bins:
        temp_logev = np.arange(bin, bin + 0.5, 0.01)
        temp_energy = np.power(10., temp_logev)
        temp_pa_aeff = np.power(10.,
                                splev(temp_logev, total_pa_app_interpolator))

        #the flux estimates
        temp_icecube_thrumu = icecube_thrumu_function(temp_energy)
        temp_icecube_combined = icecube_combined_function(temp_energy)
        temp_ahlers = np.power(10., splev(temp_logev,
                                          ahlers_interpolator)) / temp_energy

        temp_counts_thrumu_pa = np.trapz(temp_icecube_thrumu * temp_pa_aeff,
                                         temp_energy)
        temp_counts_combined_pa = np.trapz(
            temp_icecube_combined * temp_pa_aeff, temp_energy)
        temp_counts_ahlers_pa = np.trapz(temp_ahlers * temp_pa_aeff,
                                         temp_energy)

        counts_pa_icecubethrumu.append(temp_counts_thrumu_pa)
        counts_pa_icecubecombined.append(temp_counts_combined_pa)
        counts_pa_ahlers.append(temp_counts_ahlers_pa)

        pa_energy_bins.append(np.power(10., bin))
    counts_pa_icecubethrumu = np.array(counts_pa_icecubethrumu)
    counts_pa_icecubecombined = np.array(counts_pa_icecubecombined)
    counts_pa_ahlers = np.array(counts_pa_ahlers)

    print "total PA contributions %.4f, %.4f, %.4f" % (
        counts_pa_icecubethrumu.sum(), counts_pa_icecubecombined.sum(),
        counts_pa_ahlers.sum())

    #need interpolator for ARIANNA deployed sensitivity
    total_arianna_app_interpolator = splrep(arianna_logeV,
                                            np.log10(arianna_total_app),
                                            k=4)

    counts_arianna_icecubethrumu = []
    counts_arianna_icecubecombined = []
    counts_arianna_ahlers = []
    energy_bins_arianna = []
    bins = np.arange(17, 20, 0.5)
    for bin in bins:
        temp_logev = np.arange(bin, bin + 0.5, 0.01)
        temp_energy = np.power(10., temp_logev)

        #the ara sensitivity
        temp_arianna_aeff = np.power(
            10., splev(temp_logev, total_arianna_app_interpolator))

        #the flux estimates
        temp_icecube_thrumu = icecube_thrumu_function(temp_energy)
        temp_icecube_combined = icecube_combined_function(temp_energy)
        temp_ahlers = np.power(10., splev(temp_logev,
                                          ahlers_interpolator)) / temp_energy

        #the counts
        temp_counts_thrumu = np.trapz(temp_icecube_thrumu * temp_arianna_aeff,
                                      temp_energy)
        temp_counts_combined = np.trapz(
            temp_icecube_combined * temp_arianna_aeff, temp_energy)
        temp_counts_ahlers = np.trapz(temp_ahlers * temp_arianna_aeff,
                                      temp_energy)

        counts_arianna_icecubethrumu.append(temp_counts_thrumu)
        counts_arianna_icecubecombined.append(temp_counts_combined)
        counts_arianna_ahlers.append(temp_counts_ahlers)
        energy_bins_arianna.append(np.power(10., bin))

    counts_arianna_icecubethrumu = np.array(counts_arianna_icecubethrumu)
    counts_arianna_icecubecombined = np.array(counts_arianna_icecubecombined)
    counts_arianna_ahlers = np.array(counts_arianna_ahlers)
    energy_bins_arianna = np.array(energy_bins_arianna)

    fig3 = plt.figure(figsize=(2. * 11, 8.5))
    ax3_count_ara = fig3.add_subplot(1, 2, 1)
    ax3_count_arianna = fig3.add_subplot(1, 2, 2)
    ax3_count_ara.set_title("ARA", fontsize=24)
    ax3_count_arianna.set_title("ARIANNA", fontsize=24)
    n, bins, patches = ax3_count_ara.hist(
        energy_bins,
        bins=np.power(10., np.arange(16, 22, 1)),
        weights=counts_ara_ahlers,
        label=r'Ahlers 2012: %.2f' % counts_ara_ahlers.sum(),
        fill=False,
        stacked=True,
        histtype='step',
        edgecolor='red',
        linewidth=4)
    n, bins, patches = ax3_count_ara.hist(
        energy_bins,
        bins=np.power(10., np.arange(16, 22, 1)),
        weights=counts_ara_icecubethrumu,
        label=r'IceCube Thru-Mu E$^{-2.19}$: %.2f' %
        counts_ara_icecubethrumu.sum(),
        fill=False,
        stacked=True,
        histtype='step',
        edgecolor='blue',
        linewidth=4)
    n, bins, patches = ax3_count_ara.hist(
        energy_bins,
        bins=np.power(10., np.arange(16, 22, 1)),
        weights=counts_ara_icecubecombined,
        label=r'IceCube Combined E$^{-2.5}$: %.3f' %
        counts_ara_icecubecombined.sum(),
        fill=False,
        stacked=True,
        histtype='step',
        edgecolor='green',
        linewidth=4)

    n, bins, patches = ax3_count_arianna.hist(
        energy_bins_arianna,
        bins=np.power(10., np.arange(16, 22, 1)),
        weights=counts_arianna_ahlers,
        label=r'Ahlers 2012: %.2f' % counts_arianna_ahlers.sum(),
        fill=False,
        stacked=True,
        histtype='step',
        edgecolor='red',
        linewidth=4)
    n, bins, patches = ax3_count_arianna.hist(
        energy_bins_arianna,
        bins=np.power(10., np.arange(16, 22, 1)),
        weights=counts_arianna_icecubethrumu,
        label=r'IceCube Thru-Mu E$^{-2.19}$: %.2f' %
        counts_arianna_icecubethrumu.sum(),
        fill=False,
        stacked=True,
        histtype='step',
        edgecolor='blue',
        linewidth=4)
    n, bins, patches = ax3_count_arianna.hist(
        energy_bins_arianna,
        bins=np.power(10., np.arange(16, 22, 1)),
        weights=counts_arianna_icecubecombined,
        label=r'IceCube Combined E$^{-2.5}$: %.3f' %
        counts_arianna_icecubecombined.sum(),
        fill=False,
        stacked=True,
        histtype='step',
        edgecolor='green',
        linewidth=4)

    beautify_counts(ax3_count_ara)
    beautify_counts(ax3_count_arianna)
    ax3_count_ara.set_ylim([0, 3])
    ax3_count_arianna.set_ylim([0, 0.08])

    fig3.savefig("counts.png", edgecolor='none',
                 bbox_inches="tight")  #save the figure
Exemplo n.º 3
0
def main():

    icecube_logeV, icecube_limit = detector.get_limit('icecube_2018')
    anita_logeV, anita_limit = detector.get_limit('anita_2018')

    icecube_exposure = 2.44 / np.log(10) / 0.5 / icecube_limit
    anita_exposure = 2.44 / np.log(10) / 0.5 / anita_limit

    target_exposure = icecube_exposure[:8]
    target_energy = icecube_logeV[:8]

    #this is the exposure we need to get our hands on
    target_exposure = np.append(target_exposure, anita_exposure[4:5])
    target_energy = np.append(target_energy, 20)

    fig_tobeat = plt.figure(figsize=(2 * 11, 8.5))
    ax_limit_tobeat = fig_tobeat.add_subplot(1, 2, 1)
    ax_exposure_tobeat = fig_tobeat.add_subplot(1, 2, 2)

    ax_limit_tobeat.plot(np.power(10., icecube_logeV),
                         icecube_limit,
                         '-^',
                         linewidth=2.0,
                         color='blue',
                         label=r'IceCube 2018',
                         markersize=10)
    ax_limit_tobeat.plot(np.power(10., anita_logeV),
                         anita_limit,
                         '-v',
                         linewidth=2.0,
                         color='green',
                         label=r'ANITA 2018',
                         markersize=10)

    ax_exposure_tobeat.plot(np.power(10., icecube_logeV),
                            icecube_exposure,
                            '-^',
                            linewidth=2.0,
                            color='blue',
                            label=r'IceCube 2018',
                            markersize=10)
    ax_exposure_tobeat.plot(np.power(10., anita_logeV),
                            anita_exposure,
                            '-v',
                            linewidth=2.0,
                            color='green',
                            label=r'ANITA 2018',
                            markersize=10)
    ax_exposure_tobeat.plot(np.power(10., target_energy),
                            target_exposure,
                            '--',
                            linewidth=8.0,
                            color='red',
                            label=r'Minimum Target Exposure for NGRA')

    beautify_limit(ax_limit_tobeat)
    beautify_aeff(ax_exposure_tobeat)
    fig_tobeat.savefig("limit_to_beat.png",
                       edgecolor='none',
                       bbox_inches="tight")  #save the figure

    total_cost_1_5km = []
    total_cost_1km = []
    fixed_costs = []
    station_number = np.arange(0, 100, 1)
    for station in station_number:
        total_cost_1_5km.append(cost(1.5, station))
        total_cost_1km.append(cost(1, station))
        fixed_costs.append(543000)

    total_cost_1_5km = np.array(total_cost_1_5km)
    total_cost_1km = np.array(total_cost_1km)
    fixed_costs = np.array(fixed_costs)
    average_cost_1_5km = total_cost_1_5km[1:] / station_number[1:]
    average_cost_1km = total_cost_1km[1:] / station_number[1:]

    num_cabled = 100.
    cost_to_cable = cost(1.5, num_cabled)
    num_extra_arianna = (cost_to_cable / 15000.)
    # print "Cost to cable: ", cost_to_cable
    print "Cost to cable: %.2f and cost per cabled station %.2f " % (
        cost_to_cable, cost_to_cable / num_cabled)
    print "Worth %.2f ARIANNA Stations " % (num_extra_arianna)

    livetime = 5. * const.SecPerYear
    arianna_energy, arianna_aeff = detector.get_aeff(
        'arianna_icrc2017_fromlimit')
    arianna_energy = arianna_energy[1:]
    arianna_energy = arianna_energy[:-2]
    arianna_aeff = arianna_aeff[1:]
    arianna_aeff = arianna_aeff[:-2]
    pa_energy, pa_eff = detector.get_aeff('ara_phased_fromlimit')

    ara_exposure = pa_eff * 5. * const.SecPerYear
    arianna_exposure = arianna_aeff * 5. * const.SecPerYear * 0.58  #arianna only gets 58% uptime
    num_auto = 800.
    num_auto_only = num_extra_arianna + num_auto

    cabled_contribution = (ara_exposure * num_cabled)
    auto_contribution = (arianna_exposure * num_auto)
    auto_only_exposure = arianna_exposure * num_auto_only

    #merged detector
    total = cabled_contribution + auto_contribution

    fig_thiscase = plt.figure(figsize=(11, 8.5))
    ax_thiscase = fig_thiscase.add_subplot(1, 1, 1)

    ax_thiscase.plot(np.power(10., target_energy),
                     target_exposure,
                     '--',
                     linewidth=4.0,
                     color='red',
                     label=r'Minimum Target Exposure for NGRA')
    ax_thiscase.plot(np.power(10., pa_energy),
                     total,
                     '--',
                     linewidth=4.0,
                     color='black',
                     label=r'5 years, %d Cabled + %d Autonomous' %
                     (num_cabled, num_auto))

    ax_thiscase.plot(np.power(10., arianna_energy),
                     auto_contribution,
                     '-v',
                     linewidth=4.0,
                     color='green',
                     label=r'Mixed: %d Auto Contribution' % num_auto,
                     markersize=10)
    ax_thiscase.plot(np.power(10., pa_energy),
                     cabled_contribution,
                     '-^',
                     linewidth=4.0,
                     color='blue',
                     label=r'Mixed: %d Cabled Contribution' % num_cabled,
                     markersize=10)
    ax_thiscase.plot(np.power(10., arianna_energy),
                     auto_only_exposure,
                     '-v',
                     linewidth=2.0,
                     color='magenta',
                     label=r'Auto Only: %d Station' % num_auto_only,
                     markersize=10)

    beautify_aeff(ax_thiscase)
    fig_thiscase.savefig("%dcabled_case.png" % num_cabled,
                         edgecolor='none',
                         bbox_inches="tight")  #save the figure

    fig = plt.figure(figsize=(2 * 11, 8.5))
    ax_total = fig.add_subplot(1, 2, 1)
    ax_average = fig.add_subplot(1, 2, 2)

    ax_total.plot(station_number,
                  total_cost_1_5km / 1000.,
                  label='1.5 km Spacing',
                  linewidth=4)
    ax_total.plot(station_number,
                  total_cost_1km / 1000.,
                  label='1 km Spacing',
                  linewidth=4)

    ax_average.plot(station_number[1:],
                    average_cost_1_5km / 1000.,
                    label='1.5 km Spacing',
                    linewidth=4)
    ax_average.plot(station_number[1:],
                    average_cost_1km / 1000.,
                    label='1 km Spacing',
                    linewidth=4)

    ax_total.set_title("Total Cabling Cost", fontsize=24)
    ax_average.set_title("Cabling Cost Per Station", fontsize=24)

    beautify(ax_total)
    beautify(ax_average)
    sizer = 20
    ax_total.set_ylabel('Thousands of USD', size=sizer)
    ax_average.set_ylabel('Thousands of USD', size=sizer)
    ax_average.set_ylim([0, 50])  #set the y limits of the plot

    fig.savefig("cost.png", edgecolor='none',
                bbox_inches="tight")  #save the figure
Exemplo n.º 4
0
def main():
    '''
	Load theory information
	'''
    ahlers_data = np.genfromtxt("data/ahlers_2012.csv",
                                delimiter=',',
                                skip_header=1,
                                names=['energy', 'flux'])
    ahlers_energy_logev = ahlers_data['energy']
    ahlers_energy = np.power(10., ahlers_energy_logev)
    ahlers_limit_log = ahlers_data['flux']
    ahlers_limit = np.power(10., ahlers_limit_log)
    ahlers_interpolator = splrep(ahlers_energy_logev, ahlers_limit_log, k=4)

    icecube_energy_logev = np.array(
        [15.5, 16, 16.5, 17, 17.5, 18, 18.5, 19, 19.5, 20, 20.5])
    icecube_energy = np.power(10., icecube_energy_logev)

    #we can first have the IceCube thru-mu fluxes
    #we can have the nomina, and upper and lower 1 sigma possibilities
    def icecube_thrumu_function(E):
        return 3.03 * ((E / 1.e14)**-2.19) * 1e-27

    def icecube_thrumu_upper_function(E):
        return 3.81 * ((E / 1.e14)**-2.09) * 1e-27

    def icecube_thrumu_lower_function(E):
        return 2.34 * ((E / 1.e14)**-2.29) * 1e-27

    def icecube_combined_function(E):
        return 6.7 * ((E / 1.e14)**-2.50) * 1e-27

    def icecube_combined_upper_function(E):
        return 7.8 * ((E / 1.e14)**-2.41) * 1e-27

    def icecube_combined_lower_function(E):
        return 5.5 * ((E / 1.e14)**-2.59) * 1e-27

    #to compute to a curve on EF(E) we have to multiply by energy
    icecube_thrumu_efe = icecube_thrumu_function(
        icecube_energy) * icecube_energy
    icecube_thrumu_upper_efe = icecube_thrumu_upper_function(
        icecube_energy) * icecube_energy
    icecube_thrumu_lower_efe = icecube_thrumu_lower_function(
        icecube_energy) * icecube_energy

    icecube_combined_efe = icecube_combined_function(
        icecube_energy) * icecube_energy
    icecube_combined_upper_efe = icecube_combined_upper_function(
        icecube_energy) * icecube_energy
    icecube_combined_lower_efe = icecube_combined_lower_function(
        icecube_energy) * icecube_energy
    '''
	Load detector information
	'''

    ara_logeV, ara_200m_aeff = detector.get_aeff('ara_200m_1year_fromlimit')
    phased_logeV, phased_aeff = detector.get_aeff('ara_phased_fromlimit')

    #trim the ARA sensitivity to match the phased array in energy binning
    ara_logeV = ara_logeV[:-1]
    ara_200m_aeff = ara_200m_aeff[:-1]

    app_ara = ara_200m_aeff * const.SecPerYear
    app_pa = phased_aeff * const.SecPerYear

    ara_app_interpolator = splrep(ara_logeV, np.log10(app_ara), k=4)
    pa_app_interpolator = splrep(phased_logeV, np.log10(app_pa), k=4)

    counts_ara_icecubethrumu = []
    counts_ara_icecubecombined = []
    counts_ara_ahlers = []
    energy_bins = []
    bins = np.arange(16, 19.5, 0.5)
    for bin in bins:
        temp_logev = np.arange(bin, bin + 0.5, 0.01)
        temp_energy = np.power(10., temp_logev)
        #the ara sensitivity
        temp_ara_aeff = np.power(10., splev(temp_logev, ara_app_interpolator))
        #the flux estimates
        temp_icecube_thrumu = icecube_thrumu_function(temp_energy)
        temp_icecube_combined = icecube_combined_function(temp_energy)
        temp_ahlers = np.power(10., splev(temp_logev,
                                          ahlers_interpolator)) / temp_energy
        #the counts
        temp_counts_thrumu = np.trapz(temp_icecube_thrumu * temp_ara_aeff,
                                      temp_energy)
        temp_counts_combined = np.trapz(temp_icecube_combined * temp_ara_aeff,
                                        temp_energy)
        temp_counts_ahlers = np.trapz(temp_ahlers * temp_ara_aeff, temp_energy)
        #push back the counts
        counts_ara_icecubethrumu.append(temp_counts_thrumu)
        counts_ara_icecubecombined.append(temp_counts_combined)
        counts_ara_ahlers.append(temp_counts_ahlers)
        #save the energy bin
        energy_bins.append(np.power(10., bin))

    counts_ara_icecubethrumu = np.array(counts_ara_icecubethrumu)
    counts_ara_icecubecombined = np.array(counts_ara_icecubecombined)
    counts_ara_ahlers = np.array(counts_ara_ahlers)
    energy_bins = np.array(energy_bins)

    #what's the phased array contribution
    counts_pa_icecubethrumu = []
    counts_pa_icecubecombined = []
    counts_pa_ahlers = []
    pa_energy_bins = []
    bins = np.arange(16, 19.5, 0.5)
    for bin in bins:
        temp_logev = np.arange(bin, bin + 0.5, 0.01)
        temp_energy = np.power(10., temp_logev)
        temp_pa_aeff = np.power(10., splev(temp_logev, pa_app_interpolator))

        #the flux estimates
        temp_icecube_thrumu = icecube_thrumu_function(temp_energy)
        temp_icecube_combined = icecube_combined_function(temp_energy)
        temp_ahlers = np.power(10., splev(temp_logev,
                                          ahlers_interpolator)) / temp_energy

        temp_counts_thrumu_pa = np.trapz(temp_icecube_thrumu * temp_pa_aeff,
                                         temp_energy)
        temp_counts_combined_pa = np.trapz(
            temp_icecube_combined * temp_pa_aeff, temp_energy)
        temp_counts_ahlers_pa = np.trapz(temp_ahlers * temp_pa_aeff,
                                         temp_energy)

        counts_pa_icecubethrumu.append(temp_counts_thrumu_pa)
        counts_pa_icecubecombined.append(temp_counts_combined_pa)
        counts_pa_ahlers.append(temp_counts_ahlers_pa)

        pa_energy_bins.append(np.power(10., bin))
    counts_pa_icecubethrumu = np.array(counts_pa_icecubethrumu)
    counts_pa_icecubecombined = np.array(counts_pa_icecubecombined)
    counts_pa_ahlers = np.array(counts_pa_ahlers)
    pa_energy_bins = np.array(pa_energy_bins)

    ratio_ahlers = counts_pa_ahlers / counts_ara_ahlers
    ratio_icecubethrumu = counts_pa_icecubethrumu / counts_ara_icecubethrumu
    ratio_icecubecombined = counts_pa_icecubecombined / counts_ara_icecubecombined

    fig_counts = plt.figure(figsize=(3. * 11, 8.5))
    ax_count_ara = fig_counts.add_subplot(1, 3, 1)
    ax_count_pa = fig_counts.add_subplot(1, 3, 2)
    ax_count_ratio = fig_counts.add_subplot(1, 3, 3)
    ax_count_ara.set_title("ARA 200m", fontsize=24)
    ax_count_pa.set_title("ARA 200m w/ PA", fontsize=24)
    ax_count_ratio.set_title("Ratio ARA200/PA", fontsize=24)

    n, bins, patches = ax_count_ara.hist(
        energy_bins,
        bins=np.power(10., np.arange(16, 22, 1)),
        weights=counts_ara_ahlers,
        label=r'Ahlers 2012: %.2f' % counts_ara_ahlers.sum(),
        fill=False,
        stacked=True,
        histtype='step',
        edgecolor='red',
        linewidth=4)
    n, bins, patches = ax_count_ara.hist(
        energy_bins,
        bins=np.power(10., np.arange(16, 22, 1)),
        weights=counts_ara_icecubethrumu,
        label=r'IceCube Thru-Mu E$^{-2.19}$: %.2f' %
        counts_ara_icecubethrumu.sum(),
        fill=False,
        stacked=True,
        histtype='step',
        edgecolor='blue',
        linewidth=4)
    n, bins, patches = ax_count_ara.hist(
        energy_bins,
        bins=np.power(10., np.arange(16, 22, 1)),
        weights=counts_ara_icecubecombined,
        label=r'IceCube Combined E$^{-2.5}$: %.3f' %
        counts_ara_icecubecombined.sum(),
        fill=False,
        stacked=True,
        histtype='step',
        edgecolor='green',
        linewidth=4)

    n, bins, patches = ax_count_pa.hist(
        pa_energy_bins,
        bins=np.power(10., np.arange(16, 22, 1)),
        weights=counts_pa_ahlers,
        label=r'Ahlers 2012: %.2f' % counts_pa_ahlers.sum(),
        fill=False,
        stacked=True,
        histtype='step',
        edgecolor='red',
        linewidth=4)
    n, bins, patches = ax_count_pa.hist(
        pa_energy_bins,
        bins=np.power(10., np.arange(16, 22, 1)),
        weights=counts_pa_icecubethrumu,
        label=r'IceCube Thru-Mu E$^{-2.19}$: %.2f' %
        counts_pa_icecubethrumu.sum(),
        fill=False,
        stacked=True,
        histtype='step',
        edgecolor='blue',
        linewidth=4)
    n, bins, patches = ax_count_pa.hist(
        pa_energy_bins,
        bins=np.power(10., np.arange(16, 22, 1)),
        weights=counts_pa_icecubecombined,
        label=r'IceCube Combined E$^{-2.5}$: %.3f' %
        counts_pa_icecubecombined.sum(),
        fill=False,
        stacked=True,
        histtype='step',
        edgecolor='green',
        linewidth=4)

    n, bins, patches = ax_count_ratio.hist(pa_energy_bins,
                                           bins=np.power(
                                               10., np.arange(16, 22, 1)),
                                           weights=ratio_ahlers,
                                           label=r'Ahlers 2012',
                                           fill=False,
                                           stacked=True,
                                           histtype='step',
                                           edgecolor='red',
                                           linewidth=4)
    n, bins, patches = ax_count_ratio.hist(
        pa_energy_bins,
        bins=np.power(10., np.arange(16, 22, 1)),
        weights=ratio_icecubethrumu,
        label=r'IceCube Thru-Mu E$^{-2.19}$',
        fill=False,
        stacked=True,
        histtype='step',
        edgecolor='blue',
        linewidth=4)
    n, bins, patches = ax_count_ratio.hist(
        pa_energy_bins,
        bins=np.power(10., np.arange(16, 22, 1)),
        weights=ratio_icecubecombined,
        label=r'IceCube Combined E$^{-2.5}$',
        fill=False,
        stacked=True,
        histtype='step',
        edgecolor='green',
        linewidth=4)

    beautify_counts(ax_count_ara)
    beautify_counts(ax_count_pa)
    ratio_legend = beautify_counts(ax_count_ratio)
    ax_count_ara.set_ylim([0, 0.2])
    ax_count_pa.set_ylim([0, 0.2])
    ax_count_ratio.set_ylim([0, 14])
    ax_count_ratio.set_ylabel('Ratio', size=20)  #give it a title
    ratio_legend.set_title('')
    fig_counts.savefig("ara200m_vs_pa_counts.png",
                       edgecolor='none',
                       bbox_inches="tight")  #save the figure
Exemplo n.º 5
0
def main():
    '''
	Load theory information
	'''
    ahlers_data = np.genfromtxt("data/ahlers_2012.csv",
                                delimiter=',',
                                skip_header=1,
                                names=['energy', 'flux'])
    ahlers_energy_logev = ahlers_data['energy']
    ahlers_energy = np.power(10., ahlers_energy_logev)
    ahlers_limit_log = ahlers_data['flux']
    ahlers_limit = np.power(10., ahlers_limit_log)
    ahlers_interpolator = splrep(ahlers_energy_logev, ahlers_limit_log, k=4)

    icecube_energy_logev = np.array(
        [15.5, 16, 16.5, 17, 17.5, 18, 18.5, 19, 19.5, 20, 20.5])
    icecube_energy = np.power(10., icecube_energy_logev)

    #we can first have the IceCube thru-mu fluxes
    #we can have the nomina, and upper and lower 1 sigma possibilities
    def icecube_thrumu_function(E):
        return 3.03 * ((E / 1.e14)**-2.19) * 1e-27

    def icecube_thrumu_upper_function(E):
        return 3.81 * ((E / 1.e14)**-2.09) * 1e-27

    def icecube_thrumu_lower_function(E):
        return 2.34 * ((E / 1.e14)**-2.29) * 1e-27

    def icecube_combined_function(E):
        return 6.7 * ((E / 1.e14)**-2.50) * 1e-27

    def icecube_combined_upper_function(E):
        return 7.8 * ((E / 1.e14)**-2.41) * 1e-27

    def icecube_combined_lower_function(E):
        return 5.5 * ((E / 1.e14)**-2.59) * 1e-27

    #to compute to a curve on EF(E) we have to multiply by energy
    icecube_thrumu_efe = icecube_thrumu_function(
        icecube_energy) * icecube_energy
    icecube_thrumu_upper_efe = icecube_thrumu_upper_function(
        icecube_energy) * icecube_energy
    icecube_thrumu_lower_efe = icecube_thrumu_lower_function(
        icecube_energy) * icecube_energy

    icecube_combined_efe = icecube_combined_function(
        icecube_energy) * icecube_energy
    icecube_combined_upper_efe = icecube_combined_upper_function(
        icecube_energy) * icecube_energy
    icecube_combined_lower_efe = icecube_combined_lower_function(
        icecube_energy) * icecube_energy
    '''
	Load detector information
	'''
    ara_logeV, ara_100m_aeff = detector.get_aeff('ara_phased_100m')
    arianna_logeV, arianna_aeff = detector.get_aeff(
        'arianna_icrc2017_fromlimit')

    ara_logeV, ara_100m_limit = detector.get_limit('ara_phased_100m_1year')
    arianna_logeV, arianna_limit = detector.get_limit('arianna_2017icrc_1year')

    #trim the ARIANNA sensitivity to match the ara array in energy binning
    arianna_logeV = arianna_logeV[:-2]
    arianna_aeff = arianna_aeff[:-2]
    arianna_limit = arianna_limit[:-2]
    #arianna_logeV = arianna_logeV[-1:]
    #arianna_aeff = arianna_aeff[-1:]
    #arianna_limit = arianna_limit[-1:]

    app_ara = ara_100m_aeff * const.SecPerYear
    app_arianna = arianna_aeff * const.SecPerYear * 0.58

    exisiting_logeV, existing_best_exp = detector.get_exposure('best_existing')
    target_logeV, target_exp = detector.get_exposure('target')

    icecube_logeV, icecube_limit = detector.get_limit('icecube_2018')
    anita_logeV, anita_limit = detector.get_limit('anita_2018')

    fig = plt.figure(figsize=(2. * 11, 8.5))
    ax_limit = fig.add_subplot(1, 2, 2)
    ax_aeff = fig.add_subplot(1, 2, 1)

    ax_limit.plot(ahlers_energy,
                  ahlers_limit,
                  '-',
                  linewidth=3.0,
                  color='gray',
                  label="Ahlers 2012")
    ax_limit.fill_between(icecube_energy,
                          icecube_thrumu_lower_efe,
                          icecube_thrumu_upper_efe,
                          facecolor='orange',
                          alpha=0.3)
    ax_limit.fill_between(icecube_energy,
                          icecube_combined_lower_efe,
                          icecube_combined_upper_efe,
                          facecolor='magenta',
                          alpha=0.3)
    ax_limit.plot(icecube_energy,
                  icecube_thrumu_efe,
                  '-.',
                  linewidth=3.0,
                  color='orange',
                  label=r'IceCube Thru-Mu (E$^{-2.19}$)')
    ax_limit.plot(icecube_energy,
                  icecube_combined_efe,
                  ':',
                  linewidth=3.0,
                  color='magenta',
                  label='IceCube Combined (E$^{-2.50}$)')
    ax_limit.plot(np.power(10., ara_logeV),
                  ara_100m_limit,
                  '-^',
                  linewidth=2.0,
                  color='blue',
                  label=r'1 ARA Phased 100m Station @ SP, 1 Year')
    ax_limit.plot(np.power(10., arianna_logeV),
                  arianna_limit / 0.58,
                  '-v',
                  linewidth=2.0,
                  color='green',
                  label=r'1 ARIANNA Surface Station @ MB, 0.58 Year')
    ax_limit.plot(np.power(10., icecube_logeV),
                  icecube_limit / 0.58,
                  '->',
                  linewidth=2.0,
                  color='black',
                  label=r'IceCube 2018')
    ax_limit.plot(np.power(10., anita_logeV),
                  anita_limit / 0.58,
                  '-<',
                  linewidth=2.0,
                  color='brown',
                  label=r'ANITA 2018')
    beautify_limit_withtheory(ax_limit, 3)

    ax_aeff.plot(np.power(10., exisiting_logeV),
                 existing_best_exp,
                 '--',
                 linewidth=2.0,
                 color='grey',
                 label=r'Existing Best Exposure')
    ax_aeff.plot(np.power(10., target_logeV),
                 target_exp,
                 '--',
                 linewidth=2.0,
                 color='red',
                 label=r'NGRA Target Exposure')
    ax_aeff.plot(np.power(10., ara_logeV),
                 app_ara,
                 '-^',
                 linewidth=2.0,
                 color='blue',
                 label=r'1 ARA Phased 100m Station @ SP, 1 Year')
    ax_aeff.plot(np.power(10., arianna_logeV),
                 app_arianna,
                 '-v',
                 linewidth=2.0,
                 color='green',
                 label=r'1 ARIANNA Surface Station @ MB, 0.58 Year')
    beautify_aeff(ax_aeff)
    fig.savefig("exposures_ara100phased_arianna.png",
                edgecolor='none',
                bbox_inches="tight")  #save the figure