def create_test_simulation_output(self):
        np.random.seed(1)
        self.sim = 'E_100TeV/zenith_0'
        cluster = clusters.SimpleCluster(size=50)
        simulation = GroundParticlesSimulation(cluster, self.data,
                                               os.path.join('/showers', self.sim, 'leptons'),
#                                               os.path.join('/simulations', self.sim), force=True,
                                               os.path.join('/test_output', self.sim),
                                               R=10, N=20)
        self.redirect_stdout_stderr_to_devnull()
        simulation.run()
        self.restore_stdout_stderr()
Example #2
0
def perform_groundparticlessimulation(filename, mock_time):
    """Perform a small simulation and store results in filename"""

    mock_time.return_value = int(1e9)

    corsika_data_path = os.path.join(self_path, 'test_data/corsika.h5')
    cluster = sapphire.clusters.SimpleCluster(size=40)
    filters = tables.Filters(complevel=1)
    with tables.open_file(filename, 'w', filters=filters) as data:
        sim = GroundParticlesSimulation(corsika_data_path, 70, cluster,
                                        data, n=10, seed=1, progress=False)
        sim.run()
Example #3
0
 def create_test_simulation_output(self):
     np.random.seed(1)
     self.sim = 'E_100TeV/zenith_0'
     cluster = clusters.SimpleCluster(size=50)
     simulation = GroundParticlesSimulation(
         cluster,
         self.data,
         os.path.join('/showers', self.sim, 'leptons'),
         #                                               os.path.join('/simulations', self.sim), force=True,
         os.path.join('/test_output', self.sim),
         R=10,
         N=20)
     self.redirect_stdout_stderr_to_devnull()
     simulation.run()
     self.restore_stdout_stderr()
Example #4
0
def perform_groundparticlessimulation(filename, mock_time):
    """Perform a small simulation and store results in filename"""

    mock_time.return_value = int(1e9)

    corsika_data_path = os.path.join(self_path, 'test_data/corsika.h5')
    cluster = sapphire.clusters.SimpleCluster(size=40)
    filters = tables.Filters(complevel=1)
    with tables.open_file(filename, 'w', filters=filters) as datafile:
        sim = GroundParticlesSimulation(corsika_data_path,
                                        70,
                                        cluster,
                                        datafile,
                                        N=10,
                                        seed=1,
                                        progress=False)
        sim.run()
    def setUp(self):
        self.simulation = GroundParticlesSimulation.__new__(GroundParticlesSimulation)

        corsika_data_path = os.path.join(self_path, 'test_data/corsika.h5')
        self.corsika_data = tables.open_file(corsika_data_path, 'r')
        self.simulation.corsikafile = self.corsika_data

        self.simulation.cluster = SingleDiamondStation()
        self.detectors = self.simulation.cluster.stations[0].detectors