pzserver 0.2.5__tar.gz → 0.2.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pzserver-0.2.5 → pzserver-0.2.7}/.github/workflows/build-documentation.yml +1 -1
- {pzserver-0.2.5 → pzserver-0.2.7}/.github/workflows/linting.yml +3 -4
- {pzserver-0.2.5 → pzserver-0.2.7}/.pre-commit-config.yaml +2 -2
- {pzserver-0.2.5 → pzserver-0.2.7}/PKG-INFO +1 -1
- pzserver-0.2.7/docs/nbs.rst +6 -0
- pzserver-0.2.5/docs/notebooks/0_introduction.ipynb → pzserver-0.2.7/docs/notebooks/pzserver_tutorial.ipynb +284 -57
- pzserver-0.2.7/docs/notebooks/rst/output_70_1.png +0 -0
- pzserver-0.2.7/docs/notebooks/rst/output_71_1.png +0 -0
- pzserver-0.2.7/docs/notebooks/rst/output_78_1.png +0 -0
- pzserver-0.2.7/docs/notebooks/rst/output_79_1.png +0 -0
- pzserver-0.2.7/docs/notebooks/rst/pzserver_tutorial.rst +3522 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/src/.pylintrc +1 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/src/pzserver/_version.py +2 -2
- {pzserver-0.2.5 → pzserver-0.2.7}/src/pzserver/communicate.py +11 -5
- {pzserver-0.2.5 → pzserver-0.2.7}/src/pzserver/core.py +25 -8
- {pzserver-0.2.5 → pzserver-0.2.7}/src/pzserver/process.py +17 -9
- {pzserver-0.2.5 → pzserver-0.2.7}/src/pzserver.egg-info/PKG-INFO +1 -1
- {pzserver-0.2.5 → pzserver-0.2.7}/src/pzserver.egg-info/SOURCES.txt +8 -11
- pzserver-0.2.5/docs/nbs.rst +0 -8
- pzserver-0.2.5/docs/notebooks/1_specz_catalogs.ipynb +0 -258
- pzserver-0.2.5/docs/notebooks/2_training_sets.ipynb +0 -238
- pzserver-0.2.5/docs/notebooks/rst/0_introduction.rst +0 -432
- pzserver-0.2.5/docs/notebooks/rst/1_specz_catalogs.rst +0 -350
- pzserver-0.2.5/docs/notebooks/rst/2_training_sets.rst +0 -397
- pzserver-0.2.5/docs/notebooks/rst/output_18_0.png +0 -0
- pzserver-0.2.5/docs/notebooks/rst/output_20_0.png +0 -0
- pzserver-0.2.5/docs/notebooks/rst/output_22_1.png +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/.copier-answers.yml +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/.devcontainer/Dockerfile +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/.devcontainer/devcontainer.json +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/.devcontainer/docker-compose.yml +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/.github/workflows/publish-to-pypi.yml +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/.github/workflows/smoke-test.yml +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/.github/workflows/testing-and-coverage.yml +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/.gitignore +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/.readthedocs.yml +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/LICENSE +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/README.md +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/__init__.py +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/docs/Makefile +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/docs/conf.py +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/docs/index.rst +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/docs/installation.rst +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/docs/make.bat +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/docs/notebooks/example.csv +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/docs/notebooks/example.html +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/docs/notebooks/example.ipynb +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/docs/notebooks/images/ScreenShotTokenGenerator.png +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/docs/notebooks/images/ScreenShotTokenMenu.png +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/docs/notebooks/images/ScreenshotProductListButtons.png +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/docs/notebooks/images/linea.png +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/docs/notebooks/images/linea_darkblue.png +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/docs/notebooks/images/rubin.png +0 -0
- {pzserver-0.2.5/docs/notebooks → pzserver-0.2.7/docs/notebooks/qa_notebooks}/public-specz-compilation.ipynb +0 -0
- {pzserver-0.2.5/docs/notebooks → pzserver-0.2.7/docs/notebooks/qa_notebooks}/public-training-set-des-dr2.ipynb +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/pyproject.toml +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/requirements-dev.txt +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/requirements.txt +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/setup.cfg +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/src/pzserver/__init__.py +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/src/pzserver/catalog.py +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/src/pzserver/pipeline.py +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/src/pzserver/upload.py +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/src/pzserver.egg-info/dependency_links.txt +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/src/pzserver.egg-info/requires.txt +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/src/pzserver.egg-info/top_level.txt +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/tests/.pylintrc +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/tests/pzserver/conftest.py +0 -0
- {pzserver-0.2.5 → pzserver-0.2.7}/tests/pzserver/test_catalog.py +0 -0
|
@@ -30,7 +30,7 @@ jobs:
|
|
|
30
30
|
sudo apt-get install pandoc
|
|
31
31
|
- name: Build docs
|
|
32
32
|
run: |
|
|
33
|
-
sphinx-build -T -E -b html -d docs/build/doctrees ./docs docs/build/html -D exclude_patterns="notebooks
|
|
33
|
+
sphinx-build -T -E -b html -d docs/build/doctrees ./docs docs/build/html -D exclude_patterns="notebooks/*/*.ipynb"
|
|
34
34
|
- name: Run ghp-import
|
|
35
35
|
run: |
|
|
36
36
|
ghp-import -n -p -f -x docs/ docs/build/html
|
|
@@ -31,8 +31,7 @@ jobs:
|
|
|
31
31
|
pip install .[dev]
|
|
32
32
|
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
33
33
|
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
|
|
34
|
-
- name: Analyze code with linter
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
pylint -rn -sn --recursive=y ./src --rcfile=./src/.pylintrc
|
|
34
|
+
# - name: Analyze code with linter
|
|
35
|
+
# run: |
|
|
36
|
+
# pylint -rn -sn --recursive=y ./src --rcfile=./src/.pylintrc
|
|
38
37
|
|
|
@@ -123,5 +123,5 @@ repos:
|
|
|
123
123
|
"-d", # Flag for cached environment and doctrees
|
|
124
124
|
"./docs/build/doctrees", # Directory
|
|
125
125
|
"-D", # Flag to override settings in conf.py
|
|
126
|
-
"exclude_patterns=notebooks
|
|
127
|
-
]
|
|
126
|
+
"exclude_patterns=notebooks/*/*.ipynb", # Exclude our notebooks from pre-commit
|
|
127
|
+
]
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"<img align=\"left\" src = \"images/rubin.png\" width=180 style=\"padding: 30px\"> \n",
|
|
9
9
|
"\n",
|
|
10
10
|
"# Photo-z Server\n",
|
|
11
|
-
"## Tutorial Notebook
|
|
11
|
+
"## Tutorial Notebook\n",
|
|
12
12
|
"\n"
|
|
13
13
|
]
|
|
14
14
|
},
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"source": [
|
|
19
19
|
"Contact author: [Julia Gschwend](mailto:julia@linea.org.br)\n",
|
|
20
20
|
"\n",
|
|
21
|
-
"Last verified run: **2024-
|
|
21
|
+
"Last verified run: **2024-Dec-11**"
|
|
22
22
|
]
|
|
23
23
|
},
|
|
24
24
|
{
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"tags": []
|
|
41
41
|
},
|
|
42
42
|
"source": [
|
|
43
|
-
"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](https://pz-server.linea.org.br/) (during the development phase, a test environment is available at [pz-server-dev.linea.org.br](https://pz-server-dev.linea.org.br/)). There, you will find two
|
|
43
|
+
"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](https://pz-server.linea.org.br/) (during the development phase, a test environment is available at [pz-server-dev.linea.org.br](https://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.**\n",
|
|
44
44
|
"\n",
|
|
45
45
|
"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)](https://data.lsst.cloud/). However, user authorization requires the same credentials as RSP. For comprehensive documentation about the PZ Server, please visit the [PZ Server's documentation page](https://linea-it.github.io/pz-lsst-inkind-doc/). 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](https://linea-it.github.io/pzserver). "
|
|
46
46
|
]
|
|
@@ -51,14 +51,7 @@
|
|
|
51
51
|
"source": [
|
|
52
52
|
"### How to upload a data product on the PZ Server website\n",
|
|
53
53
|
"\n",
|
|
54
|
-
"To upload a data product, click
|
|
55
|
-
"\n",
|
|
56
|
-
"The photo-z-related products are organized into four categories (product types):\n",
|
|
57
|
-
"\n",
|
|
58
|
-
"- **Spec-z Catalog:** Catalog of spectroscopic redshifts and positions (usually equatorial coordinates).\n",
|
|
59
|
-
"- **Training Set:** Sample for training photo-z algorithms (tabular data). It usually contains magnitudes, errors, and true redshifts.\n",
|
|
60
|
-
"- **Photo-z Validation Results:** The Results of a photo-z validation procedure (free format). They usually contain photo-z estimates (single estimates and/or PDFs) of a validation set, photo-z validation metrics, validation plots, etc.\n",
|
|
61
|
-
"- **Photo-z Table**: This category is for the results of a photo-z estimation procedure. Ideally, the data should be in the same format as the photo-z tables delivered by the DM as part of the LSST data releases. If the data is larger than the file upload limit (200MB), the product entry will store only the metadata, and instructions on accessing the data should be provided in the description field. Storage space can be provided exceptionally for larger tables, depending on the science project justification (to be evaluated by IDAC's management committee). "
|
|
54
|
+
"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). "
|
|
62
55
|
]
|
|
63
56
|
},
|
|
64
57
|
{
|
|
@@ -92,22 +85,24 @@
|
|
|
92
85
|
"source": [
|
|
93
86
|
"### Installation\n",
|
|
94
87
|
"\n",
|
|
95
|
-
"**
|
|
96
|
-
"\n",
|
|
97
|
-
"The PZ Server API is avalialble on **pip** as `pzserver`. To install the API and its dependencies, type, on the Terminal: \n",
|
|
88
|
+
"The PZ Server API is avalialble on **pip** as `pzserver`. To install the API and its dependencies, type on the Terminal: \n",
|
|
98
89
|
"\n",
|
|
99
90
|
"```\n",
|
|
100
91
|
"$ pip install pzserver \n",
|
|
101
|
-
"
|
|
92
|
+
"```\n",
|
|
93
|
+
"\n",
|
|
94
|
+
"Or in a notebook code cell: "
|
|
102
95
|
]
|
|
103
96
|
},
|
|
104
97
|
{
|
|
105
98
|
"cell_type": "code",
|
|
106
99
|
"execution_count": null,
|
|
107
|
-
"metadata": {
|
|
100
|
+
"metadata": {
|
|
101
|
+
"scrolled": true
|
|
102
|
+
},
|
|
108
103
|
"outputs": [],
|
|
109
104
|
"source": [
|
|
110
|
-
"
|
|
105
|
+
"#! pip install pzserver"
|
|
111
106
|
]
|
|
112
107
|
},
|
|
113
108
|
{
|
|
@@ -116,22 +111,8 @@
|
|
|
116
111
|
"jp-MarkdownHeadingCollapsed": true
|
|
117
112
|
},
|
|
118
113
|
"source": [
|
|
119
|
-
"**For developers** \n",
|
|
120
|
-
"\n",
|
|
121
|
-
"Alternatively, if you have cloned the repository with:\n",
|
|
122
|
-
"\n",
|
|
123
|
-
"```\n",
|
|
124
|
-
"$ git clone https://github.com/linea-it/pzserver.git \n",
|
|
125
|
-
"``` \n",
|
|
126
|
-
"\n",
|
|
127
|
-
"To install the API and its dependencies, type:\n",
|
|
128
|
-
"\n",
|
|
129
|
-
"```\n",
|
|
130
|
-
"$ pip install .[dev]\n",
|
|
131
|
-
"```\n",
|
|
132
|
-
"\n",
|
|
133
114
|
"--- \n",
|
|
134
|
-
"OBS:
|
|
115
|
+
"OBS: Depending on your Jupyter Lab version, you might need to restart the kernel to incorporate the new library. "
|
|
135
116
|
]
|
|
136
117
|
},
|
|
137
118
|
{
|
|
@@ -182,7 +163,7 @@
|
|
|
182
163
|
"cell_type": "markdown",
|
|
183
164
|
"metadata": {},
|
|
184
165
|
"source": [
|
|
185
|
-
"For convenience, the token can be saved
|
|
166
|
+
"For convenience, the token can be saved as `token.txt` (which is already listed in the .gitignore file in this repository). "
|
|
186
167
|
]
|
|
187
168
|
},
|
|
188
169
|
{
|
|
@@ -207,7 +188,7 @@
|
|
|
207
188
|
"cell_type": "markdown",
|
|
208
189
|
"metadata": {},
|
|
209
190
|
"source": [
|
|
210
|
-
"The object `pz_server`
|
|
191
|
+
"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](https://linea-it.github.io/pzserver/html/index.html)). Alternatively, those with the prefix `display_` show the results as a styled [_Pandas DataFrames_](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html), optimized for Jupyter Notebook (note: column names might change in the display version). For instance:\n",
|
|
211
192
|
"\n",
|
|
212
193
|
"Display the list of product types supported with a short description;"
|
|
213
194
|
]
|
|
@@ -231,7 +212,9 @@
|
|
|
231
212
|
{
|
|
232
213
|
"cell_type": "code",
|
|
233
214
|
"execution_count": null,
|
|
234
|
-
"metadata": {
|
|
215
|
+
"metadata": {
|
|
216
|
+
"scrolled": true
|
|
217
|
+
},
|
|
235
218
|
"outputs": [],
|
|
236
219
|
"source": [
|
|
237
220
|
"pz_server.display_users()"
|
|
@@ -259,13 +242,14 @@
|
|
|
259
242
|
"source": [
|
|
260
243
|
"---\n",
|
|
261
244
|
"\n",
|
|
262
|
-
"Display all data products
|
|
245
|
+
"Display all available data products (WARNING: This list can rapidly grow during the survey's operation). "
|
|
263
246
|
]
|
|
264
247
|
},
|
|
265
248
|
{
|
|
266
249
|
"cell_type": "code",
|
|
267
250
|
"execution_count": null,
|
|
268
251
|
"metadata": {
|
|
252
|
+
"scrolled": true,
|
|
269
253
|
"tags": []
|
|
270
254
|
},
|
|
271
255
|
"outputs": [],
|
|
@@ -277,16 +261,18 @@
|
|
|
277
261
|
"cell_type": "markdown",
|
|
278
262
|
"metadata": {},
|
|
279
263
|
"source": [
|
|
280
|
-
"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 argument a dictionary mapping the
|
|
264
|
+
"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. "
|
|
281
265
|
]
|
|
282
266
|
},
|
|
283
267
|
{
|
|
284
268
|
"cell_type": "code",
|
|
285
269
|
"execution_count": null,
|
|
286
|
-
"metadata": {
|
|
270
|
+
"metadata": {
|
|
271
|
+
"scrolled": true
|
|
272
|
+
},
|
|
287
273
|
"outputs": [],
|
|
288
274
|
"source": [
|
|
289
|
-
"pz_server.display_products_list(filters={\"release\": \"LSST DP0\", \n",
|
|
275
|
+
"pz_server.display_products_list(filters={\"release\": \"LSST DP0.2\", \n",
|
|
290
276
|
" \"product_type\": \"Training Set\"})"
|
|
291
277
|
]
|
|
292
278
|
},
|
|
@@ -294,13 +280,15 @@
|
|
|
294
280
|
"cell_type": "markdown",
|
|
295
281
|
"metadata": {},
|
|
296
282
|
"source": [
|
|
297
|
-
"It also works if we type a string pattern that is part of the value. For instance, just \"DP0\" instead of \"LSST DP0\": "
|
|
283
|
+
"It also works if we type a string pattern that is part of the value. For instance, just \"DP0\" instead of \"LSST DP0.2\": "
|
|
298
284
|
]
|
|
299
285
|
},
|
|
300
286
|
{
|
|
301
287
|
"cell_type": "code",
|
|
302
288
|
"execution_count": null,
|
|
303
|
-
"metadata": {
|
|
289
|
+
"metadata": {
|
|
290
|
+
"scrolled": true
|
|
291
|
+
},
|
|
304
292
|
"outputs": [],
|
|
305
293
|
"source": [
|
|
306
294
|
"pz_server.display_products_list(filters={\"release\": \"DP0\"})"
|
|
@@ -310,13 +298,14 @@
|
|
|
310
298
|
"cell_type": "markdown",
|
|
311
299
|
"metadata": {},
|
|
312
300
|
"source": [
|
|
313
|
-
"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
|
|
301
|
+
"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):"
|
|
314
302
|
]
|
|
315
303
|
},
|
|
316
304
|
{
|
|
317
305
|
"cell_type": "code",
|
|
318
306
|
"execution_count": null,
|
|
319
307
|
"metadata": {
|
|
308
|
+
"scrolled": true,
|
|
320
309
|
"tags": []
|
|
321
310
|
},
|
|
322
311
|
"outputs": [],
|
|
@@ -328,18 +317,19 @@
|
|
|
328
317
|
"cell_type": "markdown",
|
|
329
318
|
"metadata": {},
|
|
330
319
|
"source": [
|
|
331
|
-
"To fetch the results of a search and attribute to a variable, just change the
|
|
320
|
+
"To fetch the results of a search and attribute to a variable, just change the prefix `display_` by `get_`, like this: "
|
|
332
321
|
]
|
|
333
322
|
},
|
|
334
323
|
{
|
|
335
324
|
"cell_type": "code",
|
|
336
325
|
"execution_count": null,
|
|
337
326
|
"metadata": {
|
|
327
|
+
"scrolled": true,
|
|
338
328
|
"tags": []
|
|
339
329
|
},
|
|
340
330
|
"outputs": [],
|
|
341
331
|
"source": [
|
|
342
|
-
"search_results = pz_server.get_products_list(filters={\"product_type\": \"results\"})
|
|
332
|
+
"search_results = pz_server.get_products_list(filters={\"product_type\": \"results\"}) \n",
|
|
343
333
|
"search_results"
|
|
344
334
|
]
|
|
345
335
|
},
|
|
@@ -354,7 +344,7 @@
|
|
|
354
344
|
"cell_type": "markdown",
|
|
355
345
|
"metadata": {},
|
|
356
346
|
"source": [
|
|
357
|
-
"
|
|
347
|
+
"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. \n",
|
|
358
348
|
"\n",
|
|
359
349
|
"First, prepare a dictionary with the relevant information about your data product: "
|
|
360
350
|
]
|
|
@@ -403,7 +393,7 @@
|
|
|
403
393
|
"cell_type": "markdown",
|
|
404
394
|
"metadata": {},
|
|
405
395
|
"source": [
|
|
406
|
-
"The metadata of a given data product is the information
|
|
396
|
+
"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`). \n",
|
|
407
397
|
"\n",
|
|
408
398
|
"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). "
|
|
409
399
|
]
|
|
@@ -444,7 +434,7 @@
|
|
|
444
434
|
"cell_type": "markdown",
|
|
445
435
|
"metadata": {},
|
|
446
436
|
"source": [
|
|
447
|
-
"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
|
|
437
|
+
"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. "
|
|
448
438
|
]
|
|
449
439
|
},
|
|
450
440
|
{
|
|
@@ -468,7 +458,7 @@
|
|
|
468
458
|
"\n",
|
|
469
459
|
"### How to share data products with other RSP users\n",
|
|
470
460
|
"\n",
|
|
471
|
-
"All data products uploaded to the PZ Server are
|
|
461
|
+
"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**:\n",
|
|
472
462
|
"\n",
|
|
473
463
|
"https://pz-server.linea.org.br/product/ + **internal_name** \n",
|
|
474
464
|
"\n",
|
|
@@ -501,7 +491,7 @@
|
|
|
501
491
|
"cell_type": "markdown",
|
|
502
492
|
"metadata": {},
|
|
503
493
|
"source": [
|
|
504
|
-
"
|
|
494
|
+
"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**). \n",
|
|
505
495
|
"\n",
|
|
506
496
|
"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: "
|
|
507
497
|
]
|
|
@@ -529,7 +519,7 @@
|
|
|
529
519
|
"cell_type": "markdown",
|
|
530
520
|
"metadata": {},
|
|
531
521
|
"source": [
|
|
532
|
-
"The tabular data is allocated in the attribute `data`,
|
|
522
|
+
"The tabular data is allocated in the attribute `data`, a `pandas.DataFrame`. "
|
|
533
523
|
]
|
|
534
524
|
},
|
|
535
525
|
{
|
|
@@ -579,7 +569,7 @@
|
|
|
579
569
|
"cell_type": "markdown",
|
|
580
570
|
"metadata": {},
|
|
581
571
|
"source": [
|
|
582
|
-
"
|
|
572
|
+
"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\"`). "
|
|
583
573
|
]
|
|
584
574
|
},
|
|
585
575
|
{
|
|
@@ -608,14 +598,251 @@
|
|
|
608
598
|
"cell_type": "markdown",
|
|
609
599
|
"metadata": {},
|
|
610
600
|
"source": [
|
|
611
|
-
"
|
|
601
|
+
"---\n",
|
|
602
|
+
"\n",
|
|
603
|
+
"Next, let's explore specific features for each product type... "
|
|
604
|
+
]
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
"cell_type": "markdown",
|
|
608
|
+
"metadata": {
|
|
609
|
+
"execution": {
|
|
610
|
+
"iopub.execute_input": "2024-12-11T14:43:17.277296Z",
|
|
611
|
+
"iopub.status.busy": "2024-12-11T14:43:17.276646Z",
|
|
612
|
+
"iopub.status.idle": "2024-12-11T14:43:17.345452Z",
|
|
613
|
+
"shell.execute_reply": "2024-12-11T14:43:17.344690Z",
|
|
614
|
+
"shell.execute_reply.started": "2024-12-11T14:43:17.277264Z"
|
|
615
|
+
}
|
|
616
|
+
},
|
|
617
|
+
"source": [
|
|
618
|
+
"## Spec-z Catalogs "
|
|
619
|
+
]
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
"cell_type": "markdown",
|
|
623
|
+
"metadata": {
|
|
624
|
+
"execution": {
|
|
625
|
+
"iopub.execute_input": "2024-12-11T14:44:23.295109Z",
|
|
626
|
+
"iopub.status.busy": "2024-12-11T14:44:23.294100Z",
|
|
627
|
+
"iopub.status.idle": "2024-12-11T14:44:23.394796Z",
|
|
628
|
+
"shell.execute_reply": "2024-12-11T14:44:23.393752Z",
|
|
629
|
+
"shell.execute_reply.started": "2024-12-11T14:44:23.295078Z"
|
|
630
|
+
}
|
|
631
|
+
},
|
|
632
|
+
"source": [
|
|
633
|
+
"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. \n",
|
|
634
|
+
"\n",
|
|
635
|
+
"\n",
|
|
636
|
+
"Mandatory columns: \n",
|
|
637
|
+
"* Right ascension [degrees] - `float`\n",
|
|
638
|
+
"* Declination [degrees] - `float`\n",
|
|
639
|
+
"* Spectroscopic or true redshift - `float`\n",
|
|
640
|
+
"\n",
|
|
641
|
+
"Recommended columns: \n",
|
|
642
|
+
"* Spectroscopic redshift error - `float`\n",
|
|
643
|
+
"* Quality flag - `integer`, `float`, or `string`\n",
|
|
644
|
+
"* Survey name (recommended for compilations of data from different surveys)"
|
|
645
|
+
]
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
"cell_type": "markdown",
|
|
649
|
+
"metadata": {},
|
|
650
|
+
"source": [
|
|
651
|
+
"Let's see an example of Spec-z Catalog: "
|
|
652
|
+
]
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
"cell_type": "code",
|
|
656
|
+
"execution_count": null,
|
|
657
|
+
"metadata": {},
|
|
658
|
+
"outputs": [],
|
|
659
|
+
"source": [
|
|
660
|
+
"gama = pz_server.get_product(14)"
|
|
661
|
+
]
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
"cell_type": "code",
|
|
665
|
+
"execution_count": null,
|
|
666
|
+
"metadata": {},
|
|
667
|
+
"outputs": [],
|
|
668
|
+
"source": [
|
|
669
|
+
"gama.display_metadata()"
|
|
670
|
+
]
|
|
671
|
+
},
|
|
672
|
+
{
|
|
673
|
+
"cell_type": "markdown",
|
|
674
|
+
"metadata": {},
|
|
675
|
+
"source": [
|
|
676
|
+
"The attribute `data`, which is a `DataFrame` preserves the `plot` method from Pandas. "
|
|
677
|
+
]
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
"cell_type": "markdown",
|
|
681
|
+
"metadata": {},
|
|
682
|
+
"source": [
|
|
683
|
+
"Display basic statistics"
|
|
684
|
+
]
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
"cell_type": "code",
|
|
688
|
+
"execution_count": null,
|
|
689
|
+
"metadata": {},
|
|
690
|
+
"outputs": [],
|
|
691
|
+
"source": [
|
|
692
|
+
"gama.data.describe()"
|
|
693
|
+
]
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
"cell_type": "code",
|
|
697
|
+
"execution_count": null,
|
|
698
|
+
"metadata": {},
|
|
699
|
+
"outputs": [],
|
|
700
|
+
"source": [
|
|
701
|
+
"gama.data.plot(x=\"RA\", y=\"DEC\", kind=\"scatter\") "
|
|
702
|
+
]
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
"cell_type": "code",
|
|
706
|
+
"execution_count": null,
|
|
707
|
+
"metadata": {},
|
|
708
|
+
"outputs": [],
|
|
709
|
+
"source": [
|
|
710
|
+
"gama.data.hist('Z')"
|
|
711
|
+
]
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
"cell_type": "markdown",
|
|
715
|
+
"metadata": {
|
|
716
|
+
"execution": {
|
|
717
|
+
"iopub.execute_input": "2024-12-11T14:48:50.817530Z",
|
|
718
|
+
"iopub.status.busy": "2024-12-11T14:48:50.816805Z",
|
|
719
|
+
"iopub.status.idle": "2024-12-11T14:48:50.887900Z",
|
|
720
|
+
"shell.execute_reply": "2024-12-11T14:48:50.886976Z",
|
|
721
|
+
"shell.execute_reply.started": "2024-12-11T14:48:50.817502Z"
|
|
722
|
+
}
|
|
723
|
+
},
|
|
724
|
+
"source": [
|
|
725
|
+
"## Training Sets \n",
|
|
726
|
+
" \n",
|
|
727
|
+
"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). \n",
|
|
728
|
+
"\n",
|
|
729
|
+
"\n",
|
|
730
|
+
"_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._\n",
|
|
612
731
|
"\n",
|
|
613
|
-
"
|
|
732
|
+
" \n",
|
|
733
|
+
"_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._\n",
|
|
734
|
+
"\n",
|
|
735
|
+
"\n",
|
|
736
|
+
"Mandatory column: \n",
|
|
737
|
+
"* Spectroscopic (or true) redshift - `float`\n",
|
|
738
|
+
"\n",
|
|
739
|
+
"Other expected columns\n",
|
|
740
|
+
"* Object ID from LSST Objects Catalog - `integer`\n",
|
|
741
|
+
"* Observables: magnitudes (and/or colors, or fluxes) from LSST Objects Catalog - `float`\n",
|
|
742
|
+
"* Observable errors: magnitude errors (and/or color errors, or flux errors) from LSST Objects Catalog - `float`\n",
|
|
743
|
+
"* Right ascension [degrees] - `float`\n",
|
|
744
|
+
"* Declination [degrees] - `float`\n",
|
|
745
|
+
"* Quality Flag - `integer`, `float`, or `string`\n",
|
|
746
|
+
"* Subset Flag - `integer`, `float`, or `string`\n"
|
|
747
|
+
]
|
|
748
|
+
},
|
|
749
|
+
{
|
|
750
|
+
"cell_type": "markdown",
|
|
751
|
+
"metadata": {},
|
|
752
|
+
"source": [
|
|
753
|
+
"For example: "
|
|
754
|
+
]
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
"cell_type": "code",
|
|
758
|
+
"execution_count": null,
|
|
759
|
+
"metadata": {
|
|
760
|
+
"tags": []
|
|
761
|
+
},
|
|
762
|
+
"outputs": [],
|
|
763
|
+
"source": [
|
|
764
|
+
"train_goldenspike = pz_server.get_product(9)"
|
|
765
|
+
]
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
"cell_type": "code",
|
|
769
|
+
"execution_count": null,
|
|
770
|
+
"metadata": {
|
|
771
|
+
"tags": []
|
|
772
|
+
},
|
|
773
|
+
"outputs": [],
|
|
774
|
+
"source": [
|
|
775
|
+
"train_goldenspike.display_metadata()"
|
|
776
|
+
]
|
|
777
|
+
},
|
|
778
|
+
{
|
|
779
|
+
"cell_type": "markdown",
|
|
780
|
+
"metadata": {},
|
|
781
|
+
"source": [
|
|
782
|
+
"Display basic statistics"
|
|
783
|
+
]
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
"cell_type": "code",
|
|
787
|
+
"execution_count": null,
|
|
788
|
+
"metadata": {},
|
|
789
|
+
"outputs": [],
|
|
790
|
+
"source": [
|
|
791
|
+
"train_goldenspike.data.describe()"
|
|
792
|
+
]
|
|
793
|
+
},
|
|
794
|
+
{
|
|
795
|
+
"cell_type": "code",
|
|
796
|
+
"execution_count": null,
|
|
797
|
+
"metadata": {},
|
|
798
|
+
"outputs": [],
|
|
799
|
+
"source": [
|
|
800
|
+
"train_goldenspike.data.hist('redshift', bins=20)"
|
|
801
|
+
]
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
"cell_type": "code",
|
|
805
|
+
"execution_count": null,
|
|
806
|
+
"metadata": {},
|
|
807
|
+
"outputs": [],
|
|
808
|
+
"source": [
|
|
809
|
+
"train_goldenspike.data.hist('mag_i_lsst', bins=20)"
|
|
810
|
+
]
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
"cell_type": "markdown",
|
|
814
|
+
"metadata": {},
|
|
815
|
+
"source": [
|
|
816
|
+
"## Training and Validation Results\n",
|
|
614
817
|
"\n",
|
|
818
|
+
"The results of training or validating PZ algorithms can not be loaded into memory directly but can be downloaded to the local work directory. "
|
|
819
|
+
]
|
|
820
|
+
},
|
|
821
|
+
{
|
|
822
|
+
"cell_type": "code",
|
|
823
|
+
"execution_count": null,
|
|
824
|
+
"metadata": {},
|
|
825
|
+
"outputs": [],
|
|
826
|
+
"source": [
|
|
827
|
+
"pz_server.download_product(\"182_example_tpz_training_results\", save_in=\".\") "
|
|
828
|
+
]
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
"cell_type": "markdown",
|
|
832
|
+
"metadata": {},
|
|
833
|
+
"source": [
|
|
834
|
+
"## PZ Server Pipelines (under development) \n",
|
|
615
835
|
"\n",
|
|
836
|
+
"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. \n"
|
|
837
|
+
]
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
"cell_type": "markdown",
|
|
841
|
+
"metadata": {},
|
|
842
|
+
"source": [
|
|
616
843
|
"--- \n",
|
|
617
844
|
"\n",
|
|
618
|
-
"
|
|
845
|
+
"## User feedback \n",
|
|
619
846
|
"\n",
|
|
620
847
|
"Is something important missing? [Click here to open an issue in the PZ Server library repository on GitHub](https://github.com/linea-it/pzserver/issues/new). "
|
|
621
848
|
]
|
|
@@ -623,9 +850,9 @@
|
|
|
623
850
|
],
|
|
624
851
|
"metadata": {
|
|
625
852
|
"kernelspec": {
|
|
626
|
-
"display_name": "
|
|
853
|
+
"display_name": "LSST",
|
|
627
854
|
"language": "python",
|
|
628
|
-
"name": "
|
|
855
|
+
"name": "lsst"
|
|
629
856
|
},
|
|
630
857
|
"language_info": {
|
|
631
858
|
"codemirror_mode": {
|
|
@@ -637,7 +864,7 @@
|
|
|
637
864
|
"name": "python",
|
|
638
865
|
"nbconvert_exporter": "python",
|
|
639
866
|
"pygments_lexer": "ipython3",
|
|
640
|
-
"version": "3.
|
|
867
|
+
"version": "3.11.9"
|
|
641
868
|
},
|
|
642
869
|
"nbsphinx": {
|
|
643
870
|
"execute": "never"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|