dace_query package

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: Path | None = None, config_path: Path | None = 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: dict, output_format: str | None) dict[str, np.ndarray] | DataFrame | Table | dict

Internal stuff

download_file(api_name: str, endpoint: str, params: dict | None = None, output_directory: str | None = None, output_filename: str | None = None) None

Internal stuff

static generate_short_sha1()

Internal stuff

static order_spectroscopy_data_by_instruments(data: dict[str, np.ndarray]) dict

Internal stuff

parse_parameters(json_data: dict) dict[str, list]

Internal stuff

persist_file_on_disk(api_name: str, obs_type: str, download_id: str, params: dict | None = None, output_directory: str | None = None, output_filename: str | None = None) None

Internal stuff

request_get(api_name: str, endpoint: str, params: dict | None = None, raw_response: bool | None = False) bytes | dict

Internal stuff

request_post(api_name: str, endpoint: str, json_data: dict | None = None, data: str | None = None, params: dict | None = None) dict

Internal stuff

static transform_coordinates_to_dict(sky_coord: SkyCoord, angle: Angle) dict

Internal stuff

static transform_dict_to_encoded_json(dict_to_transform: set | dict) str

Internal stuff

transform_to_format(json_data: dict, output_format: str | None = None)

Internal stuff

static write_stream(output_filename: Path | str, response: Response) None

Internal stuff

exception dace_query.dace.NoDataException

Bases: Exception

Raised when no data are provided

Module contents