roman-snpit-snappl 0.16.0__tar.gz → 0.18.0__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.
- {roman_snpit_snappl-0.16.0/roman_snpit_snappl.egg-info → roman_snpit_snappl-0.18.0}/PKG-INFO +2 -2
- roman_snpit_snappl-0.18.0/changes/83.snappl.rst +1 -0
- roman_snpit_snappl-0.18.0/changes/85.feature.rst +2 -0
- roman_snpit_snappl-0.18.0/changes/87.docs.rst +1 -0
- roman_snpit_snappl-0.18.0/changes/89.feature.rst +2 -0
- roman_snpit_snappl-0.18.0/changes/91.feature.rst +3 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/docker/postgres/run_postgres.sh +2 -2
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/docker/webserver/Dockerfile +28 -0
- roman_snpit_snappl-0.18.0/docker/webserver/config-test.yaml +27 -0
- roman_snpit_snappl-0.18.0/docs/api.rst +31 -0
- roman_snpit_snappl-0.18.0/docs/database_schema.rst +238 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/docs/index.rst +1 -0
- roman_snpit_snappl-0.18.0/docs/usage.rst +220 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/pyproject.toml +1 -1
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0/roman_snpit_snappl.egg-info}/PKG-INFO +2 -2
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/roman_snpit_snappl.egg-info/SOURCES.txt +8 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/roman_snpit_snappl.egg-info/requires.txt +1 -1
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/_version.py +3 -3
- roman_snpit_snappl-0.18.0/snappl/admin/load_ou2024_l2images.py +141 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/admin/load_snana_ou2024_diaobject.py +1 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/config.py +212 -52
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/db/baseview.py +1 -1
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/db/db.py +82 -62
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/db/migrations/20251008_init.sql +3 -2
- roman_snpit_snappl-0.18.0/snappl/db/migrations/20251017_objdetcount.sql +1 -0
- roman_snpit_snappl-0.18.0/snappl/db/migrations/schema_to_rst.py +71 -0
- roman_snpit_snappl-0.18.0/snappl/db/webserver.py +567 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/dbclient.py +10 -8
- roman_snpit_snappl-0.18.0/snappl/diaobject.py +760 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/image.py +35 -2
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/image_simulator.py +62 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/imagecollection.py +155 -12
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/provenance.py +68 -5
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/psf.py +3 -3
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/sed.py +2 -2
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/utils.py +18 -5
- roman_snpit_snappl-0.16.0/docker/webserver/config-test.yaml +0 -27
- roman_snpit_snappl-0.16.0/docs/api.rst +0 -15
- roman_snpit_snappl-0.16.0/docs/usage.rst +0 -7
- roman_snpit_snappl-0.16.0/snappl/db/migrations/schema_to_rst.py +0 -56
- roman_snpit_snappl-0.16.0/snappl/db/webserver.py +0 -295
- roman_snpit_snappl-0.16.0/snappl/diaobject.py +0 -519
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/.cruft.json +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/.github/CODEOWNERS +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/.github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/.github/ISSUE_TEMPLATE/PR_TEMPLATE.md +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/.github/dependabot.yml +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/.github/labeler.yml +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/.github/workflows/changelog.yml +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/.github/workflows/run_labeler.yml +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/.github/workflows/run_snappl_tests.yml +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/.github/workflows/sphinx-deploy.yml +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/.github/workflows/sub_package_update.yml +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/.gitignore +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/.pre-commit-config.yaml +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/CHANGES.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/CITATION.cff +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/CODE_OF_CONDUCT.md +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/CONTRIBUTING.md +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/LICENSE +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/MANIFEST.in +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/README.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/.gitkeep +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/10.snappl.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/13.bugfix.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/14.snappl.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/15.feature.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/16.feature.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/18.feature.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/20.bugfix.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/23.snappl.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/26.feature.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/29.feature.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/3.snappl.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/31.feature.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/35.snappl.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/36.snappl.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/37.snappl.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/40.snappl.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/41.snappl.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/43.snappl.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/47.feature.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/49.docs.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/5.snappl.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/54.snappl.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/57.snappl.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/58.snappl.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/61.bugfix.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/62.snappl.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/63.snappl.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/65.bugfix.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/68.feature.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/72.snappl.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/73.feature.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/74.bugfix.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/79.snappl.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/8.snappl.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/81.snappl.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/82.snappl.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/84.feature.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/changes/9.snappl.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/codespell-ignore.txt +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/docker/postgres/Dockerfile +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/docker/postgres/postgresql.conf +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/docker/webserver/cert.pem +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/docker/webserver/key.pem +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/docker/webserver/roman-snpit-server.py +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/docs/Makefile +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/docs/_static/logo_black_filled.png +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/docs/changes.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/docs/conf.py +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/docs/installation.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/docs/make.bat +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/experimentation/README.md +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/experimentation/ap_phot_simulated_images.py +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/experimentation/play_with_photutils.py +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/licenses/.DS_Store +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/licenses/LICENSE.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/licenses/README.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/licenses/TEMPLATE_LICENSE.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/roman_snpit_snappl.egg-info/dependency_links.txt +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/roman_snpit_snappl.egg-info/not-zip-safe +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/roman_snpit_snappl.egg-info/top_level.txt +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/setup.cfg +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/setup.py +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/__init__.py +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/_dev/__init__.py +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/_dev/scm_version.py +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/data/README.rst +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/db/migrations/apply_migrations.py +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/db/migrations/scorched_earth.py +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/db/migrations/wipe_all_data.py +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/db/static/romansnpit.css +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/db/static/romansnpit.js +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/db/static/romansnpit_start.js +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/db/templates/base.html +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/db/templates/romansnpitdb.html +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/http.py +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/logger.py +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/snappl/wcs.py +0 -0
- {roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0}/tox.ini +0 -0
{roman_snpit_snappl-0.16.0/roman_snpit_snappl.egg-info → roman_snpit_snappl-0.18.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: roman_snpit_snappl
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.18.0
|
|
4
4
|
Summary: General, database, and photometry utilities for the Roman SNPIT
|
|
5
5
|
Author: Roman Supernova Project Infrastructure Team
|
|
6
6
|
Maintainer-email: Roman SN PIT <raknop@lbl.gov>
|
|
@@ -22,7 +22,7 @@ Requires-Dist: pycryptodome<4.0.0,>=3.23.0
|
|
|
22
22
|
Requires-Dist: python-dateutil<3.0.0,>=2.9.0.post0
|
|
23
23
|
Requires-Dist: pytz>=2025.2
|
|
24
24
|
Requires-Dist: pyyaml<7.0.0,>=6.0.3
|
|
25
|
-
Requires-Dist: rkwebutil<3.0.0,>=2.
|
|
25
|
+
Requires-Dist: rkwebutil<3.0.0,>=2.4.0
|
|
26
26
|
Requires-Dist: roman-datamodels<0.28.0,>=0.27.0
|
|
27
27
|
Requires-Dist: scipy<2.0.0,>=1.16.2
|
|
28
28
|
Requires-Dist: simplejson<4.0.0,>=3.20.2
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Added extremely basic static source sim to snappl.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Add info about dbclient, Config, Provenance to usage.rst in documentation.
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
if [ ! -f $POSTGRES_DATA_DIR/PG_VERSION ]; then
|
|
4
4
|
echo "Running initdb in $POSTGRES_DATA_DIR"
|
|
5
|
-
/usr/lib/postgresql/15/bin/initdb -U postgres --pwfile
|
|
5
|
+
/usr/lib/postgresql/15/bin/initdb -U postgres --pwfile=${PGPASSWDFILE:-/secrets/pgpasswd} $POSTGRES_DATA_DIR
|
|
6
6
|
/usr/lib/postgresql/15/bin/pg_ctl -D $POSTGRES_DATA_DIR start
|
|
7
7
|
psql --command "CREATE DATABASE roman_snpit OWNER postgres"
|
|
8
8
|
psql --command "CREATE EXTENSION q3c" roman_snpit
|
|
9
9
|
psql --command "CREATE EXTENSION pgcrypto" roman_snpit
|
|
10
10
|
psql --command "CREATE EXTENSION pg_hint_plan" roman_snpit
|
|
11
11
|
# psql --command "CREATE EXTENSION pg_parquet" roman_snpit
|
|
12
|
-
ropasswd=`cat
|
|
12
|
+
ropasswd=`cat ${PGPASSWDFILE_RO:-/secrets/postgres_ro_password}`
|
|
13
13
|
psql --command "CREATE USER postgres_ro PASSWORD '${ropasswd}'"
|
|
14
14
|
psql --command "GRANT CONNECT ON DATABASE roman_snpit TO postgres_ro"
|
|
15
15
|
psql --command "GRANT USAGE ON SCHEMA public TO postgres_ro" roman_snpit
|
|
@@ -58,6 +58,33 @@ RUN source /venv/bin/activate && \
|
|
|
58
58
|
"pytest>=8.4.2,<9.0.0" \
|
|
59
59
|
"remote-pdb==2.1.0"
|
|
60
60
|
|
|
61
|
+
# TEMPORARY
|
|
62
|
+
# This installs the preqreqs of snappl. Really, we should
|
|
63
|
+
# just let that be installed when we do pip install .
|
|
64
|
+
# below. However, during development, when editing
|
|
65
|
+
# the package a lot, it's faster to build the docker
|
|
66
|
+
# image if there's a previous step that already has the prereqs.
|
|
67
|
+
# In the mean time, KEEP THIS SYNCED WITH pyproject.toml
|
|
68
|
+
RUN source /venv/bin/activate && \
|
|
69
|
+
pip --no-cache install \
|
|
70
|
+
"astropy>=7.1.0,<8.0.0" \
|
|
71
|
+
"fitsio>=1.2.5,<2.0.0" \
|
|
72
|
+
"galsim>=2.7.2,<3.0.0" \
|
|
73
|
+
"gwcs>=0.26.0,<0.27.0" \
|
|
74
|
+
"h5py>=3.14.0,<4.0.0" \
|
|
75
|
+
"numpy>=2.2.6,<3.0.0" \
|
|
76
|
+
"pandas>=2.3.3,<3.0.0" \
|
|
77
|
+
"photutils>=2.3.0,<3.0.0" \
|
|
78
|
+
"pycryptodome>=3.23.0,<4.0.0" \
|
|
79
|
+
"python-dateutil>=2.9.0.post0,<3.0.0" \
|
|
80
|
+
"pytz>=2025.2" \
|
|
81
|
+
"pyyaml>=6.0.3,<7.0.0" \
|
|
82
|
+
"rkwebutil>=2.3.0,<3.0.0" \
|
|
83
|
+
"roman-datamodels>=0.27.0,<0.28.0" \
|
|
84
|
+
"scipy>=1.16.2,<2.0.0" \
|
|
85
|
+
"simplejson>=3.20.2,<4.0.0"
|
|
86
|
+
# END TEMPORARY
|
|
87
|
+
|
|
61
88
|
RUN mkdir -p /usr/src/snappl_install
|
|
62
89
|
WORKDIR /usr/src/snappl_install
|
|
63
90
|
COPY . /usr/src/snappl_install
|
|
@@ -112,6 +139,7 @@ ENV PYTHONPATH=/roman-snpit-db
|
|
|
112
139
|
RUN mkdir /sessions
|
|
113
140
|
|
|
114
141
|
COPY docker/webserver/config-test.yaml /roman-snpit-db/
|
|
142
|
+
COPY docker/webserver/roman-snpit-server.py /roman-snpit-db/
|
|
115
143
|
|
|
116
144
|
ENTRYPOINT [ "tail", "-f", "/etc/issue" ]
|
|
117
145
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# This is the config file used for the tests.
|
|
2
|
+
# You should not use it for real. Ideally, you
|
|
3
|
+
# should have a config stored as a secret somewhere
|
|
4
|
+
# which you mount (say to /secrets/conifg.yaml),
|
|
5
|
+
# and then set the env var SNPIT_CONFIG to point
|
|
6
|
+
# to that config.
|
|
7
|
+
|
|
8
|
+
system:
|
|
9
|
+
webserver:
|
|
10
|
+
flask_secret_key: o6950bi77gvbc2jie49lklotwll69ayv
|
|
11
|
+
sessionstore: /sessions
|
|
12
|
+
emailfrom: nobody@nowhere.org
|
|
13
|
+
smtpserver: mailhog
|
|
14
|
+
smtpport: 1025
|
|
15
|
+
smtpusessl: False
|
|
16
|
+
smtpusername: NULL
|
|
17
|
+
smtppassword: NULL
|
|
18
|
+
|
|
19
|
+
db:
|
|
20
|
+
postgres_host: postgres
|
|
21
|
+
postgres_port: 5432
|
|
22
|
+
postgres_database: roman_snpit
|
|
23
|
+
postgres_username: postgres
|
|
24
|
+
postgres_password: fragile
|
|
25
|
+
# These next two are for debugging purposes and should always be false in production
|
|
26
|
+
echoqueries: true
|
|
27
|
+
alwaysexplain: false
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.. _api:
|
|
2
|
+
|
|
3
|
+
==========
|
|
4
|
+
snappl API
|
|
5
|
+
==========
|
|
6
|
+
|
|
7
|
+
.. contents::
|
|
8
|
+
|
|
9
|
+
.. automodapi:: snappl.config
|
|
10
|
+
|
|
11
|
+
.. automodapi:: snappl.logger
|
|
12
|
+
|
|
13
|
+
.. automodapi:: snappl.utils
|
|
14
|
+
|
|
15
|
+
.. automodapi:: snappl.dbclient
|
|
16
|
+
|
|
17
|
+
.. automodapi:: snappl.provenance
|
|
18
|
+
|
|
19
|
+
.. automodapi:: snappl.http
|
|
20
|
+
|
|
21
|
+
.. automodapi:: snappl.diaobject
|
|
22
|
+
|
|
23
|
+
.. automodapi:: snappl.imagecollection
|
|
24
|
+
|
|
25
|
+
.. automodapi:: snappl.image
|
|
26
|
+
|
|
27
|
+
.. automodapi:: snappl.wcs
|
|
28
|
+
|
|
29
|
+
.. automodapi:: snappl.psf
|
|
30
|
+
|
|
31
|
+
.. automodapi:: snappl.sed
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
===============
|
|
2
|
+
Database Schema
|
|
3
|
+
===============
|
|
4
|
+
|
|
5
|
+
These are the schema of the tables in the backend database. The databsae code is all in the ``db`` submodule of ``snappl``. Normally, you will not interact with these directly. Rather, you will call ``snappl`` library functions that contact the web API frontend to the database. You only really need to know about these if you're working on the backend.
|
|
6
|
+
|
|
7
|
+
Last updated 2025-10-17.
|
|
8
|
+
|
|
9
|
+
.. contents::
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
**Table:** ``provenance``
|
|
14
|
+
-------------------------
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
Data product provenance
|
|
18
|
+
|
|
19
|
+
=============== =========== ===== ======== ===============================================================
|
|
20
|
+
Column Type null? Default Comment
|
|
21
|
+
=============== =========== ===== ======== ===============================================================
|
|
22
|
+
``id`` ``uuid`` NO ``None`` Unique hash of the provenance
|
|
23
|
+
``environment`` ``integer`` YES ``None`` Environment; see snpit_utils.provenance.Provenance.environments
|
|
24
|
+
``env_major`` ``integer`` YES ``None`` Semantic major version of environment for this provenance
|
|
25
|
+
``env_minor`` ``integer`` YES ``None`` Semantic minor version of environment for this provenance
|
|
26
|
+
``process`` ``text`` NO ``None`` Name of the process or code associated with this provenace
|
|
27
|
+
``major`` ``integer`` NO ``None`` Semantic major version of code for this provenance
|
|
28
|
+
``minor`` ``integer`` NO ``None`` Semantic minor version of code for this provenance
|
|
29
|
+
``params`` ``jsonb`` YES ``None`` Parameters that define the process behavior for this provenance
|
|
30
|
+
=============== =========== ===== ======== ===============================================================
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
**Table:** ``provenance_upstream``
|
|
34
|
+
----------------------------------
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
Upstream linkage table for provenance
|
|
38
|
+
|
|
39
|
+
================= ======== ===== ======== =======
|
|
40
|
+
Column Type null? Default Comment
|
|
41
|
+
================= ======== ===== ======== =======
|
|
42
|
+
``downstream_id`` ``uuid`` NO ``None`` None
|
|
43
|
+
``upstream_id`` ``uuid`` NO ``None`` None
|
|
44
|
+
================= ======== ===== ======== =======
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
**Table:** ``provenance_tag``
|
|
48
|
+
-----------------------------
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
Human readable tags for collections of provenances
|
|
52
|
+
|
|
53
|
+
================= ======== ===== ======== ======================================================================
|
|
54
|
+
Column Type null? Default Comment
|
|
55
|
+
================= ======== ===== ======== ======================================================================
|
|
56
|
+
``tag`` ``text`` NO ``None`` Human-readable tag
|
|
57
|
+
``process`` ``text`` NO ``None`` process of the provenance; must match corresponding provenance process
|
|
58
|
+
``provenance_id`` ``uuid`` NO ``None`` id of the provenance
|
|
59
|
+
================= ======== ===== ======== ======================================================================
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
**Table:** ``l2image``
|
|
63
|
+
----------------------
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
L2 image
|
|
67
|
+
|
|
68
|
+
================= ==================== ===== =============== ===========================================
|
|
69
|
+
Column Type null? Default Comment
|
|
70
|
+
================= ==================== ===== =============== ===========================================
|
|
71
|
+
``id`` ``uuid`` NO ``None`` None
|
|
72
|
+
``provenance_id`` ``uuid`` NO ``None`` None
|
|
73
|
+
``pointing`` ``integer`` YES ``None`` Pointing of the exposure this image is from
|
|
74
|
+
``sca`` ``integer`` YES ``None`` SCA of this image
|
|
75
|
+
``filter`` ``text`` NO ``None`` None
|
|
76
|
+
``ra`` ``double precision`` NO ``None`` None
|
|
77
|
+
``dec`` ``double precision`` NO ``None`` None
|
|
78
|
+
``ra_corner_00`` ``real`` NO ``None`` RA of pixel (0,0)
|
|
79
|
+
``ra_corner_01`` ``real`` NO ``None`` RA of pixel (0,height-1)
|
|
80
|
+
``ra_corner_10`` ``real`` NO ``None`` RA of pixel (width-1,0)
|
|
81
|
+
``ra_corner_11`` ``real`` NO ``None`` RA of pixel (width-1,height-1)
|
|
82
|
+
``dec_corner_00`` ``real`` NO ``None`` Dec of pixel (0,0)
|
|
83
|
+
``dec_corner_01`` ``real`` NO ``None`` Dec of pixel (0,height-1)
|
|
84
|
+
``dec_corner_10`` ``real`` NO ``None`` Dec of pixel (width-1,0)
|
|
85
|
+
``dec_corner_11`` ``real`` NO ``None`` Dec of pixel (width-1,height-1)
|
|
86
|
+
``filepath`` ``text`` NO ``None`` None
|
|
87
|
+
``extension`` ``ARRAY`` YES ``None`` None
|
|
88
|
+
``width`` ``smallint`` YES ``None`` None
|
|
89
|
+
``height`` ``smallint`` YES ``None`` None
|
|
90
|
+
``format`` ``smallint`` NO ``0`` 0=Unknown, 1=FITS, 2=Roman Datamodel
|
|
91
|
+
``mjd_start`` ``double precision`` NO ``None`` None
|
|
92
|
+
``exptime`` ``real`` NO ``None`` None
|
|
93
|
+
``properties`` ``jsonb`` YES ``'{}'::jsonb`` None
|
|
94
|
+
================= ==================== ===== =============== ===========================================
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
**Table:** ``summed_image``
|
|
98
|
+
---------------------------
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
image that is a sum of L2 images
|
|
102
|
+
|
|
103
|
+
================= ==================== ===== ======== =======
|
|
104
|
+
Column Type null? Default Comment
|
|
105
|
+
================= ==================== ===== ======== =======
|
|
106
|
+
``id`` ``uuid`` NO ``None`` None
|
|
107
|
+
``provenance_id`` ``uuid`` NO ``None`` None
|
|
108
|
+
``filter`` ``text`` NO ``None`` None
|
|
109
|
+
``ra`` ``double precision`` NO ``None`` None
|
|
110
|
+
``dec`` ``double precision`` NO ``None`` None
|
|
111
|
+
``ra_corner_00`` ``real`` NO ``None`` None
|
|
112
|
+
``ra_corner_01`` ``real`` NO ``None`` None
|
|
113
|
+
``ra_corner_10`` ``real`` NO ``None`` None
|
|
114
|
+
``ra_corner_11`` ``real`` NO ``None`` None
|
|
115
|
+
``dec_corner_00`` ``real`` NO ``None`` None
|
|
116
|
+
``dec_corner_01`` ``real`` NO ``None`` None
|
|
117
|
+
``dec_corner_10`` ``real`` NO ``None`` None
|
|
118
|
+
``dec_corner_11`` ``real`` NO ``None`` None
|
|
119
|
+
``filepath`` ``text`` NO ``None`` None
|
|
120
|
+
``extension`` ``ARRAY`` YES ``None`` None
|
|
121
|
+
``width`` ``smallint`` YES ``None`` None
|
|
122
|
+
``height`` ``smallint`` YES ``None`` None
|
|
123
|
+
``format`` ``smallint`` NO ``None`` None
|
|
124
|
+
``mjd_start`` ``double precision`` NO ``None`` None
|
|
125
|
+
``mjd_end`` ``double precision`` NO ``None`` None
|
|
126
|
+
``properties`` ``jsonb`` YES ``None`` None
|
|
127
|
+
================= ==================== ===== ======== =======
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
**Table:** ``summed_image_component``
|
|
131
|
+
-------------------------------------
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
summed_image linkage table
|
|
135
|
+
|
|
136
|
+
=================== ======== ===== ======== =======
|
|
137
|
+
Column Type null? Default Comment
|
|
138
|
+
=================== ======== ===== ======== =======
|
|
139
|
+
``summed_image_id`` ``uuid`` NO ``None`` None
|
|
140
|
+
``l2image_id`` ``uuid`` NO ``None`` None
|
|
141
|
+
=================== ======== ===== ======== =======
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
**Table:** ``diaobject``
|
|
145
|
+
------------------------
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
Known transients or simulated transients
|
|
149
|
+
|
|
150
|
+
================= ==================== ===== ======== ==========================================================
|
|
151
|
+
Column Type null? Default Comment
|
|
152
|
+
================= ==================== ===== ======== ==========================================================
|
|
153
|
+
``id`` ``uuid`` NO ``None`` None
|
|
154
|
+
``provenance_id`` ``uuid`` NO ``None`` None
|
|
155
|
+
``name`` ``text`` YES ``None`` Name or id of the transient within its provenance.
|
|
156
|
+
``iauname`` ``text`` YES ``None`` IAU/TNS name of the transient.
|
|
157
|
+
``ra`` ``double precision`` YES ``None`` Approx (±1"ish) RA of object; ICRS decimal degrees
|
|
158
|
+
``dec`` ``double precision`` YES ``None`` Approx (±1"ish) Dec of object; ICRS decimal degrees
|
|
159
|
+
``mjd_discovery`` ``double precision`` YES ``None`` MJD of image where the transient was discovered
|
|
160
|
+
``mjd_peak`` ``double precision`` YES ``None`` Approx. MJD where transient is at peak flux
|
|
161
|
+
``mjd_start`` ``double precision`` YES ``None`` Approx. MJD where the transient lightcurve "starts"
|
|
162
|
+
``mjd_end`` ``double precision`` YES ``None`` Approx. MJD where the transient lightcurve "ends"
|
|
163
|
+
``properties`` ``jsonb`` YES ``None`` Collection-specific additional properties of the transient
|
|
164
|
+
``ndetected`` ``integer`` NO ``1`` None
|
|
165
|
+
================= ==================== ===== ======== ==========================================================
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
**Table:** ``diaobject_position``
|
|
169
|
+
---------------------------------
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
Calculated positions for a diaobject
|
|
173
|
+
|
|
174
|
+
================= ============================ ===== ========= =========================================
|
|
175
|
+
Column Type null? Default Comment
|
|
176
|
+
================= ============================ ===== ========= =========================================
|
|
177
|
+
``id`` ``uuid`` NO ``None`` None
|
|
178
|
+
``diaobject_id`` ``uuid`` NO ``None`` None
|
|
179
|
+
``provenance_id`` ``uuid`` NO ``None`` None
|
|
180
|
+
``ra`` ``double precision`` YES ``None`` RA in ICRS decimal degrees
|
|
181
|
+
``ra_err`` ``double precision`` YES ``None`` Uncertainty on RA
|
|
182
|
+
``dec`` ``double precision`` YES ``None`` Dec in ICRS decimal degrees
|
|
183
|
+
``dec_err`` ``double precision`` YES ``None`` Uncertainty on Dec
|
|
184
|
+
``ra_dec_covar`` ``double precision`` YES ``None`` Covariance between RA and Dec
|
|
185
|
+
``calculated_at`` ``timestamp with time zone`` YES ``now()`` Time when this position was calculculated
|
|
186
|
+
================= ============================ ===== ========= =========================================
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
**Table:** ``lightcurve``
|
|
190
|
+
-------------------------
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
Transient object light curves; (provenance_id,diaobject_id,filter) is unique
|
|
194
|
+
|
|
195
|
+
================= ============================ ===== ========= =======
|
|
196
|
+
Column Type null? Default Comment
|
|
197
|
+
================= ============================ ===== ========= =======
|
|
198
|
+
``id`` ``uuid`` NO ``None`` None
|
|
199
|
+
``provenance_id`` ``uuid`` NO ``None`` None
|
|
200
|
+
``diaobject_id`` ``uuid`` NO ``None`` None
|
|
201
|
+
``filter`` ``text`` NO ``None`` None
|
|
202
|
+
``filepath`` ``text`` NO ``None`` None
|
|
203
|
+
``created_at`` ``timestamp with time zone`` YES ``now()`` None
|
|
204
|
+
================= ============================ ===== ========= =======
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
**Table:** ``authuser``
|
|
208
|
+
-----------------------
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
Users
|
|
212
|
+
|
|
213
|
+
=============== ========= ===== ===================== ============================================
|
|
214
|
+
Column Type null? Default Comment
|
|
215
|
+
=============== ========= ===== ===================== ============================================
|
|
216
|
+
``id`` ``uuid`` NO ``gen_random_uuid()`` None
|
|
217
|
+
``username`` ``text`` NO ``None`` None
|
|
218
|
+
``displayname`` ``text`` NO ``None`` None
|
|
219
|
+
``email`` ``text`` NO ``None`` None
|
|
220
|
+
``pubkey`` ``text`` YES ``None`` RSA public key
|
|
221
|
+
``privkey`` ``jsonb`` YES ``None`` RSA private key encrypted with user password
|
|
222
|
+
=============== ========= ===== ===================== ============================================
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
**Table:** ``passwordlink``
|
|
226
|
+
---------------------------
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
(no description)
|
|
230
|
+
|
|
231
|
+
=========== ============================ ===== ======== =======
|
|
232
|
+
Column Type null? Default Comment
|
|
233
|
+
=========== ============================ ===== ======== =======
|
|
234
|
+
``id`` ``uuid`` NO ``None`` None
|
|
235
|
+
``userid`` ``uuid`` NO ``None`` None
|
|
236
|
+
``expires`` ``timestamp with time zone`` YES ``None`` None
|
|
237
|
+
=========== ============================ ===== ======== =======
|
|
238
|
+
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
=====
|
|
2
|
+
Usage
|
|
3
|
+
=====
|
|
4
|
+
|
|
5
|
+
.. contents::
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
--------
|
|
9
|
+
Overview
|
|
10
|
+
--------
|
|
11
|
+
|
|
12
|
+
``snappl`` has a set of utilities for the Roman SNPIT, including all the classes and functions necessary for communicating with the internal snpit database.
|
|
13
|
+
|
|
14
|
+
Things you need to understand:
|
|
15
|
+
* :ref:`connecting-to-the-database`
|
|
16
|
+
* :ref:`config`
|
|
17
|
+
* :ref:`provenance`
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
.. _connecting-to-the-database:
|
|
21
|
+
|
|
22
|
+
--------------------------
|
|
23
|
+
Connecting to the Database
|
|
24
|
+
--------------------------
|
|
25
|
+
|
|
26
|
+
To connect to the database, you need three things. First, you have to know the url of the web API front-end to the database. You must also have a username and a password for that web API. (NOTE: the config system is likely to change in the future, so exactly how this works may change.) If you're using :ref:`test_env`, then the test fixture ``dbclient`` configures a user with username ``test`` and password ``test_password``, and in that environment the url of the web API is ``https://webserver:8080/``.
|
|
27
|
+
|
|
28
|
+
You configure all of these things by setting the ``system.db.url``, ``system.db.username``, and either ``system.db.password`` or ``system.db.password_file`` in the configuration yaml files. (See :ref:`config` below.) For example, see the default `snpit_system_config.yaml <https://github.com/Roman-Supernova-PIT/environment/blob/main/snpit_system_config.yaml>`_ in the Roman SNPIT environment. *Do not save passwords to any git archive, and do not leave them sitting about in insecure places.* Of course, having to type it all the time is a pain. A reasonable compromise is to have a ``secrets`` directory under your home directory **that is not world-readable** (``chown 700 secrets``). Then you can create files in there. Put your password in a file, and set the location of that file in the ``system.db.password_file`` config. (Make ``system.db.password`` to be ``null`` so the password file will be used.) If you're using a docker container, of course you'll need to bind-mount your secrets directory.
|
|
29
|
+
|
|
30
|
+
Once you've configured these things, you should be able to connect to the database. You can get a connection object with::
|
|
31
|
+
|
|
32
|
+
from snappl.dbclient import SNPITDBClient
|
|
33
|
+
|
|
34
|
+
dbclient = SNPITDBClient()
|
|
35
|
+
|
|
36
|
+
Thereafter, you can pass this ``dbclient`` as an optional argument to any ``snappl`` function that accesses the database. (Lots of the examples below do not explicitly include this argument, but you could add it to them.) Most of the functions will create their own ``dbclient`` using the config info as necessary. However, you are logged in when you first create the object, so it's inefficient if every time you call a function it has to log you in (or, at least, verify that you're logged in). If you make a ``dbclient`` and then are careful to pass as a keyword argument to any function that accepts it, you avoid this inefficiency.
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
.. _config:
|
|
40
|
+
|
|
41
|
+
------
|
|
42
|
+
Config
|
|
43
|
+
------
|
|
44
|
+
|
|
45
|
+
`snappl` includes a config system whereby configuration files can be stored in yaml files. It has the ability to include other yaml files, and to override any of the config values on the command line, if properly used.
|
|
46
|
+
|
|
47
|
+
The Default Confg
|
|
48
|
+
=================
|
|
49
|
+
|
|
50
|
+
You can find an example/default config for the Roman SNPIT in two files in the `environment` github repo:
|
|
51
|
+
|
|
52
|
+
* `default_snpit_config.yaml <https://github.com/Roman-Supernova-PIT/environment/blob/main/default_snpit_config.yaml>`_
|
|
53
|
+
* `snpit_system_config.yaml <https://github.com/Roman-Supernova-PIT/environment/blob/main/snpit_system_config.yaml>`_
|
|
54
|
+
|
|
55
|
+
Notice that the first one includes the second one. In the standard Roman SNPIT docker image, these two files are present in the root directory (``/``).
|
|
56
|
+
|
|
57
|
+
Ideally, all config for every SNPIT application will be in this default config file, so we can all use the same config and be sure we know what we're doing. Of course, that's far too cumbersome for development, so during development you will want to make your own config file with just the things you need in it.
|
|
58
|
+
|
|
59
|
+
By convention, everything underneath the ``system`` top level key are the things that you might have to change when moving from one cluster to another cluster, but that don't change the behavior of the code. This includes paths for where to find things, configurations as to where the database is, login credentials, and the like. Everything that is _not_ under ``system`` should be things that define the behavior of your code. These are the things that are the same every you run on different inputs. It should _not_ include things like the specific images or diaobjects you're currently working on. Ideally, everything that's _not_ in system, if it stays the same, will give the same outputs on the same inputs when run anywhere.
|
|
60
|
+
|
|
61
|
+
Using Config
|
|
62
|
+
============
|
|
63
|
+
|
|
64
|
+
To use config, you first have to set the environment variable ``SNIPIT_CONFIG`` to the location of the top-level config file. If you're using the default config and working in the roman snpit docker image, you can do this with::
|
|
65
|
+
|
|
66
|
+
export SNPIT_CONFIG=/default_snpit_config.yaml
|
|
67
|
+
|
|
68
|
+
Then, in your code, to get access to the config, you can just run::
|
|
69
|
+
|
|
70
|
+
from snappl.config import Config
|
|
71
|
+
|
|
72
|
+
...
|
|
73
|
+
|
|
74
|
+
cfg = Config.get()
|
|
75
|
+
tmpdir = Config.value( 'system.paths.temp_dir` )
|
|
76
|
+
|
|
77
|
+
``Config.get()`` gets you a config object. Then, just call that object's ``value`` method to get the actual config values. Separate different levels of dictionaries in the config with periods, as in the example. (Look at ``default_snpit_config.yaml`` to see how the config file corresponds to the value in the example above.)
|
|
78
|
+
|
|
79
|
+
There are more complicated uses of Config (including reading different, custom config files, modifying the config at runtime, understanding how the config files and all the possible modes of including other files are composed). Read the docstring on ``snappl.config.Config`` for more information.
|
|
80
|
+
|
|
81
|
+
Overriding Parameters on the Command Line
|
|
82
|
+
-----------------------------------------
|
|
83
|
+
|
|
84
|
+
At runtime, if you set things up properly, you can override some of the parameters from the config file with command-line arguments. To accomplish this, you must be using python's ``argparse`` package. When you're ready to parse your arguments, write the following code::
|
|
85
|
+
|
|
86
|
+
configparser = argarse.ArgumentParser( add_help=False )
|
|
87
|
+
configparser.add_argument( '-c', '--config-file', default=None,
|
|
88
|
+
help=( "Location of the .yaml config file; defaults to the value of the "
|
|
89
|
+
"SNPIT_CONFIG environment varaible." ) )
|
|
90
|
+
args, leftovers = configparser.parse_known_args()
|
|
91
|
+
|
|
92
|
+
try:
|
|
93
|
+
cfg = Config.get( args.config_file, setdefault=True )
|
|
94
|
+
except RuntimeError as e:
|
|
95
|
+
if str(e) == 'No default config defined yet; run Config.init(configfile)':
|
|
96
|
+
sys.stderr.write( "Error, no configuration file defined.\n"
|
|
97
|
+
"Either run <your application name> with -c <configfile>\n"
|
|
98
|
+
"or set the SNPIT_CONFIG environment variable.\n" )
|
|
99
|
+
sys.exit(1)
|
|
100
|
+
else:
|
|
101
|
+
raise
|
|
102
|
+
|
|
103
|
+
parser = argparse.ArgumentParser()
|
|
104
|
+
# Put in the config_file argument, even though it will never be found, so it shows up in help
|
|
105
|
+
parser.add_argument( '-c', '--config-file', help="Location of the .yaml config file" )
|
|
106
|
+
|
|
107
|
+
After that, put all of the ``parser.add_argument`` lines that you need for the command-line arguments to your code. Then, at the bottom, after you're done with all of your ``parser.add_argument`` calls, put in the code::
|
|
108
|
+
|
|
109
|
+
cfg.augment_argparse( parser )
|
|
110
|
+
args = parser.parse_args( leftovers )
|
|
111
|
+
cfg.parse_args( args )
|
|
112
|
+
|
|
113
|
+
At this point in your code, you can get access to the command line arguments you specified with the ``args`` variable as usual. However, the running config (that you get with ``Config.get()``) will _also_ have been updated with any changes made on the command line.
|
|
114
|
+
|
|
115
|
+
If you've set your code up like this, run it with ``--help``. You will see the help on the arguments you defined, but you will also see optional arguments for everything that is in the config file.
|
|
116
|
+
|
|
117
|
+
TODO : make it so you can only include some of the top-level keys from the config file in what gets overridden on the command line, to avoid things getting far too cluttered with irrelevant options.
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
.. _provenance:
|
|
121
|
+
|
|
122
|
+
----------
|
|
123
|
+
Provenance
|
|
124
|
+
----------
|
|
125
|
+
|
|
126
|
+
Everything stored in the internal Roman SNPIT database has a *Provenance* associated with it. The purpose of Provenance is twofold:
|
|
127
|
+
|
|
128
|
+
* It allows us to store multiple versions of the same thing in the database. (E.g., suppose you wanted to build a lightcurve for an object using two different configurations of your photometry software. If the database just stored "the lightcurve for this object", it wouldn't be possible to store both. However, in this case, the two lightcurves would have different provenances, so both can be stored.)
|
|
129
|
+
|
|
130
|
+
* It keeps track of the code and the configuration used to create the thing stored in the database. Ideally, this includes all of the parameters (see below) for the code, in addition to the code and code version, as well as (optionally) information about the environment in which the code should be run, such that we could reproduce the output files by running the same code with the same configuration again.
|
|
131
|
+
|
|
132
|
+
A provenance is defined by:
|
|
133
|
+
|
|
134
|
+
* The ``process`` : this is usually the name of the code that produced the thing saved to the database.
|
|
135
|
+
* The ``major`` and ``minor`` version of the process; Roman SNPIT code should use `semantic versioning <https://semver.org>`_.
|
|
136
|
+
* ``params``, The parameters of the process (see below)
|
|
137
|
+
* Optionally: the ``environment``, and ``env_major`` and ``env_minor``, the major and minor versions of the environment. (By default, these three are all None.)
|
|
138
|
+
* ``upstreams``, the immediate upstream provenances (see below).
|
|
139
|
+
|
|
140
|
+
An id is generated from the provenance based on a hash of all the information in the provenance, available in the ``id`` property of a Provenance object. This id is a ``UUID`` (sort of), and will be something ugly like ``f76f39a2-edcf-4e31-ba6b-e3d4335cc972``. Crucially, every time you create a provenance with all the same information, you will always get exactly the same id.
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
.. _provenance_tags:
|
|
144
|
+
|
|
145
|
+
Provenance Tags
|
|
146
|
+
===============
|
|
147
|
+
|
|
148
|
+
Provenances hold all the necessary information, and as such are cumbersome. Provenance IDs are 128-bit numbers, and are not very human readable. For this reason, we have *provenance tags*, which are human readable, and also allow us to collect together the provenances of a bunch of different processes into a coherent set of data products.
|
|
149
|
+
|
|
150
|
+
A provenance tag is defined by a human-readable string ``tag``, and by the ``process`` (which is the same as the ``process`` of a Provenance.) For a given (``tag``, ``process``) pair, there can only be one Provenance. That means that you can uniquely define a Provenance by its tag and its process.
|
|
151
|
+
|
|
152
|
+
We should be careful not to create tags willy-nilly. Ideally, we will have a small number of provenance tags in the database that correspond to sets of runs through the entire pipeline.
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
Getting Provenances from the Database
|
|
156
|
+
=====================================
|
|
157
|
+
|
|
158
|
+
If, somehow, you got your hands on a ``provenance_id`` (the ugly 128-bit number), and you want to get the full ``Provenance`` object for it, you can accomplish that with::
|
|
159
|
+
|
|
160
|
+
from snappl.provenance import Provenance
|
|
161
|
+
|
|
162
|
+
prov = Provenance.get_by_id( provenance_id )
|
|
163
|
+
|
|
164
|
+
You will find provenance ids in the ``provenance_id`` field of things you pulled out of the database. For example, if you have a ``DiaObject`` object (call it ``obj``) that you got with ``DiaObject.get_object`` or ``DiaObject.find_objects``, then you can find the id of the provenance of that DiaObject in ``obj.provenance_id``.
|
|
165
|
+
|
|
166
|
+
If, instead, you know (e.g. because the user passed this on the command line) that you want to work on the objects that we have chosen to tag with the provenance tag ``realtime``, and the process ``rapid_alerts`` (for instance, these may be objects we learned about from the RAPID alert stream), then you could get the provenance with::
|
|
167
|
+
|
|
168
|
+
prov = Provenance.get_provs_for_tag( 'realtime', 'rapid_alerts' )
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
.. _provenance_parameters:
|
|
172
|
+
|
|
173
|
+
Parameters
|
|
174
|
+
==========
|
|
175
|
+
|
|
176
|
+
The ``params`` field of a Provenance is a dictionary that should include everything necessary for the specified version of your code to produce the same output on the same input. It should *not* include things like input filenames. The idea is that the *same* Provenance will apply to everything that is part of a given run. Only when you are changing the configuration, or when you are getting input files from an earlier part of the pipeline, should the Provenance change.
|
|
177
|
+
|
|
178
|
+
If you are using the :ref:`config` system, and you've put all of these parameters (but no system-specific, like base paths, and no input files) in the config ``yaml`` file, then you can get a suitable ``params`` with::
|
|
179
|
+
|
|
180
|
+
cfg = Config.get()
|
|
181
|
+
params = cfg.dump_to_dict_for_params( keepkeys=[ 'photometry.phrosty' ], omitkeys=None )
|
|
182
|
+
|
|
183
|
+
The list in ``keepkeys`` are the keys (including the full substructure below that key) from the config that you want to include in the dictionary. This allows you to select out the parts of the config that are relevant to your code. ``system`` and anything starting with ``system.`` should never be in ``keepkeys``.
|
|
184
|
+
|
|
185
|
+
.. _provenance_upstreams:
|
|
186
|
+
|
|
187
|
+
Upstreams
|
|
188
|
+
=========
|
|
189
|
+
|
|
190
|
+
The upstream provenances are the ones that created the input files you use. For example, campari has three basic types of inputs: a *diaobject*, the supernova it's running on; a *diaobject_position*, an updated position of the object; and *images*, the images it's fitting its model to. Thus, it would have three upstream provenances, one for each of these things.
|
|
191
|
+
|
|
192
|
+
It can figure out these upstreams by just looking at the ``provenance_id`` field of the objects its using. Again, for example, campari will have (somehow) obtained a ``snappl.diaobject.DiaObject`` object; call that ``diaobj``. It can get the diaobject provenance by just looking at ``diaobj.provenance_id``. (To actually get the full Provenance object from the id, run ``snappl.provenance.Provenance.get_by_id( provenance_id )``.)
|
|
193
|
+
|
|
194
|
+
Upstreams is part of the provenance because even if you run your code with all the same parameters, if you're taking input files that were from a differently configured process earlier in the pipline, you expect different outputs. Upstreams basically specify which sorts of input files are valid for this provenance.
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
Creating a Provenance
|
|
198
|
+
=====================
|
|
199
|
+
|
|
200
|
+
Just create a provenance with::
|
|
201
|
+
|
|
202
|
+
from snappl.provenance import Provenance
|
|
203
|
+
|
|
204
|
+
prov = Provenance( process, major, minor, params=<params>, upstreams=<upstreams> )
|
|
205
|
+
|
|
206
|
+
In this call, ``process`` is a string, ``major`` and ``minor`` are integers, ``params`` is a dictionary (see :ref:`provenance_parameters`), and ``upstreams`` is a list of ``Provenance`` objects (see :ref:`provenance_upstreams`).
|
|
207
|
+
|
|
208
|
+
If this is a totally new Provenance— you've never made it before— then save it to the database with::
|
|
209
|
+
|
|
210
|
+
prov.save_to_db( tag=<tag> )
|
|
211
|
+
|
|
212
|
+
Here, ``<tag>`` is the :ref:`provenance tag <provenance_tags>` that you want to tag this provenance with. If the provenance already exists in the database, or if another provenance from the same process is already tagged with this tag, you will get an error. If the provenance you're trying to save already exists, that's fine; it won't resave it, it will just notice that it's there. So, this is safe to call even if you aren't sure if you've saved it before or not. If, for some reason, you really want this to be a new provenance, add ``exists=False`` to the call. In that case, if the provenance already exists, an exception will be raised.
|
|
213
|
+
|
|
214
|
+
.. _test_env:
|
|
215
|
+
|
|
216
|
+
--------------------------------
|
|
217
|
+
The Roman SNPIT Test Environment
|
|
218
|
+
--------------------------------
|
|
219
|
+
|
|
220
|
+
(This is currently a bit of a mess, and I haven't figured out how to get this to work on Perlmutter. However, if you're on a desktop or laptop with an ``x86_64`` architecture, then you should be able to get this running on your machine using Docker. Read all the comments at the top of `this file in the environment repo <https://github.com/Roman-Supernova-PIT/environment/blob/main/test-docker-environment/docker-compose.yaml>`_.)
|
|
@@ -36,7 +36,7 @@ dependencies = [
|
|
|
36
36
|
"python-dateutil>=2.9.0.post0,<3.0.0",
|
|
37
37
|
"pytz>=2025.2",
|
|
38
38
|
"pyyaml>=6.0.3,<7.0.0",
|
|
39
|
-
"rkwebutil>=2.
|
|
39
|
+
"rkwebutil>=2.4.0,<3.0.0",
|
|
40
40
|
"roman-datamodels>=0.27.0,<0.28.0",
|
|
41
41
|
"scipy>=1.16.2,<2.0.0",
|
|
42
42
|
"simplejson>=3.20.2,<4.0.0"
|
{roman_snpit_snappl-0.16.0 → roman_snpit_snappl-0.18.0/roman_snpit_snappl.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: roman_snpit_snappl
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.18.0
|
|
4
4
|
Summary: General, database, and photometry utilities for the Roman SNPIT
|
|
5
5
|
Author: Roman Supernova Project Infrastructure Team
|
|
6
6
|
Maintainer-email: Roman SN PIT <raknop@lbl.gov>
|
|
@@ -22,7 +22,7 @@ Requires-Dist: pycryptodome<4.0.0,>=3.23.0
|
|
|
22
22
|
Requires-Dist: python-dateutil<3.0.0,>=2.9.0.post0
|
|
23
23
|
Requires-Dist: pytz>=2025.2
|
|
24
24
|
Requires-Dist: pyyaml<7.0.0,>=6.0.3
|
|
25
|
-
Requires-Dist: rkwebutil<3.0.0,>=2.
|
|
25
|
+
Requires-Dist: rkwebutil<3.0.0,>=2.4.0
|
|
26
26
|
Requires-Dist: roman-datamodels<0.28.0,>=0.27.0
|
|
27
27
|
Requires-Dist: scipy<2.0.0,>=1.16.2
|
|
28
28
|
Requires-Dist: simplejson<4.0.0,>=3.20.2
|