Exemple #1
0
 def test_monitor_accumulated(self):
     with tm.TimeMonitor("testtimer"):
         sleep(3)
     self.assertAlmostEqual(tm._monitors["testtimer"], 3, places=2)
     sleep(2)
     with tm.TimeMonitor("testtimer"):
         sleep(3)
     self.assertAlmostEqual(tm._monitors["testtimer"], 6, places=1)
Exemple #2
0
 def write(self, filename, a):
     with tm.TimeMonitor("MPI Write"):
         if self.comm.MyPID == 0:
             l.info("Writing " + filename)
         f = MPI.File.Open(MPI.COMM_WORLD,
                           os.path.join(self.folder, filename),
                           MPI.MODE_WRONLY | MPI.MODE_CREATE)
         f.Write_ordered(a)
         f.Close()
Exemple #3
0
        pass
    # write copy of config file to output folder
    with open(os.path.join(folder, "config.cfg"), "w") as config_output_file:
        config.write(config_output_file)

# define data range
i_from = 0
length = max_data_samples or len(h5py.File(input_filename, mode='r')['data'])
# must be a multiple of baseline length
length /= baseline_length
length *= baseline_length
comm.create_global_map("bas", length / baseline_length)

# temperature and polarization done in 2 different runs
for pol, comps in zip([False, True], ["T", "QU"]):
    with tm.TimeMonitor("Total"):
        with tm.TimeMonitor("Read input data"):
            # read data, pixels and baseline lengths in numpy arrays from hdf5 files
            pix, data, baseline_lengths = read_data(
                input_filename,
                i_from + comm.maps["bas"].MinMyGID() * baseline_length,
                i_from + (comm.maps["bas"].MaxMyGID() + 1) * baseline_length,
                nside,
                baseline_length,
                comm,
                pol=pol,
                maskdestripe=mask_filename)

        # replace the measured signal with a simulated signal
        if scan_gal_input_map:
            gal_input_map = gal2eq(hp.read_map(scan_gal_input_map, [0, 1, 2]))
Exemple #4
0
 def test_monitor_created(self):
     with tm.TimeMonitor("testtimer"):
         pass
     self.assertTrue(tm._monitors.has_key("testtimer"))
Exemple #5
0
 def test_summarize(self):
     with tm.TimeMonitor("testtimer"):
         sleep(3)
     printed = tm.summarize()
     self.assertGreater(printed.find("testtimer"), -1) 
     self.assertGreater(printed.find("3"), -1) 
Exemple #6
0
 def test_monitor_reset(self):
     with tm.TimeMonitor("testtimer"):
         sleep(3)
     tm.reset()
     self.assertEqual(tm._monitors["testtimer"], 0)
Exemple #7
0
 def test_monitor_incremented(self):
     with tm.TimeMonitor("testtimer"):
         sleep(3)
     self.assertAlmostEqual(tm._monitors["testtimer"], 3, places=2)