def do_listobs(infile, outfile): # make sure the directory for the file exists dir_path, tail = os.path.split(outfile) if not os.path.exists(dir_path): os.makedirs(dir_path) listobs(vis=infile, verbose=False, listfile='/tmp/listfile.txt') parse_listobs = ParseListobs('/tmp/listfile.txt') parse_listobs.parse() json_string = parse_listobs.get_json_string() with open(outfile, mode='w') as out_file: out_file.write(json_string)
def do_listobs(infile, outfile): # make sure the directory for the file exists dir_path, tail = os.path.split(outfile) if not os.path.exists(dir_path): os.makedirs(dir_path) listobs(vis=infile, verbose=False, listfile='/tmp/listfile.txt') parse_listobs = ParseListobs('/tmp/listfile.txt') parse_listobs.parse() json_string = parse_listobs.get_json_string() with open(outfile, mode='w') as out_file: out_file.write(json_string)
def test_parse_file(self): parse_listobs = ParseListobs('/tmp/listobs.txt') parse_listobs.parse() data = parse_listobs.get_data() self.assertEqual(data['MeasurementSet Name'], '/mnt/hidata/chiles/final_products/20140120_941_2_FINAL_PRODUCTS/13B-266.sb25390589.eb28661773.56677.175470648144_calibrated_deepfield.ms') self.assertEqual(data['Observer'], 'Jacqueline H. van Gorkom') self.assertEqual(data['Project'], 'uid://evla/pdb/25320050') self.assertEqual(data['Observation'], 'EVLA(26 antennas)') self.assertEqual(data['Project'], 'uid://evla/pdb/25320050') self.assertEqual(data['Bottom edge'], '941.000') fields = data['Fields'] self.assertEqual(fields['Field count'], '1') self.assertEqual(fields['Fields'][0][0], '0')
def test_parse_file(self): parse_listobs = ParseListobs('/tmp/listobs.txt') parse_listobs.parse() data = parse_listobs.get_data() self.assertEqual( data['MeasurementSet Name'], '/mnt/hidata/chiles/final_products/20140120_941_2_FINAL_PRODUCTS/13B-266.sb25390589.eb28661773.56677.175470648144_calibrated_deepfield.ms' ) self.assertEqual(data['Observer'], 'Jacqueline H. van Gorkom') self.assertEqual(data['Project'], 'uid://evla/pdb/25320050') self.assertEqual(data['Observation'], 'EVLA(26 antennas)') self.assertEqual(data['Project'], 'uid://evla/pdb/25320050') self.assertEqual(data['Bottom edge'], '941.000') fields = data['Fields'] self.assertEqual(fields['Field count'], '1') self.assertEqual(fields['Fields'][0][0], '0')