Beispiel #1
0
    def main(self):
        global weights, densities, weighted_densities
        plt.figure()

        cluster = clusters.SingleStation()
        self.station = cluster.stations[0]

        R = np.linspace(0, 100, 100)
        densities = []
        weights = []
        for E in np.linspace(1e13, 1e17, 10000):
            relative_flux = E ** -2.7
            Ne = 10 ** (np.log10(E) - 15 + 4.8)
            self.ldf = KascadeLdf(Ne)
            min_dens = self.calculate_minimum_density_for_station_at_R(R)

            weights.append(relative_flux)
            densities.append(min_dens)
        weights = np.array(weights)
        densities = np.array(densities).T

        weighted_densities = (np.sum(weights * densities, axis=1) /
                              np.sum(weights))
        plt.plot(R, weighted_densities)
        plt.yscale('log')
        plt.ylabel("Min. density [m^{-2}]")
        plt.xlabel("Core distance [m]")
        plt.axvline(5.77)
        plt.show()
Beispiel #2
0
 def do_station_size_simulations(self):
     angle = '/showers/E_1PeV/zenith_22_5'
     for station_size in [5, 20]:
         cluster = clusters.SingleStation(station_size)
         for shower in self.get_showers_in_group(angle):
             output_path = self.make_output_path_for_station_size_simulation(shower, station_size)
             self.perform_simulation(cluster, shower, output_path)
Beispiel #3
0
    def store_cluster_instance(self):
        group = self.data.get_node(self.hisparc_group)

        if 'cluster' not in group._v_attrs:
            cluster = clusters.SingleStation()
            cluster.set_xyalpha_coordinates(65., 20.82, pi)

            group._v_attrs.cluster = cluster
Beispiel #4
0
 def test_get_coordinates_after_init(self):
     cluster = clusters.SingleStation()
     coordinates = cluster.get_xyalpha_coordinates()
     self.assertEqual(coordinates, (0., 0., 0.))
Beispiel #5
0
 def test_init_calls_super_init(self):
     with patch.object(clusters.BaseCluster, '__init__',
                       mocksignature=True) as mock_base_init:
         clusters.SingleStation()
         self.assertTrue(mock_base_init.called)
Beispiel #6
0
 def test_single_station(self):
     cluster = clusters.SingleStation()
     stations = cluster.stations
     self.assertEqual(len(stations), 1)
Beispiel #7
0
from sapphire import clusters
from sapphire.simulations import KascadeLdfSimulation


DATAFILE = 'data.h5'

N = 10000


if __name__ == '__main__':
    try:
        data
    except NameError:
        data = tables.open_file(DATAFILE, 'w')

    cluster = clusters.SingleStation()
    simulation = KascadeLdfSimulation(cluster, data, '/ldfsim/exact', R=60, N=N)
    simulation.run(max_theta=pi / 3)

    simulation = KascadeLdfSimulation(cluster, data, '/ldfsim/gauss_10', R=60, N=N, gauss=.1, trig_threshold=.9)
    simulation.run(max_theta=pi / 3)

    simulation = KascadeLdfSimulation(cluster, data, '/ldfsim/gauss_20', R=60, N=N, gauss=.2, trig_threshold=.8)
    simulation.run(max_theta=pi / 3)

    simulation = KascadeLdfSimulation(cluster, data, '/ldfsim/poisson', R=60, N=N, use_poisson=True)
    simulation.run(max_theta=pi / 3)

    simulation = KascadeLdfSimulation(cluster, data, '/ldfsim/poisson_gauss_20', R=60, N=N, use_poisson=True, gauss=.2, trig_threshold=.5)
    simulation.run(max_theta=pi / 3)
Beispiel #8
0
 def do_energies_simulations(self):
     cluster = clusters.SingleStation()
     for energy in ['100TeV', '10PeV']:
         shower_group = '/showers/E_%s/zenith_22_5' % energy
         for shower in self.get_showers_in_group(shower_group):
             self.perform_simulation(cluster, shower)
Beispiel #9
0
 def do_station_simulations(self):
     cluster = clusters.SingleStation()
     for angle in self.get_shower_angles_from_shower_data():
         for shower in self.get_showers_in_group(angle):
             self.perform_simulation(cluster, shower)