Data conversions#
lsst.cst submodule include operations related to data conversions and format
- lsst.cst.conversions.data_id_to_str(data_id)#
Returns a data identifier dictionary to a string
- Parameters:
data_id ('dict') – Data identifier dictionary.
- Returns:
data_id_str – Data identifier string
- Return type:
- lsst.cst.conversions.get_psf_properties(psf, point)#
Function to obtain PSF properties.
- Parameters:
psf (
lsst.meas.extensions.psfex.PsfexPsf) – PSF object.point (
lsst.geom.Point2D) – Coordinate where the PSF is being evaluated.
- Returns:
psf_values – PsfProperties object containing psf properties: fhwm, ap_flux, peak and dims.
- Return type:
PsfProperties
- lsst.cst.conversions.ids_to_str(data_ids)#
- Transform a numpy array of ids (long int)
to a comma-separated values string
- Parameters:
data_ids (
numpy.ndarray) – numpy array with objects id- Returns:
result – String with separated by comma-separated values from the data_ids
- Return type:
- lsst.cst.conversions.shuffle_dataframe(df, random_state=0)#
Return a copy of the dataframe df shuffled, random_state argument may be used to reproduce same shuffling.
- Parameters:
df (
pandas.DataFrame) – dataframe to be shuffledrandom_state (
int) – number to reproduce same randomness
- Returns:
result – shuffled dataframe
- Return type:
- lsst.cst.conversions.sort_dataframe(df, sort_key, ascending=False, set_index=True)#
Return a sorted copy of the dataframe ‘df’ by index, selecting the desired order (ascending or descending) using the ascending argument, it also exchanges the index of the dataframe for the sort_key if set_index parameter is True (default).
- Parameters:
df (
pandas.DataFrame) – dataframe to be sortedsort_key (
str) – column key used to sort the dataframeascending (
bool, optional) – ascending/descending sortingset_index (
bool, optional) – set sorted key as the dataframe index
- Returns:
result – Copy of the
DataFramesorted using the selected column.- Return type:
- lsst.cst.conversions.tract_patch_from_ra_dec(ra, dec)#
Look for nearest tract-patch information from a coordinate ra-dec.
- Parameters:
ra (
np.float64) – Coordinate ascension.dec (
np.float64) – Coordinate declination.
- Returns:
value – Tract patch information
- Return type:
TractPatchInformation