def setUp(self): #Clearly this is nonsense, but we're just testing syntax in a # non-functional library... self.transients = [{'runcat':'1', 'band':'1'}] with open(default_parset_paths['classification.parset']) as f: self.parset = parset.read_config_section(f, 'classification')
def test_round_trip(self): bufout = StringIO.StringIO() parset.write_config_section(bufout, self.section, self.parset) bufin = StringIO.StringIO(bufout.getvalue()) parsed = parset.read_config_section(bufin, self.section) # print parsed self.assertEqual(self.parset, parsed)
def main(): parset_file, target_files, overwrite = parse_arguments() with open(parset_file) as fp: parset = read_config_section(fp, "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(parset, target_file, overwrite) elif accessor_class == LofarCasaImage: modify_casa_headers(parset, target_file) else: print "ERROR: %s is in a unknown format" % target_file
def setUpClass(cls): cls.dataset_id = db_subs.create_dataset_8images() cls.images = [testdata.fits_file] cls.extraction_radius = 256 with open(default_parset_paths['persistence.parset']) as f: cls.parset = parset.read_config_section(f, 'persistence')
def setUpClass(cls): cls.dataset_id = db_subs.create_dataset_8images(extract_sources=True) with open(default_parset_paths['transient_search.parset']) as f: cls.parset = parset.read_config_section(f, 'transient_search')
def setUpClass(cls): cls.accessor = tkp.accessors.open(testdata.casa_table) with open(default_parset_paths['quality_check.parset']) as f: cls.parset = parset.read_config_section(f, 'quality_lofar')
def setUpClass(cls): cls.dataset_id = db_subs.create_dataset_8images() with open(default_parset_paths['source_extraction.parset']) as f: cls.parset = parset.read_config_section(f, 'source_extraction')