dace_query#

Subpackages#

Submodules#

dace_query.dace module#

dace_query.dace.Dace = <dace_query.dace.DaceClass object>#

Dace instance

class dace_query.dace.DaceClass(dace_rc_config_path=None, config_path=None)#

Bases: object

The dace class. When initializing an instance with this class, it loads the user .dacerc and config.ini files to authentify the current user and define which endpoints to use.

The .dacerc file, (you have to create it), located by default in the home directory (~/.dacerc) and in TOML format, defines a user section with a key-value pair specifying the user’s API key (see below).

[user]
key = apiKey:<xxx-xxx-xxx>

To obtain an API key:

  1. Login on dace (https://dace.unige.ch)

  2. Go to the user profile

  3. Click on [Generate a new API key]

The config.ini file, in CFG format and already included in the dace package, defines default DACE endpoints to use (see below).

[api]

evo-webapp = https://evo-webapp.obsuksprd2.unige.ch/
exo-webapp = https://exo-webapp.obsuksprd2.unige.ch/
lossy-webapp = https://lossy-webapp.obsuksprd2.unige.ch/
obs-webapp = https://obs-webapp.obsuksprd2.unige.ch/
opa-webapp = https://opa-webapp.obsuksprd2.unige.ch/
open-webapp = https://od-webapp.obsuksprd2.unige.ch/
tess-webapp = https://tess-webapp.obsuksprd2.unige.ch/
cheops-webapp = https://cheops-webapp.obsuksprd2.unige.ch/
monitoring-webapp = https://pipe-webapp.obsuksprd2.unige.ch/

A dace instance is already provided, to use it :

>>> from dace_query import Dace
static convert_to_format(data, output_format)#

Internal stuff

Return type:

Union[dict[str, ndarray], DataFrame, Table, dict]

download_file(api_name, endpoint, params=None, output_directory=None, output_filename=None)#

Internal stuff

Return type:

None

download_static_file_from_url(url, output_directory=None, output_filename=None)#
Return type:

None

static generate_short_sha1()#

Internal stuff

static order_spectroscopy_data_by_instruments(data)#

Internal stuff

Return type:

dict

parse_parameters(json_data)#

Internal stuff

Return type:

dict[str, list]

persist_file_on_disk(api_name, obs_type, download_id, params=None, output_directory=None, output_filename=None)#

Internal stuff

Return type:

None

request_get(api_name, endpoint, params=None, raw_response=False)#

Internal stuff

Return type:

Union[bytes, dict]

request_post(api_name, endpoint, json_data=None, data=None, params=None)#

Internal stuff

Return type:

dict

static transform_coordinates_to_dict(sky_coord, angle)#

Internal stuff

Return type:

dict

static transform_coordinates_to_dict_old(sky_coord, angle)#

Internal stuff

Return type:

dict

static transform_dict_to_encoded_json(dict_to_transform)#

Internal stuff

Return type:

str

transform_to_format(json_data, output_format=None)#

Internal stuff

static write_stream(output_filename, response)#

Internal stuff

Return type:

None

exception dace_query.dace.NoDataException#

Bases: Exception

Raised when no data are provided