Exemple #1
0

# create an function to represent the IceCube northern track limit
# Note that the units are GeV^-1 * cm^-2 * sr^-1 * s^-1 per particle type
def northern_track(energy):
    return 1.44e-18 / 2 * (energy / 1e5)**-2.2


# get the weights by passing the flux to the weighter
weights = weights = weighter.get_weights(northern_track)

# print some info about the weighting object
print(weighter.tostring(northern_track))

# create equal spaced bins in log space
bins = plt.geomspace(1e2, 1e8, 50)

# get energy of the primary cosmic-ray from `PolyplopiaPrimary`
primary_energy = weighter.get_column("PolyplopiaPrimary", "energy")

# histogram the primary energy with the weights
plt.hist(primary_energy, weights=weights, bins=bins)

# make the plot look good
plt.loglog()
plt.xlabel("Primary Energy [GeV]")
plt.ylabel("Event Rate [Hz]")
plt.xlim(bins[0], bins[-1])
plt.ylim(1e-8, 2e-6)
plt.tight_layout()
plt.show()
Exemple #2
0
               I3CorsikaWeight=I3CorsikaWeight)

# create the weighter object
weighter = simweights.CorsikaWeighter(fileobj)

# create an object to represent our cosmic-ray primary flux model
flux = simweights.GaisserH4a()

# get the weights by passing the flux to the weighter
weights = weights = weighter.get_weights(flux)

# print some info about the weighting object
print(weighter.tostring(flux))

# create equal spaced bins in log space
bins = plt.geomspace(3e4, 1e6, 50)

# get energy of the primary cosmic-ray from `PolyplopiaPrimary`
primary_energy = weighter.get_weight_column("energy")

# histogram the primary energy with the weights
plt.hist(primary_energy, weights=weights, bins=bins)

# make the plot look good
plt.loglog()
plt.xlabel("Primary Energy [GeV]")
plt.ylabel("Event Rate [Hz]")
plt.xlim(bins[0], bins[-1])
plt.ylim(0.1, 10)
plt.show()
Exemple #3
0
    dx = 1e-14
    while abs(f(x)) > eps:
        df = (f(x + dx / 2) - f(x - dx / 2)) / dx
        if (df < 1e-12) or (df > 1e9): break
        dx = -f(x) / df
        x += dx
        counter += 1
        if counter > 1000: break
    # print('Number of iterrations:', counter)
    return x


V1 = 10.0  # bottom of well
epsilon = 1e-8

V = pl.geomspace(70., 10000., 10)
E = []

E0 = 27.20075187724861
for V2 in V:
    E.append(E0)
    E0 = newton(E0)
""" E.append(E0)
    Enew = newton(E[-1])
    if (Enew < 33) and (Enew > V1):
        E.append(Enew)
    else:
        E.append(E0)
"""

pl.semilogx(V, E, label='Newton')