Photo-z Server

Tutorial Notebook

Contact author: Julia Gschwend

Last verified run: 2024-Dec-11

The PZ Server

Introduction

The PZ Server is an online service available for the LSST Community to host and share lightweight photo-z (PZ) -related data products. The upload and download of data and metadata can be done at the website pz-server.linea.org.br (during the development phase, a test environment is available at pz-server-dev.linea.org.br). There, you will find two pages containing a list of data products each: one for Rubin Observatory Data Management’s official data products and the other for user-generated data products. The registered data products can also be accessed directly from Python code using the PZ Server’s data access API, as demonstrated below.

The PZ Server is developed and delivered as part of the in-kind contribution program BRA-LIN, from LIneA to the Rubin Observatory’s LSST project. The service is hosted in the Brazilian IDAC, not directly connected to the Rubin Science Platform (RSP). However, user authorization requires the same credentials as RSP. For comprehensive documentation about the PZ Server, please visit the PZ Server’s documentation page. There, you will also find an overview of all LIneA’s contributions related to the PZ production. The internal documentation of the API functions is available on the API’s documentation page.

How to upload a data product on the PZ Server website

To upload a data product, click the button NEW PRODUCT on the top left of the User-generated Data Products page and fill in the Upload Form with relevant metadata. Alternatively, the user can programmatically upload files to the PZ Server via the pzserver Python Library (described below).

How to download a data product from the PZ Server website

To download a data product available on the Photo-z Server, go to one of the two pages by clicking on the card “Rubin Observatory PZ Data Products” (for official products released by Rubin Data Management Team) or “User-generated Data Products” (for products uploaded by the members of LSST community). The download button is on the right side of each data product (each row of the list). Also, there are buttons to share, remove, and edit the metadata of a given data product.

The PZ Server API (Python library pzserver)

Installation

The PZ Server API is avalialble on pip as pzserver. To install the API and its dependencies, type on the Terminal:

$ pip install pzserver

Or in a notebook code cell:

#! pip install pzserver

OBS: Depending on your Jupyter Lab version, you might need to restart the kernel to incorporate the new library.

Imports and Setup

from pzserver import PzServer
import matplotlib.pyplot as plt
%reload_ext autoreload
%autoreload 2

The connection with the PZ Server from Python code is done by an object of the class PzServer. To get authorization to define an instance of PzServer, the users must provide an API Token generated on the top right menu on the PZ Server website (during the development phase, on the test environment).

# pz_server = PzServer(token="<your token>", host="pz-dev") # "pz-dev" is the temporary host for test phase

For convenience, the token can be saved as token.txt (which is already listed in the .gitignore file in this repository).

with open('token.txt', 'r') as file:
    token = file.read()
pz_server = PzServer(token=token, host="pz-dev") # "pz-dev" is the temporary host for test phase

How to get general info from PZ Server

The object pz_server created above can provide access to data and metadata stored in the PZ Server. It also brings additional methods for users to navigate through the available content. The methods with the prefix get_ return the result of a query on the PZ Server database as a Python dictionary and are most useful to be used programmatically (see details on the API documentation page). Alternatively, those with the prefix display_ show the results as a styled Pandas DataFrames, optimized for Jupyter Notebook (note: column names might change in the display version). For instance:

Display the list of product types supported with a short description;

pz_server.display_product_types()
Product Type product_type Description
Spec-z Catalog specz_catalog Catalog of spectroscopic redshifts and positions (usually equatorial coordinates).
Training Set training_set Training set for photo-z algorithms (tabular data). It usually contains magnitudes, errors, and true redshifts.
Training Results training_results Any file(s) resulting from the training of machine learning algorithms (free format). E.g.: output of RAIL inform module estimator_.pkl
Validation Results validation_results Results of a photo-z validation procedure (free format). Usually contains photo-z estimates (single estimates and/or pdf) of a validation set and photo-z validation metrics.
Photo-z Table photoz_table Results of a photo-z estimation procedure. If the data is larger than the file upload limit (200MB), the product entry stores only the metadata (instructions on accessing the data should be provided in the description field.

Display the list of users who uploaded data products to the server;

pz_server.display_users()
GitHub Username Name
admin
andreiadourado andreiadourado
Biancasilva9 Silva
bruno-moraes Moraes
carlosadean carlosadean
crisingulani crisingulani
deborajanini Janini
drewoldag Drew Oldag
fpcardoso Cardoso
glaubervila glaubervila
GloriaFA Gloria Fonseca Alvarez
gschwend gschwend
gverde
hdante Henrique
HeloisaMengisztki HeloisaMengisztki
http://cilogon.org/serverE/users/189487 CARDOSO
http://cilogon.org/serverE/users/190300 Singulani
http://cilogon.org/serverE/users/198333 Singulani
iagolops iagolops
jandsonrj jandsonrj
leandrops19
luigilcsilva luigilcsilva
luigisilva luigisilva
luiz-nicolaci
MelissaGraham Melissa Graham
saraviz Aviz
singulani

Display the list of data releases available at the time;

pz_server.display_releases()
Release Description
LSST DP0.1 LSST Data Preview 0.1
LSST DP0.2 LSST Data Preview 0.2

Display all available data products (WARNING: This list can rapidly grow during the survey’s operation).

pz_server.display_products_list()
id internal_name product_name product_type release uploaded_by official_product pz_code description created_at
189 189_example_upload_via_lib example upload via lib Spec-z Catalog None gschwend False None None 2024-12-11T15:17:18.272001Z
188 188_example_upload_via_lib example upload via lib Spec-z Catalog None gschwend False None None 2024-12-11T14:36:24.417710Z
182 182_example_tpz_training_results Example TPZ Training Results Training Results LSST DP0.2 gschwend False Example of RAIL inform (training) results using TPZ. 2024-12-10T17:08:20.025367Z
181 181_example_upload_via_lib example upload via lib Spec-z Catalog None gschwend False None None 2024-12-10T03:01:05.190194Z
180 180_example_upload_via_lib example upload via lib Spec-z Catalog None gschwend False None None 2024-12-03T17:20:32.975994Z
179 179_singulani_test0015 singulani_test0015 Training Set LSST DP0.2 crisingulani False None None 2024-11-28T16:47:00.649595Z
178 178_singulani_test013 singulani_test013 Training Set LSST DP0.2 crisingulani False None None 2024-11-22T18:18:41.216437Z
174 174_singulani_test011 singulani_test011 Training Set LSST DP0.2 crisingulani False None None 2024-11-18T16:43:39.346911Z
155 155_tsm_test_dp02_object_vs_dp01_truth_random_sample TSM_Test_DP02_object_vs_DP01_truth_random_sample Training Set LSST DP0.2 luigilcsilva False None None 2024-10-17T13:57:29.579577Z
154 154_tsm_test_dp02_object_vs_dp01_truth_random_sample TSM_Test_DP02_object_vs_DP01_truth_random_sample Training Set LSST DP0.2 luigilcsilva False None None 2024-10-17T13:48:17.833884Z
153 153_tsm_test_dp02_object_vs_dp01_truth_random_sample TSM_Test_DP02_object_vs_DP01_truth_random_sample Training Set LSST DP0.2 luigilcsilva False None None 2024-10-17T13:39:00.003188Z
152 152_random_training_set random_training_set Training Set LSST DP0.2 gschwend False null Training set created with the Training Set Maker pipeline. Science validation yet to be done! 2024-10-16T00:14:33.426501Z
148 148_desi_edr DESI EDR Spec-z Catalog None gschwend True Value Added Redshift Summary Catalog filtered to include only galaxies. See https://data.desi.lbl.gov/doc/releases/edr/vac/zcat/ for details. 2024-10-15T19:53:27.383084Z
129 129_random_truth_z random truth z Spec-z Catalog None gschwend False random selection of objects from the DP0.1 truth catalog 2024-09-12T22:05:55.720144Z
91 91_example_upload_via_lib example upload via lib Spec-z Catalog None gschwend False None None 2024-07-22T18:44:36.505561Z
87 87_None truth random Spec-z Catalog LSST DP0.2 gschwend False null random selection of objects from the DP0.1 truth catalog 2024-07-22T15:32:29.933332Z
86 86_None mock speczs Spec-z Catalog LSST DP0.2 gschwend False Spec-zs randomly selected (0.2 percent) from the dp01 truth catalog filtered by truth_type (only galaxies). 2024-07-22T15:23:52.709801Z
85 85_example example Training Set LSST DP0.2 gschwend False example 2024-07-22T02:21:58.128939Z
83 83_example_upload_via_lib example upload via lib Spec-z Catalog None luigilcsilva False None None 2024-07-12T18:57:01.015290Z
78 78_example_upload_via_lib example upload via lib Spec-z Catalog None gschwend False None None 2024-07-04T15:40:29.732156Z
75 75_upload_example_1 upload example 1 Spec-z Catalog None gschwend False None None 2024-06-17T19:36:50.416031Z
73 73_tpz_results TPZ Results Validation Results None andreiadourado False Results of photoz validation using TPZ lite on simulated training set from DC2 TruthSummary table. Files: 03_run_tpz. html -> jupyter notebook (HTML version) with algorithm train; 04_metrics.html -> jupyter notebook (HTML version) with results analysis; model.pkl -> model generated in the "inform method"; output.hdf5 -> "estimate stage" results (PDFs). 2024-06-06T23:20:04.439030Z
72 72_pzcompute_results_for_qa_validation PZ-Compute Results for QA Validation Validation Results LSST DP0.2 HeloisaMengisztki False This zip contains two files: validation_set.hdf5 with the data input to run estimate, contains the redshift values so that it can be used as the truth file. And the validation_set_output.hdf5 is the output after running estimate, with the computed photoz for fzboost algorithm. 2024-06-05T18:57:27.428106Z
64 64_training_set_lsst_dp02 Training set LSST DP0.2 Training Set None andreiadourado False Simulated training set from DC2 TruthSummary table. Random data (random_data.hdf5): table with the true magnitudes used to create the simulated set. 2024-05-21T14:42:47.340619Z
63 63_specz_sample Spec-z sample LSST DP0.2 Spec-z Catalog None andreiadourado False Spec-z sample created from a random fraction of object Ids from Object Table. 2024-05-21T13:36:19.884481Z
52 52_2dflens_public_specz 2dFLenS Public spec-z Spec-z Catalog None saraviz False Sample containing the 2dFLenS spec-z data contained in the original file Public spec-z compilation 2024-04-08T14:21:46.577298Z
51 51_zcosmos_public_specz zCOSMOS Public spec-z Spec-z Catalog None saraviz False Sample containing the zCOSMOS spec-z data contained in the original file Public spec-z compilation 2024-04-07T23:06:40.185605Z
50 50_vipers_public_specz VIPERS Public spec-z Spec-z Catalog None saraviz False Sample containing the VIPERS spec-z data contained in the original file Public spec-z compilation 2024-04-07T23:05:10.825559Z
49 49_sdss_dr16_public_specz SDSS (DR16) Public spec-z Spec-z Catalog None saraviz False Sample containing the SDSS spec-z data contained in the original file Public spec-z compilation 2024-04-07T20:14:23.831347Z
48 48_saga_public_specz SAGA Public spec-z Spec-z Catalog None saraviz False Sample containing the SAGA spec-z data contained in the original file Public spec-z compilation 2024-04-07T19:39:01.003263Z
47 47_glass_public_specz GLASS Public spec-z Spec-z Catalog None saraviz False Sample containing the GLASS spec-z data contained in the original file Public spec-z compilation. 2024-04-07T19:20:41.913016Z
45 45_gama_public_specz GAMA Public spec-z Spec-z Catalog None saraviz False Sample containing the GAMA spec-z data contained in the original file Public spec-z compilation 2024-04-03T10:19:00.379907Z
44 44_deep2_public_specz DEEP2 Public spec-z Spec-z Catalog None saraviz False Sample containing the DEEP2 spec-z data contained in the original file Public spec-z compilation 2024-03-31T22:10:01.314578Z
42 42_3dhst_public_specz 3DHST Public spec-z Spec-z Catalog LSST DP0.2 HeloisaMengisztki False Sample containing the 3DHST spec-z data contained in the original file Public spec-z compilation. 2024-03-27T23:20:29.545013Z
41 41_deimos_10k_public_specz DEIMOS 10K Public spec-z Spec-z Catalog None luigilcsilva False Sample containing the DEIMOS 10K spec-z data contained in the original file Public spec-z compilation. 2024-03-27T19:29:59.552926Z
33 33_simple_pz_training_set Simple pz training set Training Set LSST DP0.2 GloriaFA False Simple training set produced by https://github.com/rubin-dp0/delegate-contributions-dp02/blob/main/photoz/Training_Set_Creation/simple_pz_training_set.ipynb, developed by Melissa Graham. 2024-02-28T07:00:41.119818Z
28 28_dc2_tiny_true_z_sample DC2 Tiny true z sample Spec-z Catalog None gschwend False A small sample with 16917 redshifts retrieved from RSP cloud. 2023-11-29T20:30:26.900286Z
27 27_public_training_set_des_dr2 Public Training Set DES DR2 Training Set None gschwend False Result of cross-matching the public spec-z compilation with DES DR2 coadd objects catalog. 2023-10-17T21:32:21.727199Z
26 26_public_specz_compilation Public spec-z compilation Spec-z Catalog None gschwend False A compilation of public spectroscopic redshift catalogs collected over the years of operation of the Dark Energy Survey (DES) and systematically grouped by a DES Science Portal tool to form the basis of a training set for photo-z algorithms based on machine learning. 2023-10-17T21:29:08.341090Z
14 14_gama_specz_subsample GAMA spec-z subsample Spec-z Catalog None gschwend False A small subsample of the GAMA DR3 spec-z catalog (Baldry et al. 2018) as an example of a typical spec-z catalog from the literature. 2023-03-29T20:02:45.223568Z
13 13_vvds_specz_subsample VVDS spec-z subsample Spec-z Catalog None gschwend False A small subsample of the VVDS spec-z catalog (Le Fèvre et al. 2004, Garilli et al. 2008) as an example of a typical spec-z catalog from the literature. 2023-03-29T19:50:27.593735Z
12 12_goldenspike_knn Goldenspike KNN Validation Results None gschwend False KNN Results of photoz validation using KNN on a mock test set from the example notebook goldenspike.ipynb available in RAIL's repository. 2023-03-29T19:49:35.652295Z
11 11_goldenspike_flexzboost Goldenspike FlexZBoost Validation Results None gschwend False FlexZBoost Results of photoz validation using FlexZBoost on a mock test set from the example notebook goldenspike.ipynb available in RAIL's repository. 2023-03-29T19:48:34.864629Z
10 10_goldenspike_bpz Goldenspike BPZ Validation Results LSST DP0.2 gschwend False BPZ Results of photoz validation using BPZ on a mock test set from the example notebook goldenspike.ipynb available in RAIL's repository. 2023-03-29T19:42:04.424990Z
9 9_goldenspike_train_data_hdf5 Goldenspike train data hdf5 Training Set None gschwend False A mock training set created using the example notebook goldenspike.ipynb available in RAIL's repository. Test upload of files in hdf5 format. 2023-03-29T19:12:59.746096Z
8 8_goldenspike_train_data_fits Goldenspike train data fits Training Set None gschwend False A mock training set created using the example notebook goldenspike.ipynb available in RAIL's repository. Test upload of files in fits format. 2023-03-29T19:09:12.958883Z
7 7_goldenspike_train_data_parquet Goldenspike train data parquet Training Set None gschwend False A mock training set created using the example notebook goldenspike.ipynb available in RAIL's repository. Test upload of files in parquet format. 2023-03-29T19:06:58.473920Z
6 6_simple_training_set Simple training set Training Set LSST DP0.2 gschwend False A simple example training set created based on the Jupyter notebook simple_pz_training_set.ipynb created by Melissa Graham, available in the repository delegate-contributions-dp02. The file contains coordinates, redshifts, magnitudes, and errors, as an illustration of a typical training set for photo-z algorithms. 2023-03-23T19:46:48.807872Z
1 1_simple_true_z_catalog Simple true z catalog Spec-z Catalog None gschwend False A simple example of a spectroscopic (true) redshifts catalog created based on the Jupyter notebook simple_pz_training_set.ipynb created by Melissa Graham, available in the repository delegate-contributions-dp02. The file contains only coordinates and redshifts, as an illustration of a typical spec-z catalog. 2023-03-23T13:19:32.050795Z

The information about product type, users, and releases shown above can be used to filter the data products of interest for your search. For that, the method list_products receives as an argument a dictionary mapping the product’s attributes to their values.

pz_server.display_products_list(filters={"release": "LSST DP0.2",
                                 "product_type": "Training Set"})
id internal_name product_name product_type release uploaded_by official_product pz_code description created_at
179 179_singulani_test0015 singulani_test0015 Training Set LSST DP0.2 crisingulani False None None 2024-11-28T16:47:00.649595Z
178 178_singulani_test013 singulani_test013 Training Set LSST DP0.2 crisingulani False None None 2024-11-22T18:18:41.216437Z
174 174_singulani_test011 singulani_test011 Training Set LSST DP0.2 crisingulani False None None 2024-11-18T16:43:39.346911Z
155 155_tsm_test_dp02_object_vs_dp01_truth_random_sample TSM_Test_DP02_object_vs_DP01_truth_random_sample Training Set LSST DP0.2 luigilcsilva False None None 2024-10-17T13:57:29.579577Z
154 154_tsm_test_dp02_object_vs_dp01_truth_random_sample TSM_Test_DP02_object_vs_DP01_truth_random_sample Training Set LSST DP0.2 luigilcsilva False None None 2024-10-17T13:48:17.833884Z
153 153_tsm_test_dp02_object_vs_dp01_truth_random_sample TSM_Test_DP02_object_vs_DP01_truth_random_sample Training Set LSST DP0.2 luigilcsilva False None None 2024-10-17T13:39:00.003188Z
152 152_random_training_set random_training_set Training Set LSST DP0.2 gschwend False null Training set created with the Training Set Maker pipeline. Science validation yet to be done! 2024-10-16T00:14:33.426501Z
85 85_example example Training Set LSST DP0.2 gschwend False example 2024-07-22T02:21:58.128939Z
33 33_simple_pz_training_set Simple pz training set Training Set LSST DP0.2 GloriaFA False Simple training set produced by https://github.com/rubin-dp0/delegate-contributions-dp02/blob/main/photoz/Training_Set_Creation/simple_pz_training_set.ipynb, developed by Melissa Graham. 2024-02-28T07:00:41.119818Z
6 6_simple_training_set Simple training set Training Set LSST DP0.2 gschwend False A simple example training set created based on the Jupyter notebook simple_pz_training_set.ipynb created by Melissa Graham, available in the repository delegate-contributions-dp02. The file contains coordinates, redshifts, magnitudes, and errors, as an illustration of a typical training set for photo-z algorithms. 2023-03-23T19:46:48.807872Z

It also works if we type a string pattern that is part of the value. For instance, just “DP0” instead of “LSST DP0.2”:

pz_server.display_products_list(filters={"release": "DP0"})
id internal_name product_name product_type release uploaded_by official_product pz_code description created_at
182 182_example_tpz_training_results Example TPZ Training Results Training Results LSST DP0.2 gschwend False Example of RAIL inform (training) results using TPZ. 2024-12-10T17:08:20.025367Z
179 179_singulani_test0015 singulani_test0015 Training Set LSST DP0.2 crisingulani False None None 2024-11-28T16:47:00.649595Z
178 178_singulani_test013 singulani_test013 Training Set LSST DP0.2 crisingulani False None None 2024-11-22T18:18:41.216437Z
174 174_singulani_test011 singulani_test011 Training Set LSST DP0.2 crisingulani False None None 2024-11-18T16:43:39.346911Z
155 155_tsm_test_dp02_object_vs_dp01_truth_random_sample TSM_Test_DP02_object_vs_DP01_truth_random_sample Training Set LSST DP0.2 luigilcsilva False None None 2024-10-17T13:57:29.579577Z
154 154_tsm_test_dp02_object_vs_dp01_truth_random_sample TSM_Test_DP02_object_vs_DP01_truth_random_sample Training Set LSST DP0.2 luigilcsilva False None None 2024-10-17T13:48:17.833884Z
153 153_tsm_test_dp02_object_vs_dp01_truth_random_sample TSM_Test_DP02_object_vs_DP01_truth_random_sample Training Set LSST DP0.2 luigilcsilva False None None 2024-10-17T13:39:00.003188Z
152 152_random_training_set random_training_set Training Set LSST DP0.2 gschwend False null Training set created with the Training Set Maker pipeline. Science validation yet to be done! 2024-10-16T00:14:33.426501Z
87 87_None truth random Spec-z Catalog LSST DP0.2 gschwend False null random selection of objects from the DP0.1 truth catalog 2024-07-22T15:32:29.933332Z
86 86_None mock speczs Spec-z Catalog LSST DP0.2 gschwend False Spec-zs randomly selected (0.2 percent) from the dp01 truth catalog filtered by truth_type (only galaxies). 2024-07-22T15:23:52.709801Z
85 85_example example Training Set LSST DP0.2 gschwend False example 2024-07-22T02:21:58.128939Z
72 72_pzcompute_results_for_qa_validation PZ-Compute Results for QA Validation Validation Results LSST DP0.2 HeloisaMengisztki False This zip contains two files: validation_set.hdf5 with the data input to run estimate, contains the redshift values so that it can be used as the truth file. And the validation_set_output.hdf5 is the output after running estimate, with the computed photoz for fzboost algorithm. 2024-06-05T18:57:27.428106Z
42 42_3dhst_public_specz 3DHST Public spec-z Spec-z Catalog LSST DP0.2 HeloisaMengisztki False Sample containing the 3DHST spec-z data contained in the original file Public spec-z compilation. 2024-03-27T23:20:29.545013Z
33 33_simple_pz_training_set Simple pz training set Training Set LSST DP0.2 GloriaFA False Simple training set produced by https://github.com/rubin-dp0/delegate-contributions-dp02/blob/main/photoz/Training_Set_Creation/simple_pz_training_set.ipynb, developed by Melissa Graham. 2024-02-28T07:00:41.119818Z
10 10_goldenspike_bpz Goldenspike BPZ Validation Results LSST DP0.2 gschwend False BPZ Results of photoz validation using BPZ on a mock test set from the example notebook goldenspike.ipynb available in RAIL's repository. 2023-03-29T19:42:04.424990Z
6 6_simple_training_set Simple training set Training Set LSST DP0.2 gschwend False A simple example training set created based on the Jupyter notebook simple_pz_training_set.ipynb created by Melissa Graham, available in the repository delegate-contributions-dp02. The file contains coordinates, redshifts, magnitudes, and errors, as an illustration of a typical training set for photo-z algorithms. 2023-03-23T19:46:48.807872Z

It also allows the search for multiple strings by adding the suffix __or (two underscores + “or”) to the search key. For instance, to get spec-z catalogs and training sets in the same search (notice that filtering is not case-sensitive):

pz_server.display_products_list(filters={"product_type__or": ["Spec-z Catalog", "training set"]})
id internal_name product_name product_type release uploaded_by official_product pz_code description created_at
189 189_example_upload_via_lib example upload via lib Spec-z Catalog None gschwend False None None 2024-12-11T15:17:18.272001Z
188 188_example_upload_via_lib example upload via lib Spec-z Catalog None gschwend False None None 2024-12-11T14:36:24.417710Z
181 181_example_upload_via_lib example upload via lib Spec-z Catalog None gschwend False None None 2024-12-10T03:01:05.190194Z
180 180_example_upload_via_lib example upload via lib Spec-z Catalog None gschwend False None None 2024-12-03T17:20:32.975994Z
179 179_singulani_test0015 singulani_test0015 Training Set LSST DP0.2 crisingulani False None None 2024-11-28T16:47:00.649595Z
178 178_singulani_test013 singulani_test013 Training Set LSST DP0.2 crisingulani False None None 2024-11-22T18:18:41.216437Z
174 174_singulani_test011 singulani_test011 Training Set LSST DP0.2 crisingulani False None None 2024-11-18T16:43:39.346911Z
155 155_tsm_test_dp02_object_vs_dp01_truth_random_sample TSM_Test_DP02_object_vs_DP01_truth_random_sample Training Set LSST DP0.2 luigilcsilva False None None 2024-10-17T13:57:29.579577Z
154 154_tsm_test_dp02_object_vs_dp01_truth_random_sample TSM_Test_DP02_object_vs_DP01_truth_random_sample Training Set LSST DP0.2 luigilcsilva False None None 2024-10-17T13:48:17.833884Z
153 153_tsm_test_dp02_object_vs_dp01_truth_random_sample TSM_Test_DP02_object_vs_DP01_truth_random_sample Training Set LSST DP0.2 luigilcsilva False None None 2024-10-17T13:39:00.003188Z
152 152_random_training_set random_training_set Training Set LSST DP0.2 gschwend False null Training set created with the Training Set Maker pipeline. Science validation yet to be done! 2024-10-16T00:14:33.426501Z
148 148_desi_edr DESI EDR Spec-z Catalog None gschwend True Value Added Redshift Summary Catalog filtered to include only galaxies. See https://data.desi.lbl.gov/doc/releases/edr/vac/zcat/ for details. 2024-10-15T19:53:27.383084Z
129 129_random_truth_z random truth z Spec-z Catalog None gschwend False random selection of objects from the DP0.1 truth catalog 2024-09-12T22:05:55.720144Z
91 91_example_upload_via_lib example upload via lib Spec-z Catalog None gschwend False None None 2024-07-22T18:44:36.505561Z
87 87_None truth random Spec-z Catalog LSST DP0.2 gschwend False null random selection of objects from the DP0.1 truth catalog 2024-07-22T15:32:29.933332Z
86 86_None mock speczs Spec-z Catalog LSST DP0.2 gschwend False Spec-zs randomly selected (0.2 percent) from the dp01 truth catalog filtered by truth_type (only galaxies). 2024-07-22T15:23:52.709801Z
85 85_example example Training Set LSST DP0.2 gschwend False example 2024-07-22T02:21:58.128939Z
83 83_example_upload_via_lib example upload via lib Spec-z Catalog None luigilcsilva False None None 2024-07-12T18:57:01.015290Z
78 78_example_upload_via_lib example upload via lib Spec-z Catalog None gschwend False None None 2024-07-04T15:40:29.732156Z
75 75_upload_example_1 upload example 1 Spec-z Catalog None gschwend False None None 2024-06-17T19:36:50.416031Z
64 64_training_set_lsst_dp02 Training set LSST DP0.2 Training Set None andreiadourado False Simulated training set from DC2 TruthSummary table. Random data (random_data.hdf5): table with the true magnitudes used to create the simulated set. 2024-05-21T14:42:47.340619Z
63 63_specz_sample Spec-z sample LSST DP0.2 Spec-z Catalog None andreiadourado False Spec-z sample created from a random fraction of object Ids from Object Table. 2024-05-21T13:36:19.884481Z
52 52_2dflens_public_specz 2dFLenS Public spec-z Spec-z Catalog None saraviz False Sample containing the 2dFLenS spec-z data contained in the original file Public spec-z compilation 2024-04-08T14:21:46.577298Z
51 51_zcosmos_public_specz zCOSMOS Public spec-z Spec-z Catalog None saraviz False Sample containing the zCOSMOS spec-z data contained in the original file Public spec-z compilation 2024-04-07T23:06:40.185605Z
50 50_vipers_public_specz VIPERS Public spec-z Spec-z Catalog None saraviz False Sample containing the VIPERS spec-z data contained in the original file Public spec-z compilation 2024-04-07T23:05:10.825559Z
49 49_sdss_dr16_public_specz SDSS (DR16) Public spec-z Spec-z Catalog None saraviz False Sample containing the SDSS spec-z data contained in the original file Public spec-z compilation 2024-04-07T20:14:23.831347Z
48 48_saga_public_specz SAGA Public spec-z Spec-z Catalog None saraviz False Sample containing the SAGA spec-z data contained in the original file Public spec-z compilation 2024-04-07T19:39:01.003263Z
47 47_glass_public_specz GLASS Public spec-z Spec-z Catalog None saraviz False Sample containing the GLASS spec-z data contained in the original file Public spec-z compilation. 2024-04-07T19:20:41.913016Z
45 45_gama_public_specz GAMA Public spec-z Spec-z Catalog None saraviz False Sample containing the GAMA spec-z data contained in the original file Public spec-z compilation 2024-04-03T10:19:00.379907Z
44 44_deep2_public_specz DEEP2 Public spec-z Spec-z Catalog None saraviz False Sample containing the DEEP2 spec-z data contained in the original file Public spec-z compilation 2024-03-31T22:10:01.314578Z
42 42_3dhst_public_specz 3DHST Public spec-z Spec-z Catalog LSST DP0.2 HeloisaMengisztki False Sample containing the 3DHST spec-z data contained in the original file Public spec-z compilation. 2024-03-27T23:20:29.545013Z
41 41_deimos_10k_public_specz DEIMOS 10K Public spec-z Spec-z Catalog None luigilcsilva False Sample containing the DEIMOS 10K spec-z data contained in the original file Public spec-z compilation. 2024-03-27T19:29:59.552926Z
33 33_simple_pz_training_set Simple pz training set Training Set LSST DP0.2 GloriaFA False Simple training set produced by https://github.com/rubin-dp0/delegate-contributions-dp02/blob/main/photoz/Training_Set_Creation/simple_pz_training_set.ipynb, developed by Melissa Graham. 2024-02-28T07:00:41.119818Z
28 28_dc2_tiny_true_z_sample DC2 Tiny true z sample Spec-z Catalog None gschwend False A small sample with 16917 redshifts retrieved from RSP cloud. 2023-11-29T20:30:26.900286Z
27 27_public_training_set_des_dr2 Public Training Set DES DR2 Training Set None gschwend False Result of cross-matching the public spec-z compilation with DES DR2 coadd objects catalog. 2023-10-17T21:32:21.727199Z
26 26_public_specz_compilation Public spec-z compilation Spec-z Catalog None gschwend False A compilation of public spectroscopic redshift catalogs collected over the years of operation of the Dark Energy Survey (DES) and systematically grouped by a DES Science Portal tool to form the basis of a training set for photo-z algorithms based on machine learning. 2023-10-17T21:29:08.341090Z
14 14_gama_specz_subsample GAMA spec-z subsample Spec-z Catalog None gschwend False A small subsample of the GAMA DR3 spec-z catalog (Baldry et al. 2018) as an example of a typical spec-z catalog from the literature. 2023-03-29T20:02:45.223568Z
13 13_vvds_specz_subsample VVDS spec-z subsample Spec-z Catalog None gschwend False A small subsample of the VVDS spec-z catalog (Le Fèvre et al. 2004, Garilli et al. 2008) as an example of a typical spec-z catalog from the literature. 2023-03-29T19:50:27.593735Z
9 9_goldenspike_train_data_hdf5 Goldenspike train data hdf5 Training Set None gschwend False A mock training set created using the example notebook goldenspike.ipynb available in RAIL's repository. Test upload of files in hdf5 format. 2023-03-29T19:12:59.746096Z
8 8_goldenspike_train_data_fits Goldenspike train data fits Training Set None gschwend False A mock training set created using the example notebook goldenspike.ipynb available in RAIL's repository. Test upload of files in fits format. 2023-03-29T19:09:12.958883Z
7 7_goldenspike_train_data_parquet Goldenspike train data parquet Training Set None gschwend False A mock training set created using the example notebook goldenspike.ipynb available in RAIL's repository. Test upload of files in parquet format. 2023-03-29T19:06:58.473920Z
6 6_simple_training_set Simple training set Training Set LSST DP0.2 gschwend False A simple example training set created based on the Jupyter notebook simple_pz_training_set.ipynb created by Melissa Graham, available in the repository delegate-contributions-dp02. The file contains coordinates, redshifts, magnitudes, and errors, as an illustration of a typical training set for photo-z algorithms. 2023-03-23T19:46:48.807872Z
1 1_simple_true_z_catalog Simple true z catalog Spec-z Catalog None gschwend False A simple example of a spectroscopic (true) redshifts catalog created based on the Jupyter notebook simple_pz_training_set.ipynb created by Melissa Graham, available in the repository delegate-contributions-dp02. The file contains only coordinates and redshifts, as an illustration of a typical spec-z catalog. 2023-03-23T13:19:32.050795Z

To fetch the results of a search and attribute to a variable, just change the prefix display_ by get_, like this:

search_results = pz_server.get_products_list(filters={"product_type": "results"})
search_results
[{'id': 182,
  'release': 1,
  'release_name': 'LSST DP0.2',
  'product_type': 5,
  'product_type_name': 'Training Results',
  'uploaded_by': 'gschwend',
  'is_owner': True,
  'can_delete': True,
  'can_update': True,
  'internal_name': '182_example_tpz_training_results',
  'display_name': 'Example TPZ Training Results',
  'official_product': False,
  'pz_code': '',
  'description': 'Example of RAIL inform (training) results using TPZ.',
  'created_at': '2024-12-10T17:08:20.025367Z',
  'updated_at': '2024-12-10T17:08:42.097879Z',
  'status': 1},
 {'id': 73,
  'release': None,
  'release_name': None,
  'product_type': 3,
  'product_type_name': 'Validation Results',
  'uploaded_by': 'andreiadourado',
  'is_owner': False,
  'can_delete': True,
  'can_update': True,
  'internal_name': '73_tpz_results',
  'display_name': 'TPZ Results',
  'official_product': False,
  'pz_code': '',
  'description': 'Results of photoz validation using TPZ lite on simulated training set from DC2 TruthSummary table. Files: 03_run_tpz. html -> jupyter notebook (HTML version) with algorithm train; 04_metrics.html -> jupyter notebook (HTML version) with results analysis; model.pkl -> model generated in the "inform method"; output.hdf5  -> "estimate stage" results (PDFs).',
  'created_at': '2024-06-06T23:20:04.439030Z',
  'updated_at': '2024-06-13T16:25:49.052608Z',
  'status': 1},
 {'id': 72,
  'release': 1,
  'release_name': 'LSST DP0.2',
  'product_type': 3,
  'product_type_name': 'Validation Results',
  'uploaded_by': 'HeloisaMengisztki',
  'is_owner': False,
  'can_delete': True,
  'can_update': True,
  'internal_name': '72_pzcompute_results_for_qa_validation',
  'display_name': 'PZ-Compute Results for QA Validation',
  'official_product': False,
  'pz_code': '',
  'description': 'This zip contains two files: validation_set.hdf5 with the data input to run estimate, contains the redshift values so that it can be used as the truth file. And the validation_set_output.hdf5 is the output after running estimate, with the computed photoz for fzboost algorithm.',
  'created_at': '2024-06-05T18:57:27.428106Z',
  'updated_at': '2024-06-06T16:22:33.231383Z',
  'status': 1},
 {'id': 12,
  'release': None,
  'release_name': None,
  'product_type': 3,
  'product_type_name': 'Validation Results',
  'uploaded_by': 'gschwend',
  'is_owner': True,
  'can_delete': True,
  'can_update': True,
  'internal_name': '12_goldenspike_knn',
  'display_name': 'Goldenspike KNN',
  'official_product': False,
  'pz_code': 'KNN',
  'description': "Results of photoz validation using KNN on a mock test set from the example notebook goldenspike.ipynb available in RAIL's repository.",
  'created_at': '2023-03-29T19:49:35.652295Z',
  'updated_at': '2023-12-18T16:46:36.422893Z',
  'status': 1},
 {'id': 11,
  'release': None,
  'release_name': None,
  'product_type': 3,
  'product_type_name': 'Validation Results',
  'uploaded_by': 'gschwend',
  'is_owner': True,
  'can_delete': True,
  'can_update': True,
  'internal_name': '11_goldenspike_flexzboost',
  'display_name': 'Goldenspike FlexZBoost',
  'official_product': False,
  'pz_code': 'FlexZBoost',
  'description': "Results of photoz validation using FlexZBoost on a mock test set from the example notebook goldenspike.ipynb available in RAIL's repository.",
  'created_at': '2023-03-29T19:48:34.864629Z',
  'updated_at': '2023-12-18T16:46:36.422893Z',
  'status': 1},
 {'id': 10,
  'release': 1,
  'release_name': 'LSST DP0.2',
  'product_type': 3,
  'product_type_name': 'Validation Results',
  'uploaded_by': 'gschwend',
  'is_owner': True,
  'can_delete': True,
  'can_update': True,
  'internal_name': '10_goldenspike_bpz',
  'display_name': 'Goldenspike BPZ',
  'official_product': False,
  'pz_code': 'BPZ',
  'description': "Results of photoz validation using BPZ on a mock test set from the example notebook goldenspike.ipynb available in RAIL's repository.",
  'created_at': '2023-03-29T19:42:04.424990Z',
  'updated_at': '2023-12-18T16:46:36.422893Z',
  'status': 1}]

How to upload a data product to via Python API (alternative method)

As shown above, the default method to upload a data product to the PZ Server is the upload tool on the PZ Server website. Alternatively, the pzserver Python library can send data products to the host service.

First, prepare a dictionary with the relevant information about your data product:

data_to_upload = {
    "name":"example upload via lib",
    "product_type": "specz_catalog",  # Product type
    "release": None, # LSST release, use None if not LSST data
    "main_file": "example.csv", # full path
    "auxiliary_files": ["example.html", "example.ipynb"] # full path
}
upload = pz_server.upload(**data_to_upload)
upload.product_id
190

How to display the metadata of a data product

The metadata of a given data product is the information the user provides on the upload form. This information is attached to the data product contents and is available for consulting on the PZ Server page or using this Python API (pzserver).

All data products stored on PZ Server are identified by a unique id number or a unique name, a string called internal_name, which is created automatically at the moment of the upload by concatenating the product id to the name given by its owner (replacing blank spaces by “_“, lowering cases, and removing special characters).

The PzServer’s method get_product_metadata() returns a dictionary with the attibutes stored in the PZ Server about a given data product identified by its id or internal_name. For use in a Jupyter notebook, the equivalent display_product_metadata() shows the results in a formated table.

# pz_server.display_product_metadata(<id (int or str) or internal_name (str)>)
# pz_server.display_product_metadata(6)
# pz_server.display_product_metadata("6")
pz_server.display_product_metadata("6_simple_training_set")
key value
id 6
release LSST DP0.2
product_type Training Set
uploaded_by gschwend
internal_name 6_simple_training_set
product_name Simple training set
official_product False
pz_code
description A simple example training set created based on the Jupyter notebook simple_pz_training_set.ipynb created by Melissa Graham, available in the repository delegate-contributions-dp02. The file contains coordinates, redshifts, magnitudes, and errors, as an illustration of a typical training set for photo-z algorithms.
created_at 2023-03-23T19:46:48.807872Z
main_file simple_pz_training_set.csv

back to the top

How to download data products as .zip files

To download any data product stored in the PZ Server, use the PzServer’s method download_product informing the product’s internal_name and the path to where it will be saved (the default is the current folder). This method downloads a compressed .zip file, which contains all the files uploaded by the user, including data, ancillary files, and description files. The time spent downloading a data product depends on the internet connection between the user and the host. Let’s try it with a small data product.

pz_server.download_product(14, save_in=".")
Connecting to PZ Server...
File saved as: ./14_gama_specz_subsample_43b93.zip
Done!

back to the top

How to share data products with other RSP users

All data products uploaded to the PZ Server are immediately available and visible to all PZ Server users (people with RSP credentials) through the PZ Server website or via the API. One way to share a data product is by providing the product’s URL, which leads to the product’s download page. The URL is composed by the PZ Server website address + /products/ + internal_name:

https://pz-server.linea.org.br/product/ + internal_name

or, if still in the development phase,

https://pz-server-dev.linea.org.br/product/ + internal_name

For example:

https://pz-server-dev.linea.org.br/product/6_simple_training_set

WARNING: The URL works only with the complete internal name, not with just the id number.

back to the top

How to retrieve contents of data products (work on memory)

The pzserver library allows users to retrieve the contents of a given data product to work on memory using the method get_product(). This feature is available only for tabular data (product types: Spec-z Catalog and Training Set).

By default, the method get_product returns an object from a particular class, depending on the product’s type. The classes SpeczCatalog and TrainingSet are simple extensions of pandas.DataFrame (via class composition) with a couple of additional attributes and methods, such as the attribute metadata, and the method display_metadata(). Let’s see an example:

catalog = pz_server.get_product(8)
catalog
Connecting to PZ Server...
Done!
<pzserver.catalog.TrainingSet at 0x7f0a7b319dd0>
catalog.display_metadata()
key value
id 8
release None
product_type Training Set
uploaded_by gschwend
internal_name 8_goldenspike_train_data_fits
product_name Goldenspike train data fits
official_product False
pz_code
description A mock training set created using the example notebook goldenspike.ipynb available in RAIL's repository. Test upload of files in fits format.
created_at 2023-03-29T19:09:12.958883Z
main_file goldenspike_train_data.fits

The tabular data is allocated in the attribute data, a pandas.DataFrame.

catalog.data
redshift mag_u_lsst mag_err_u_lsst mag_g_lsst mag_err_g_lsst mag_r_lsst mag_err_r_lsst mag_i_lsst mag_err_i_lsst mag_z_lsst mag_err_z_lsst mag_y_lsst mag_err_y_lsst
0 0.769521 26.496852 0.288986 25.863170 0.056997 24.729555 0.020702 23.610683 0.012011 23.143518 0.013714 22.915156 0.024561
1 1.088857 26.258727 0.237964 25.509524 0.041668 24.469344 0.016648 23.532860 0.011344 22.546680 0.008992 22.070255 0.012282
2 1.333098 25.373855 0.112257 24.943293 0.025359 24.524998 0.017431 24.013649 0.016486 23.733274 0.022315 23.102123 0.028906
... ... ... ... ... ... ... ... ... ... ... ... ... ...
59 0.986374 26.050653 0.200164 25.641624 0.046837 25.161078 0.030090 24.460152 0.024047 23.977239 0.027567 23.831974 0.055121
60 0.474281 27.048056 0.444683 26.428211 0.093854 24.839984 0.022755 24.209226 0.019403 23.855082 0.024787 23.507456 0.041329
61 0.561923 24.680480 0.061182 23.958609 0.011430 22.900135 0.006346 22.143581 0.005820 21.867563 0.006465 21.612692 0.008967

62 rows × 13 columns

type(catalog.data)
pandas.core.frame.DataFrame

It preserves the useful methods from pandas.DataFrame, such as:

catalog.data.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 62 entries, 0 to 61
Data columns (total 13 columns):
 #   Column          Non-Null Count  Dtype
---  ------          --------------  -----
 0   redshift        62 non-null     float64
 1   mag_u_lsst      61 non-null     float64
 2   mag_err_u_lsst  61 non-null     float64
 3   mag_g_lsst      62 non-null     float64
 4   mag_err_g_lsst  62 non-null     float64
 5   mag_r_lsst      62 non-null     float64
 6   mag_err_r_lsst  62 non-null     float64
 7   mag_i_lsst      62 non-null     float64
 8   mag_err_i_lsst  62 non-null     float64
 9   mag_z_lsst      62 non-null     float64
 10  mag_err_z_lsst  62 non-null     float64
 11  mag_y_lsst      61 non-null     float64
 12  mag_err_y_lsst  61 non-null     float64
dtypes: float64(13)
memory usage: 6.4 KB
catalog.data.describe()
redshift mag_u_lsst mag_err_u_lsst mag_g_lsst mag_err_g_lsst mag_r_lsst mag_err_r_lsst mag_i_lsst mag_err_i_lsst mag_z_lsst mag_err_z_lsst mag_y_lsst mag_err_y_lsst
count 62.000000 61.000000 61.000000 62.000000 62.000000 62.000000 62.000000 62.000000 62.000000 62.000000 62.000000 61.000000 61.000000
mean 0.780298 25.446008 0.188050 24.820000 0.038182 24.003970 0.018770 23.384804 0.016165 23.074481 0.021478 22.932354 0.054682
std 0.355365 1.269277 0.193747 1.314112 0.036398 1.387358 0.013750 1.381587 0.010069 1.400673 0.014961 1.540284 0.115875
... ... ... ... ... ... ... ... ... ... ... ... ... ...
50% 0.764600 25.577029 0.133815 25.069970 0.028309 24.470215 0.016660 23.748506 0.013390 23.514185 0.018540 23.293384 0.034199
75% 0.948494 26.263284 0.238859 25.705486 0.049576 24.985225 0.025802 24.488654 0.024650 24.165944 0.032557 23.993010 0.063585
max 1.755764 28.482391 1.154073 27.296152 0.198195 26.036958 0.065360 24.949645 0.036932 24.693132 0.051883 27.342151 0.909230

8 rows × 13 columns

For those who prefer working with astropy.Table or pure pandas.DataFrame, the method get_product() gives the flexibility to choose the output format (fmt="pandas" or fmt="astropy").

dataframe = pz_server.get_product(8, fmt="pandas")
print(type(dataframe))
dataframe
Connecting to PZ Server...
<class 'pandas.core.frame.DataFrame'>
redshift mag_u_lsst mag_err_u_lsst mag_g_lsst mag_err_g_lsst mag_r_lsst mag_err_r_lsst mag_i_lsst mag_err_i_lsst mag_z_lsst mag_err_z_lsst mag_y_lsst mag_err_y_lsst
0 0.769521 26.496852 0.288986 25.863170 0.056997 24.729555 0.020702 23.610683 0.012011 23.143518 0.013714 22.915156 0.024561
1 1.088857 26.258727 0.237964 25.509524 0.041668 24.469344 0.016648 23.532860 0.011344 22.546680 0.008992 22.070255 0.012282
2 1.333098 25.373855 0.112257 24.943293 0.025359 24.524998 0.017431 24.013649 0.016486 23.733274 0.022315 23.102123 0.028906
... ... ... ... ... ... ... ... ... ... ... ... ... ...
59 0.986374 26.050653 0.200164 25.641624 0.046837 25.161078 0.030090 24.460152 0.024047 23.977239 0.027567 23.831974 0.055121
60 0.474281 27.048056 0.444683 26.428211 0.093854 24.839984 0.022755 24.209226 0.019403 23.855082 0.024787 23.507456 0.041329
61 0.561923 24.680480 0.061182 23.958609 0.011430 22.900135 0.006346 22.143581 0.005820 21.867563 0.006465 21.612692 0.008967

62 rows × 13 columns

table = pz_server.get_product(8, fmt="astropy")
print(type(table))
table
Connecting to PZ Server...
<class 'astropy.table.table.Table'>
Table length=62
redshiftmag_u_lsstmag_err_u_lsstmag_g_lsstmag_err_g_lsstmag_r_lsstmag_err_r_lsstmag_i_lsstmag_err_i_lsstmag_z_lsstmag_err_z_lsstmag_y_lsstmag_err_y_lsst
float64float64float64float64float64float64float64float64float64float64float64float64float64
0.769521057605743426.496851733359980.2889864016451496625.8631701801485930.056996849251325224.729555232665350.02070246989947576223.6106832612475230.01201139145700786723.143517979331420.01371427288818984422.9151560685081040.02456124411372624
1.088857054710388226.258726903647150.2379635474665983725.509524228603690.04166792240955244424.469344487165970.01664762131418696323.5328599838842970.01134372952245139122.5466795031786620.00899216749772303922.0702554732436660.01228199507795122
1.333097815513610825.3738551394507040.1122566959777225624.943293290995960.02535893280119127424.524997784555430.0174305351556827724.013648955119970.01648631007044298223.733274349215570.02231531417162041523.1021233624494760.028905678864388565
0.72126543521881125.994096311189090.190882668154784625.617772381977740.04585803883130551425.0057857477996420.02626806353391610424.3712855019873050.02227392052069140624.2216706781082040.03416701480043831524.0658108028302560.06782119456710035
0.508699238300323523.455644928497680.02118364967662736422.1549834614831620.00545619765168589620.8542210729006750.00505430534507590620.251517785749910.00504324008960251219.9879329924582550.00507670072076654719.75317944869660.00522219293990742
1.65459752082824725.5770293127979930.133814541165693825.3571902346599920.03642206846621718524.9853640973173760.02580530557653081724.6198659479305140.02762942851550346424.315427059847160.0371171910364455923.993010472490680.06358486650868432
0.630211710929870626.294569730983540.2450898080861663425.6619607423793780.0476886775022480124.9703507885164240.02547068619454275624.443595409788620.02370506584090058324.382525689614610.0393880559359265524.274314551454060.08154556925795062
0.944600462913513223.044391449579790.0152005556449064822.8598270289764150.00635841610055997822.3920310802753240.00559849714596083821.7631717128332550.00544387100243714921.3156064883045420.00561125690062150221.0788536978553220.006819135385098381
0.78505992889404326.103505068889410.2092094615519172225.6405705624662370.04679350252717620625.2245729107701920.03181687681782085424.5707148149561050.02646946352912577724.442766763258990.04154746484476924.363597198979420.08821825914170406
.......................................
1.346864342689514225.7990566691117140.1618358280018550325.1727477988701940.03096962874499195324.731768967630090.02074152874695367524.245889724632090.02001374539849744623.873261845298210.02518113625053323623.3017518833514930.034452507469982616
0.949792087078094523.698825570527960.02600386075499280523.420784681996990.00811079505924310722.7108851424223380.00599830947764476621.8968588151091620.00555089139182906321.273081732643840.00557091556571719321.0407246844617970.006716225485067447
0.740395247936248825.4430204282417660.1191933891565676324.9608997858341370.02574836484474985624.377556409002050.01544710496912196823.649963692291250.01237012405335630323.5513875922433830.0191178956640090623.4470210254503750.03917395554632945
0.909494757652282723.475399963653020.02153524007063957823.3424579781672250.007781748463140330622.7617712265424430.006082322317851221.9445992106821280.005595036341919999521.4451333732897640.00575226659995192721.2300351919156720.007284651334311665
0.973186552524566724.9153227926672470.0752057326533048224.4606451278066070.01686522837711815623.6600061666947960.00914992597156648822.8933591885015770.0076167823067076922.410792868885050.0082969741205060127.342150888785180.9092302567884765
0.609932243824005124.60127263188670.0570645984782256723.093594024040720.00693258721546263621.696081313083990.00519564520756141520.695570374958980.00508274447208671120.387208468976390.00514013802410804720.127856340119390.00540364900110484
0.9768770933151245----26.846220736674640.1350618516521750725.70928911942380.0488676683278345724.8665762050749420.0343179145306803724.0488701229033670.02934960146430494823.784055887582750.052825335046252773
0.986374497413635326.0506532837846230.2001642698007547225.6416240096463350.0468371901521604125.1610781812188340.03008953675706706224.4601524141291370.02404672900351872323.9772390036210.02756678105109978323.8319736186345280.05512066706093889
0.474280714988708527.0480560874079860.444682506357735426.4282112805191750.0938543394596348124.839983603182140.0227549353128951224.20922601749360.0194026127508123923.8550822431599340.0247873017109994123.5074559295742880.041328512368478044
0.561922669410705624.6804795305431630.06118153192966563323.9586089979737020.0114295663681752622.9001349679331020.00634586977358199822.1435806332706240.00581963097081042821.8675628493294060.00646548086334226921.612691594536260.008966510628950788

Next, let’s explore specific features for each product type…

Spec-z Catalogs

In the context of the PZ Server, Spec-z Catalogs are defined as any catalog containing spherical equatorial coordinates and spectroscopic redshift measurements (or, analogously, true redshifts from simulations). A Spec-z Catalog can include data from a single spectroscopic survey or a combination of data from several sources. To be considered a single Spec-z Catalog, the data should be provided as a single file to PZ Server’s upload tool. For multi-survey catalogs, adding the survey name or identification as an extra column is recommended.

Mandatory columns: * Right ascension [degrees] - float * Declination [degrees] - float * Spectroscopic or true redshift - float

Recommended columns: * Spectroscopic redshift error - float * Quality flag - integer, float, or string * Survey name (recommended for compilations of data from different surveys)

Let’s see an example of Spec-z Catalog:

gama = pz_server.get_product(14)
Connecting to PZ Server...
Done!
gama.display_metadata()
key value
id 14
release None
product_type Spec-z Catalog
uploaded_by gschwend
internal_name 14_gama_specz_subsample
product_name GAMA spec-z subsample
official_product False
pz_code
description A small subsample of the GAMA DR3 spec-z catalog (Baldry et al. 2018) as an example of a typical spec-z catalog from the literature.
created_at 2023-03-29T20:02:45.223568Z
main_file specz_subsample_gama_example.csv

The attribute data, which is a DataFrame preserves the plot method from Pandas.

Display basic statistics

gama.data.describe()
ID RA DEC Z ERR_Z FLAG_DES
count 2.576000e+03 2576.000000 2576.000000 2576.000000 2576.0 2576.000000
mean 1.105526e+06 154.526343 -1.101865 0.224811 99.0 3.949534
std 4.006668e+04 70.783868 2.995036 0.102571 0.0 0.218947
... ... ... ... ... ... ...
50% 1.103558e+06 180.140145 -0.480830 0.217804 99.0 4.000000
75% 1.140619e+06 215.836583 1.170363 0.291810 99.0 4.000000
max 1.176440e+06 223.497080 2.998180 0.728717 99.0 4.000000

8 rows × 6 columns

gama.data.plot(x="RA", y="DEC", kind="scatter")
<Axes: xlabel='RA', ylabel='DEC'>
../../_images/output_70_1.png
gama.data.hist('Z')
array([[<Axes: title={'center': 'Z'}>]], dtype=object)
../../_images/output_71_1.png

Training Sets

In the context of the PZ Server, Training Sets are defined as the product of matching (spatially) a given Spec-z Catalog (single survey or compilation) to the photometric data, in this case, the LSST Objects Catalog. The PZ Server API offers a Training Set Maker tool that allows users to build customized Training Sets based on the available Spec-z Catalogs (details below).

Note 1: Training sets are commonly split into two or more subsets for photo-z validation purposes. If the Training Set owner has previously defined which objects should belong to each subset (training and validation/test sets), this information must be available as an extra column in the table or as clear instructions for reproducing the subset separation in the data product description.

Note 2: The PZ Server only supports catalog-level Training Sets. Image-based Training Sets, e.g., for deep-learning algorithms, are not supported yet.

Mandatory column: * Spectroscopic (or true) redshift - float

Other expected columns * Object ID from LSST Objects Catalog - integer * Observables: magnitudes (and/or colors, or fluxes) from LSST Objects Catalog - float * Observable errors: magnitude errors (and/or color errors, or flux errors) from LSST Objects Catalog - float * Right ascension [degrees] - float * Declination [degrees] - float * Quality Flag - integer, float, or string * Subset Flag - integer, float, or string

For example:

train_goldenspike = pz_server.get_product(9)
Connecting to PZ Server...
Done!
train_goldenspike.display_metadata()
key value
id 9
release None
product_type Training Set
uploaded_by gschwend
internal_name 9_goldenspike_train_data_hdf5
product_name Goldenspike train data hdf5
official_product False
pz_code
description A mock training set created using the example notebook goldenspike.ipynb available in RAIL's repository. Test upload of files in hdf5 format.
created_at 2023-03-29T19:12:59.746096Z
main_file goldenspike_train_data.hdf5

Display basic statistics

train_goldenspike.data.describe()
mag_err_g_lsst mag_err_i_lsst mag_err_r_lsst mag_err_u_lsst mag_err_y_lsst mag_err_z_lsst mag_g_lsst mag_i_lsst mag_r_lsst mag_u_lsst mag_y_lsst mag_z_lsst redshift
count 62.000000 62.000000 62.000000 61.000000 61.000000 62.000000 62.000000 62.000000 62.000000 61.000000 61.000000 62.000000 62.000000
mean 0.038182 0.016165 0.018770 0.188050 0.054682 0.021478 24.820000 23.384804 24.003970 25.446008 22.932354 23.074481 0.780298
std 0.036398 0.010069 0.013750 0.193747 0.115875 0.014961 1.314112 1.381587 1.387358 1.269277 1.540284 1.400673 0.355365
... ... ... ... ... ... ... ... ... ... ... ... ... ...
50% 0.028309 0.013390 0.016660 0.133815 0.034199 0.018540 25.069970 23.748506 24.470215 25.577029 23.293384 23.514185 0.764600
75% 0.049576 0.024650 0.025802 0.238859 0.063585 0.032557 25.705486 24.488654 24.985225 26.263284 23.993010 24.165944 0.948494
max 0.198195 0.036932 0.065360 1.154073 0.909230 0.051883 27.296152 24.949645 26.036958 28.482391 27.342151 24.693132 1.755764

8 rows × 13 columns

train_goldenspike.data.hist('redshift', bins=20)
array([[<Axes: title={'center': 'redshift'}>]], dtype=object)
../../_images/output_78_1.png
train_goldenspike.data.hist('mag_i_lsst', bins=20)
array([[<Axes: title={'center': 'mag_i_lsst'}>]], dtype=object)
../../_images/output_79_1.png

Training and Validation Results

The results of training or validating PZ algorithms can not be loaded into memory directly but can be downloaded to the local work directory.

pz_server.download_product("182_example_tpz_training_results", save_in=".")
Connecting to PZ Server...
File saved as: ./182_example_tpz_training_results_fd535.zip
Done!

PZ Server Pipelines (under development)

Spec-z Catalogs and Training Sets can be created using the cross-matching pipelines available on the PZ Server. Any catalog built by the pipeline is automatically registered as a regular user-generated data product and is the same as the uploaded ones.


User feedback

Is something important missing? Click here to open an issue in the PZ Server library repository on GitHub.