def test_numerical_relativity_file(self): token = str(uuid.uuid4()) self.responses.add( responses.GET, f"https://gwcloud.org.au/bilby/file_download/?fileId={token}", body=self.content.encode('utf-8'), status=200 ) supporting_files = [ { 'type': 'nmr', 'key': None, 'file_name': 'test.nmr', 'token': token } ] from core.submit import bilby_ini_to_args, prepare_supporting_files with TemporaryDirectory() as working_directory, cd(working_directory): args = bilby_ini_to_args(self.ini_file) prepare_supporting_files(args, supporting_files, working_directory) for supporting_file in supporting_files: self.assertTrue( ( Path(working_directory) / 'supporting_files' / supporting_file['type'] / supporting_file['file_name'] ).is_file() ) args = self.perform_ini_save_load_cycle(args) self.assertEqual(args.numerical_relativity_file, './supporting_files/nmr/test.nmr')
def test_psd1(self): token = str(uuid.uuid4()) self.responses.add( responses.GET, f"https://gwcloud.org.au/bilby/file_download/?fileId={token}", body=open(Path(__file__).parent.resolve() / 'data/psd.txt', 'rb').read(), status=200 ) supporting_files = [ { 'type': 'psd', 'key': 'V1', 'file_name': 'test.psd', 'token': token } ] from core.submit import bilby_ini_to_args, prepare_supporting_files with TemporaryDirectory() as working_directory, cd(working_directory): args = bilby_ini_to_args(self.ini_file) prepare_supporting_files(args, supporting_files, working_directory) for supporting_file in supporting_files: self.assertTrue( ( Path(working_directory) / 'supporting_files' / supporting_file['type'] / supporting_file['file_name'] ).is_file() ) args = self.perform_ini_save_load_cycle(args) self.assertDictEqual(args.psd_dict, {'V1': './supporting_files/psd/test.psd'})
def test_cal1(self): token = str(uuid.uuid4()) self.responses.add( responses.GET, f"https://gwcloud.org.au/bilby/file_download/?fileId={token}", body=self.content.encode('utf-8'), status=200 ) supporting_files = [ { 'type': 'cal', 'key': 'V1', 'file_name': 'test.cal', 'token': token } ] from core.submit import bilby_ini_to_args, prepare_supporting_files with TemporaryDirectory() as working_directory, cd(working_directory): args = bilby_ini_to_args(self.ini_file) prepare_supporting_files(args, supporting_files, working_directory) for supporting_file in supporting_files: self.assertTrue( ( Path(working_directory) / 'supporting_files' / supporting_file['type'] / supporting_file['file_name'] ).is_file() ) args = self.perform_ini_save_load_cycle(args) self.assertDictEqual(args.spline_calibration_envelope_dict, {'V1': './supporting_files/cal/test.cal'})
def test_timeslide_gps_file(self): token = str(uuid.uuid4()) self.responses.add( responses.GET, f"https://gwcloud.org.au/bilby/file_download/?fileId={token}", body=open(Path(__file__).parent.resolve() / 'data/gps_file_for_timeslides.txt', 'rb').read(), status=200 ) token2 = str(uuid.uuid4()) self.responses.add( responses.GET, f"https://gwcloud.org.au/bilby/file_download/?fileId={token2}", body=open(Path(__file__).parent.resolve() / 'data/timeslides.txt', 'rb').read(), status=200 ) supporting_files = [ { 'type': 'gps', 'key': None, 'file_name': 'test.gps', 'token': token }, { 'type': 'tsl', 'key': None, 'file_name': 'test.timeslide', 'token': token2 } ] from core.submit import bilby_ini_to_args, prepare_supporting_files with TemporaryDirectory() as working_directory, cd(working_directory): args = bilby_ini_to_args(self.ini_file) prepare_supporting_files(args, supporting_files, working_directory) for supporting_file in supporting_files: self.assertTrue( ( Path(working_directory) / 'supporting_files' / supporting_file['type'] / supporting_file['file_name'] ).is_file() ) args = self.perform_ini_save_load_cycle(args) self.assertTrue(args.gps_file.endswith('supporting_files/gps/test.gps')) self.assertTrue(args.timeslide_file.endswith('supporting_files/tsl/test.timeslide'))