Skip to content

EUCLID: include new parameters in the constructor to set the urls for the tap, datalink and cutout services #3288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ alma

- Bug fix in ``footprint_to_reg`` that did not allow regions to be plotted. [#3285]

esa.euclid
^^^^^^^^^^

- New parameters in the EuclidClass constructor to specify non-standard environments. [#3288]

heasarc
^^^^^^^

Expand Down
24 changes: 20 additions & 4 deletions astroquery/esa/euclid/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class EuclidClass(TapPlus):
__VALID_DATALINK_RETRIEVAL_TYPES = conf.VALID_DATALINK_RETRIEVAL_TYPES

def __init__(self, *, environment='PDR', tap_plus_conn_handler=None, datalink_handler=None, cutout_handler=None,
verbose=False, show_server_messages=True):
euclid_tap_server=None, euclid_data_server=None, euclid_cutout_server=None, verbose=False,
show_server_messages=True):
"""Constructor for EuclidClass.

Parameters
Expand All @@ -55,6 +56,12 @@ def __init__(self, *, environment='PDR', tap_plus_conn_handler=None, datalink_ha
HTTP(s) connection hander (creator). If no handler is provided, a new one is created.
cutout_handler : cutout connection handler object, optional, default None
HTTP(s) connection hander (creator). If no handler is provided, a new one is created.
euclid_tap_server : str, optional, default None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already possible to use these optionals via the config system (I did the very same for the IRSA euclid testing prior to the data release).

Have you tried that and found not convenient or didn't know about it?
( I would like to think about the overall astroquery API first before starting patching up the modules with different approaches to override default config items)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the init.py file we defined those environments that are exposed to the public (see dictionary ENVIRONMENTS). But we do not want to include similar information for more restricted environments (develop and integration environments), I mean, for those that should be only used by the develop team at ESAC.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I mean is that you can have those locally in your astroquery.cfg file. It's not exposed to anyone. (But I found it a bit cumbersome as there can only be one config/url, so when I was testing on the IPAC side, I stuck with using the irsadev server for all my queries, and needed to remember to turn it back off to the defaults when I was testing non-euclid related things.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@cosmoJFH cosmoJFH Apr 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @bsipocz, thanks for your feedback. I didn't know the usage of the astroquery.cfg file. We have used it in a local implementation of the EuclidClass and it works fine. But you are right that any user that uses this mechanism needs to remember to turn back off to the default values.

An alternative is the usage of the handlers, as it was mentioned by @andamian

from astroquery.utils.tap import TapPlus
from astroquery.utils.tap.conn.tapconn import TapConn
from astroquery.esa.euclid import EuclidClass


tap_conn = TapConn(ishttps=True,
                              host='https://eas.esac.esa.int/',
                              server_context='tap-server',
                              tap_context="tap",
                              upload_context="Upload",
                              table_edit_context="TableTool",
                              data_context="data",
                              datalink_context="tap_plus_conn_handler")

datalink_handler = TapPlus(url='https://eas.esac.esa.int/', server_context="sas-dd", tap_context="tap-server", upload_context="Upload", table_edit_context="TableTool", data_context="data", datalink_context="datalink",  verbose=True,  client_id='ASTROQUERY', use_names_over_ids=True)

cutout_handler = TapPlus(url='https://eas.esac.esa.int/', server_context="sas-cutout", tap_context="tap-server", upload_context="Upload", table_edit_context="TableTool", data_context="cutout", datalink_context="datalink",  verbose=true,  client_id='ASTROQUERY', use_names_over_ids=true)


euclid = EuclidClass(tap_plus_conn_handler=tap_conn, datalink_handler=datalink_handler, cutout_handler=cutout_handler)

but we think that this could be too complex for a regular user.

the TAP url
euclid_data_server : str, optional, default None
the datalink url
euclid_cutout_server : str, optional, default None
the cutout url
verbose : bool, optional, default 'True'
flag to display information about the process
show_server_messages : bool, optional, default 'True'
Expand All @@ -72,7 +79,16 @@ def __init__(self, *, environment='PDR', tap_plus_conn_handler=None, datalink_ha

url_server = conf.ENVIRONMENTS[environment]['url_server']

super(EuclidClass, self).__init__(url=url_server,
if euclid_tap_server is None:
euclid_tap_server = url_server

if euclid_data_server is None:
euclid_data_server = url_server

if euclid_cutout_server is None:
euclid_cutout_server = url_server

super(EuclidClass, self).__init__(url=euclid_tap_server,
server_context='tap-server',
tap_context="tap",
upload_context="Upload",
Expand All @@ -85,7 +101,7 @@ def __init__(self, *, environment='PDR', tap_plus_conn_handler=None, datalink_ha
use_names_over_ids=conf.USE_NAMES_OVER_IDS)

if datalink_handler is None:
self.__eucliddata = TapPlus(url=url_server,
self.__eucliddata = TapPlus(url=euclid_data_server,
server_context="sas-dd",
tap_context="tap-server",
upload_context="Upload",
Expand All @@ -99,7 +115,7 @@ def __init__(self, *, environment='PDR', tap_plus_conn_handler=None, datalink_ha
self.__eucliddata = datalink_handler

if cutout_handler is None:
self.__euclidcutout = TapPlus(url=url_server,
self.__euclidcutout = TapPlus(url=euclid_cutout_server,
server_context="sas-cutout",
tap_context="tap-server",
upload_context="Upload",
Expand Down
Loading