Esempio n. 1
0
    fig = plt.figure(2)
    plt.errorbar(
        energy_bin_median, [rad2deg * i for i in phase_avg], xerr=[energy_err_lower, energy_err_upper], fmt="o"
    )
    ax = fig.axes[0]
    ax.axis("on")
    tPars = {"fontsize": 16}
    # ax.set_ylim(-210,200)
    ax.set_xlabel(r"$\log_{10}(E/\mathrm{GeV})", **tPars)
    ax.set_ylabel(r"Phase Amplitude", **tPars)
    if args.output:
        if args.plotname:
            outFile = args.outDir + args.plotname
        else:
            if args.lmax == 1:
                name = "phase_dipolefit"
            elif args.lmax == 2:
                name = "phase_quadrupolefit"
            elif args.lmax == 3:
                name = "phase_octupolefit"
            else:
                name = "phase_data"
            outFile = args.outDir + name
        plt.savefig(outFile + "." + args.ext, dpi=300, bbox_inches="tight")

    dipole_vec = getDipole()

    if not args.noshow:
        plt.show()
Esempio n. 2
0
 # Produce dipole expansion coeeficient plot
 #fig = plt.figure(1)
 labels = [r'$l=1$',r'$l=2$',r'$l=3$']
 #for i in range(1):
 for l in range(1,args.lmax+1):
     amplitude = []
     amplitude_err = []
     phase = []
     phase_err = []
     for i in range(len(maps)):
         # Read in (multiple) input files
         data, bg, local = np.sum([hp.read_map(f, range(3), verbose=False)\
                 for f in maps[i]], axis=0)
         p = multifit(l, data, bg, alpha, **opts)
         #print('p = {}'.format(np.sqrt(p['Y(1,0)']**2+p['Y(1,1)']**2+p['Y(1,-1)']**2)))
         dipole = getDipole(p)
         #print('dipole = {}'.format(dipole))
         #print('dipole[0] = {}'.format(dipole[0]))
         amplitude.append(dipole[0])
         amplitude_err.append(dipole[1])
         phase.append(dipole[2])
         phase_err.append(dipole[3])
         
     fig = plt.figure(l)
     plt.errorbar(energy_bin_median,amplitude,xerr=[energy_err_lower,energy_err_upper],\
             yerr=amplitude_err,marker='.',markersize=10,linestyle='None')
     plt.title(r'$l_{} = $ {}'.format('{max}',l))
     ax = fig.axes[0]
     ax.axis('on')
     tPars = {'fontsize':16}
     ax.set_xlim(3.5,7.5)