diff --git a/examples/vo/lotss_dr2/lotss_dr2_mosaics_localhost.args b/examples/vo/lotss_dr2/lotss_dr2_mosaics_localhost.args index 0ba501261ed2970ae4dfa47f99c0d3df0075e812..bae8f7104fc50071e190b53599c1da132261c7aa 100644 --- a/examples/vo/lotss_dr2/lotss_dr2_mosaics_localhost.args +++ b/examples/vo/lotss_dr2/lotss_dr2_mosaics_localhost.args @@ -7,3 +7,4 @@ --adex_token=9519e433ba37487f1a18121dfb1957d992fbb790 --clear_collection --collection=lotts-dr2 +--simulate_post \ No newline at end of file diff --git a/scraper/vo/connectors/Apertif_DR1.py b/scraper/vo/connectors/Apertif_DR1.py index 05ead4271344ac419562fe8e03a9535deba24cb4..56d77574ed1b2e0b0efde2e71db5d79f509f0f7a 100644 --- a/scraper/vo/connectors/Apertif_DR1.py +++ b/scraper/vo/connectors/Apertif_DR1.py @@ -24,7 +24,7 @@ class ContinuumImagesConnector(): access_url=row['accref'], ra=float(row['centeralpha']), dec=float(row['centerdelta']), - equinox=str(row['wcs_equinox']), + equinox="2000.0", exposure_time=None, central_frequency=freq_avg, @@ -45,9 +45,9 @@ class ContinuumImagesConnector(): ) # useful settings, do something with it? - dateobs = row['dateobs'] - mime = row['mime'] - bandpassid = row['bandpassid'], + #dateobs = row['dateobs'] + #mime = row['mime'] + #bandpassid = row['bandpassid'], return payload diff --git a/scraper/vo/connectors/LotssDR2.py b/scraper/vo/connectors/LotssDR2.py index fd9a8fa20aea9f64bbf9c135b3a12b7e2050fdfa..106d8a5bba217e2ceffe7f7f3ccff50764df43f7 100644 --- a/scraper/vo/connectors/LotssDR2.py +++ b/scraper/vo/connectors/LotssDR2.py @@ -19,7 +19,7 @@ class LotssDR2Mosaics(): access_url=row['accref'], ra=float(row['centeralpha']), dec=float(row['centerdelta']), - equinox=str(row['wcs_equinox']), + equinox="2000.0", exposure_time=None, central_frequency=None, @@ -39,11 +39,11 @@ class LotssDR2Mosaics(): ) # useful settings, do something with it? - collection = 'lotss_dr2_mosaics' - dataset_ids = row['lofar_obsids'], - dateobs = row['dateobs'] - mime = row['mime'] - bandpassid = row['bandpassid'], + #collection = 'lotss_dr2_mosaics' + #dataset_ids = row['lofar_obsids'], + #dateobs = row['dateobs'] + #mime = row['mime'] + #bandpassid = row['bandpassid'], return payload diff --git a/tests/test_connectors_postgres.py b/tests/test_connectors_postgres.py index 5e85288fd4792a20bdddfd58b834e8dcd66deb58..2d8e40b6e5a8d06f3f8ef27a6b2f9132566fa197 100644 --- a/tests/test_connectors_postgres.py +++ b/tests/test_connectors_postgres.py @@ -1,5 +1,6 @@ import types import unittest +import argparse from scraper.postgres.connectors.apertif import Inspectionplots @@ -11,11 +12,9 @@ class TestConnectorPostgresApertif(unittest.TestCase): pid = 5 url = 'some_access_url' dataset_id = 23 - row = (name, pid, url, '', '', dataset_id) - args_collection = [1, 2, 3] - args = types.SimpleNamespace(collection=args_collection) + args = argparse.Namespace(collection='my_collection') expected = { 'pid': pid, @@ -26,7 +25,7 @@ class TestConnectorPostgresApertif(unittest.TestCase): 'access_url': url, 'dataset_id': str(dataset_id), 'parent': None, - 'collection': args_collection, + 'collection': 'my_collection', } # act diff --git a/tests/test_connectors_vo.py b/tests/test_connectors_vo.py index ea5dad4d416fe326664b433503d1497ee83ab117..9d3ce77cf4a320c3942a0183a3a8112ae8c79504 100644 --- a/tests/test_connectors_vo.py +++ b/tests/test_connectors_vo.py @@ -1,16 +1,103 @@ +import argparse import unittest +from scraper.vo.connectors.Apertif_DR1 import ContinuumImagesConnector +from scraper.vo.connectors.LotssDR2 import LotssDR2Mosaics -# TODO: implement class TestConnectorVOApertif(unittest.TestCase): - pass + def test_continuum_images_translate(self): + + # arrange + row = { + 'accref': 'https://vo.astron.nl/getproduct/APERTIF_DR1/190807041_AP_B001/image_mf_02.fits', + 'freqmin' : 1360.36, + 'freqmax' : 1360.36, + 'imagetitle': '190807041_AP_B001', + 'pub_did': 'ivo://astron.nl/~?APERTIF_DR1/190807041_AP_B001/image_mf_02.fits', + 'centeralpha': 208.360378733881, + 'centerdelta': 52.3613884370237, + 'wcs_equinox': '2000.0', + 'obsid': '190807041', + } + args = argparse.Namespace(collection='apertif-dr1') + expected = {'pid': 'ivo://astron.nl/~?APERTIF_DR1/190807041_AP_B001/image_mf_02.fits', + 'name': '190807041_AP_B001', + 'dp_type': 'science_skymap', + 'format': 'fits', + 'locality': 'online', + 'access_url': 'https://vo.astron.nl/getproduct/APERTIF_DR1/190807041_AP_B001/image_mf_02.fits', + 'ra': 208.360378733881, + 'dec': 52.3613884370237, + 'equinox': '2000.0', + 'exposure_time': None, + 'central_frequency': 1360.3599853515625, + 'frequency_resolution': None, + 'time_resolution': None, + 'bandwidth': None, + 'release_date': '2023-03-20T12:34:21.433848', + 'data_provider': 'ASTRON', + 'PSF_size': None, + 'sky_footprint': None, + 'dataset_id': '190807041', + 'collection': 'apertif-dr1', + 'parent': None} + expected = expected + + # act + connector = ContinuumImagesConnector() + actual = connector.translate(row=row, args=args) + + # assert contents ignoring order + self.assertCountEqual(actual, expected) # TODO: implement class TestConnectorVOFocus(unittest.TestCase): pass -# TODO: implement class TestConnectorVOLotssDR2(unittest.TestCase): - pass + def test_mosaics_translate(self): + # arrange + row = { + 'accref': 'https://vo.astron.nl/getproduct/APERTIF_DR1/190807041_AP_B001/image_mf_02.fits', + 'freqmin': 1360.36, + 'freqmax': 1360.36, + 'imagetitle': '190807041_AP_B001', + 'data_pid': '21.12136/ede3eff0-266a-465a-af68-6f292391485f', + 'centeralpha': 208.360378733881, + 'centerdelta': 52.3613884370237, + 'wcs_equinox': '2000.0', + 'lofar_obsids': [689778], + } + args = argparse.Namespace(collection='lotts-dr2') + expected = {'pid': '21.12136/ede3eff0-266a-465a-af68-6f292391485f', + 'name': 'P000+23_mosaic-blanked.fits', + 'dp_type': 'unknown', + 'format': 'other', + 'locality': 'online', + 'access_url': 'https://vo.astron.nl/getproduct/LoTSS-DR2/P000%2B23', + 'ra': 0.03125, + 'dec': 23.3953, + 'equinox': '2000.0', + 'exposure_time': None, + 'central_frequency': None, + 'frequency_resolution': None, + 'time_resolution': None, + 'bandwidth': None, + 'release_date': '2023-03-20T14:01:36.328040', + 'data_provider': 'ASTRON', + 'PSF_size': None, + 'sky_footprint': None, + 'dataset_id': '689778', + 'parent': None, + 'collection': 'lotts-dr2'} + expected = expected + + # act + connector = LotssDR2Mosaics() + actual = connector.translate(row=row, args=args) + + # assert contents ignoring order + self.assertCountEqual(actual, expected) +