Commit 12cc50d4 authored by DavidWalz's avatar DavidWalz
Browse files

remove 'if main'

parent fe90ddbe
......@@ -180,53 +180,3 @@ def plot_stations_vs_phi(phi, S, fname=None):
ax.set_xlabel('Phi')
ax.set_ylabel('Number of Stations')
maybe_save(fig, fname)
if __name__ == '__main__':
d = np.load('showers.npz')
logE = d['logE']
mass = d['mass']
Xmax = d['Xmax']
v_core = d['showercore']
v_axis = d['showeraxis']
v_max = d['showermax']
v_stations = d['detector']
T = d['time']
S = d['signal']
S1 = d['signal1']
S2 = d['signal2']
phi, zenith = utils.vec2ang(v_axis)
# ------------------------------------
# plot example event
# ------------------------------------
for i in range(3):
title = 'logE=%.2f, Xmax=%.2f, zenith=%.2f' % (logE[i], Xmax[i], np.rad2deg(zenith[i]))
plot_array(
v_stations, T[i] * 1E6, v_core=v_core[i], v_axis=v_axis[i],
vmin=-10, vmax=10, label='time [$\mu$ s]', title=title,
fname='plots/example-%i-time.png' % i)
logStot = np.log10(S.sum(axis=-1))
plot_array(
v_stations, logStot[i], v_core=v_core[i], v_axis=v_axis[i],
vmin=1, vmax=5, label='$\log_{10}(S_\mathrm{tot})$', title=title,
fname='plots/example-%i-signal.png' % i)
plot_array_traces(
Smu=S1[i], Sem=S2[i], v_stations=v_stations, n=5,
fname='plots/example-%i-traces.png' % i)
# ------------------------------------
# plot distribution of all events
# ------------------------------------
plot_time_distribution(T, fname='plots/time_distribution.png')
plot_signal_distribution(S, fname='plots/signal_distribution.png')
plot_energy_distribution(logE, fname='plots/energy_distribution.png')
plot_xmax_distribution(Xmax, fname='plots/xmax_distribution.png')
plot_zenith_distribution(zenith, fname='plots/zenith_distribution.png')
plot_phi_distribution(phi, fname='plots/phi_distribution.png')
plot_stations_vs_energy(logE, S, fname='plots/stations_vs_energy.png')
plot_stations_vs_zenith(zenith, S, fname='plots/stations_vs_zenith.png')
plot_stations_vs_zenith(phi, S, fname='plots/stations_vs_phi.png')
......@@ -181,25 +181,3 @@ def rand_events(logE, mass, v_stations, fname=None, wavefront='planar'):
'showeraxis': v_axis,
'showermax': v_max,
'detector': v_stations}
if __name__ == '__main__':
# detector array, vector of (x,y,z) positions
v_stations = utils.station_coordinates(11, layout='offset')
# simulate events
n = 1000
logE = 18.5 + 1.5 * np.random.rand(n)
mass = 1
data = rand_events(logE, mass, v_stations)
phi, zenith = utils.vec2ang(data['showeraxis'])
plotting.plot_time_distribution(data['time'], fname='time_distribution.png')
plotting.plot_signal_distribution(data['signal'], fname='signal_distribution.png')
plotting.plot_energy_distribution(data['logE'], fname='energy_distribution.png')
plotting.plot_xmax_distribution(data['Xmax'], fname='xmax_distribution.png')
plotting.plot_zenith_distribution(zenith, fname='zenith_distribution.png')
plotting.plot_phi_distribution(phi, fname='phi_distribution.png')
plotting.plot_stations_vs_energy(data['logE'], data['signal'], fname='stations_vs_energy.png')
plotting.plot_stations_vs_zenith(zenith, data['signal'], fname='stations_vs_zenith.png')
plotting.plot_array_traces(Smu=data['signal1'][1], Sem=data['signal2'][1], v_stations=data['detector'], n=5, fname='example-trace.png')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment