def setUpClass(cls): dataset = DataSet(data={'description': "Test source extraction step"}) cls.dataset_id = dataset.id config = SafeConfigParser() config.read(default_job_config) config = parse_to_dict(config) cls.parset = config['source_extraction']
def load_job_config(pipe_config): """ Locates the job_params.cfg in 'job_directory' and loads via ConfigParser. """ job_directory = pipe_config["DEFAULT"]["job_directory"] job_config = ConfigParser.SafeConfigParser() job_config.read(os.path.join(job_directory, "job_params.cfg")) return parse_to_dict(job_config)
def load_job_config(pipe_config): """ Locates the job_params.cfg in 'job_directory' and loads via ConfigParser. """ job_directory = pipe_config['DEFAULT']['job_directory'] job_config = ConfigParser.SafeConfigParser() job_config.read(os.path.join(job_directory, 'job_params.cfg')) return parse_to_dict(job_config)
def test_injection(self): c = SafeConfigParser() c.read(default_header_inject_config) parset = parse_to_dict(c)['inject'] tkp.inject.modify_fits_headers(parset, self.fixed_file, overwrite=True) fixed_fits = tkp.accessors.open(self.fixed_file) self.assertTrue(isinstance(fixed_fits, DataAccessor)) self.assertTrue(isinstance(fixed_fits, LofarAccessor))
def setUpClass(cls): cls.dataset_id = db_subs.create_dataset_8images() cls.images = [testdata.fits_file] cls.extraction_radius = 256 job_config = SafeConfigParser() job_config.read(default_job_config) job_config = parse_to_dict(job_config) cls.persistence_pars = job_config['persistence'] pipe_config = initialize_pipeline_config(default_pipeline_config, job_name="test_persistence") cls.image_cache_pars = pipe_config['image_cache']
def setUpClass(cls): dataset = tkp.db.DataSet(data={"description": "Test persistence"}) cls.dataset_id = dataset.id cls.images = [datafile] cls.accessors = [tkp.accessors.open(datafile)] cls.extraction_radius = 256 job_config = SafeConfigParser() job_config.read(default_job_config) job_config = parse_to_dict(job_config) cls.persistence_pars = job_config["persistence"] pipe_config = initialize_pipeline_config(default_pipeline_config, job_name="test_persistence") cls.image_cache_pars = pipe_config["image_cache"]
def setUpClass(cls): dataset = tkp.db.DataSet(data={'description': "Test persistence"}) cls.dataset_id = dataset.id cls.images = [datafile] cls.extraction_radius = 256 job_config = SafeConfigParser() job_config.read(default_job_config) job_config = parse_to_dict(job_config) cls.persistence_pars = job_config['persistence'] pipe_config = initialize_pipeline_config(default_pipeline_config, job_name="test_persistence") cls.image_cache_pars = pipe_config['image_cache']
def main(): parset_file, target_files, overwrite = parse_arguments() c = SafeConfigParser() c.read(parset_file) new_hdr_entries = parse_to_dict(c)['inject'] for target_file in target_files: #Normally accessors.open checks this, but we're going straight #to detect here because we don't want to actually open it: if not os.path.isfile(target_file) or os.path.isdir(target_file): print "File not found: %s (check path is correct?)" % target_file continue print "injecting data into %s" % target_file accessor_class = tkp.accessors.detection.detect(target_file) if accessor_class == LofarFitsImage: modify_fits_headers(new_hdr_entries, target_file, overwrite) elif accessor_class == LofarCasaImage: modify_casa_headers(new_hdr_entries, target_file) else: print "ERROR: %s is in a unknown format" % target_file
def main(): logging.basicConfig(level=logging.DEBUG) parset_file, target_files, overwrite = parse_arguments() c = SafeConfigParser() c.read(parset_file) new_hdr_entries = parse_to_dict(c)['inject'] for target_file in target_files: #Normally accessors.open checks this, but we're going straight #to detect here because we don't want to actually open it: if not (os.path.isfile(target_file) or os.path.isdir(target_file)): logger.warn("File not found: %s (check path is correct?)" % target_file) continue logger.info("injecting data into %s" % target_file) accessor_class = tkp.accessors.detection.detect(target_file) if FitsImage in accessor_class.mro(): modify_fits_headers(new_hdr_entries, target_file, overwrite) elif accessor_class == LofarCasaImage: modify_lofarcasa_tau_time(new_hdr_entries, target_file) else: logger.error("ERROR: %s is in a unknown format" % target_file)
def setUp(self): self.accessor = tkp.accessors.open(fits_file) config = SafeConfigParser() config.read(default_job_config) self.job_config = parse_to_dict(config)
def test_default_inject_config(self): c = SafeConfigParser() c.read(default_header_inject_config) inject_config = parse_to_dict(c)
def test_parser(self): parsed = parse_to_dict(self.config) self.assertEqual(parsed, self.parset)
def test_default_job_config(self): c = SafeConfigParser() c.read(default_job_config) job_config = parse_to_dict(c)
def setUpClass(cls): cls.accessor = tkp.accessors.open(casa_table) config = SafeConfigParser() config.read(default_job_config) cls.job_config = parse_to_dict(config)
def setUpClass(cls): cls.dataset_id = db_subs.create_dataset_8images() config = SafeConfigParser() config.read(default_job_config) config = parse_to_dict(config) cls.parset = config["source_extraction"]
def setUpClass(cls): cls.dataset_id = db_subs.create_dataset_8images(extract_sources=True) config = SafeConfigParser() config.read(default_job_config) config = parse_to_dict(config) cls.parset =config['transient_search']