Skip to content

esasky

anomaly_match_ui.utils.esasky

ESASky URL generation from RA/Dec coordinates.

get_esasky_url(ra, dec)

Generate an ESASky viewer URL for the given coordinates.

Parameters:

Name Type Description Default
ra float

Right Ascension in degrees.

required
dec float

Declination in degrees.

required

Returns:

Type Description
str

ESASky URL string.

Source code in anomaly_match_ui/utils/esasky.py
def get_esasky_url(ra: float, dec: float) -> str:
    """Generate an ESASky viewer URL for the given coordinates.

    Args:
        ra: Right Ascension in degrees.
        dec: Declination in degrees.

    Returns:
        ESASky URL string.
    """
    return _ESASKY_URL.format(ra=ra, dec=dec)

get_coordinates(filename, cfg)

Try to get RA/Dec from metadata CSV, Cutana catalogue, or FITS WCS headers.

Parameters:

Name Type Description Default
filename str

The source filename to look up.

required
cfg DotMap

Configuration object with metadata and search paths.

required

Returns:

Type Description
tuple[float, float] | None

(ra, dec) tuple if coordinates are available, None otherwise.

Source code in anomaly_match_ui/utils/esasky.py
def get_coordinates(filename: str, cfg: DotMap) -> tuple[float, float] | None:
    """Try to get RA/Dec from metadata CSV, Cutana catalogue, or FITS WCS headers.

    Args:
        filename: The source filename to look up.
        cfg: Configuration object with metadata and search paths.

    Returns:
        ``(ra, dec)`` tuple if coordinates are available, ``None`` otherwise.
    """
    # 1. Check metadata CSV (cfg.metadata_file)
    coords = _from_metadata_csv(filename, cfg)
    if coords is not None:
        return coords

    # 2. Check Cutana catalogue (parquet files in search dir)
    coords = _from_cutana_catalogue(filename, cfg)
    if coords is not None:
        return coords

    # 3. Try FITS WCS headers
    coords = _from_fits_wcs(filename, cfg)
    if coords is not None:
        return coords

    return None