pittgoogle.utils

Classes and functions to support working with alerts and related data.

Cast()

Methods to convert data types.


class pittgoogle.utils.Cast[source]

Methods to convert data types.

static alert_dict_to_table(alert_dict: dict) Table[source]

Package a ZTF alert dictionary into an Astropy Table.

Parameters:

alert_dict (dict) – A dictionary containing ZTF alert information.

Returns:

An Astropy Table containing the alert information.

Return type:

astropy.table.Table

static avro_to_dict(bytes_data)[source]

Converts Avro serialized bytes data to a dictionary.

Parameters:

bytes_data (bytes) – Avro serialized bytes data to be converted to a dictionary. The schema must be attached in the header.

Returns:

The unpacked dictionary from the bytes_data.

Return type:

dict

static b64avro_to_dict(bytes_data)[source]

Converts base64 encoded, Avro serialized bytes data to a dictionary.

Parameters:

bytes_data (bytes) – Base64 encoded, Avro serialized bytes data to be converted to a dictionary.

Returns:

The unpacked dictionary from the bytes_data.

Return type:

dict

static b64json_to_dict(bytes_data)[source]

Converts base64 encoded, JSON serialized bytes data to a dictionary.

Parameters:

bytes_data (Base64) – Data to be converted to a dictionary.

Returns:

The unpacked dictionary from the bytes_data.

Return type:

dict

static bytes_to_b64utf8(bytes_data)[source]

Convert bytes data to UTF-8.

Parameters:

bytes_data (bytes) – Data to be converted to UTF-8.

Returns:

The bytes_data converted to a string in UTF-8 format.

Return type:

str

static jd_to_readable_date(jd) str[source]

Converts a Julian date to a human-readable string.

Parameters:

jd (float) – Datetime value in Julian format.

Returns:

The jd in the format ‘day mon year hour:min’.

Return type:

str

static json_to_dict(bytes_data)[source]

Converts JSON serialized bytes data to a dictionary.

Parameters:

bytes_data (bytes) – Data to be converted to a dictionary.

Returns:

The unpacked dictionary from the bytes_data.

Return type:

dict

pittgoogle.utils.ztf_fid_names() dict[source]

Return a dictionary mapping the ZTF fid (filter ID) to the common name.