Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions deploy_to_fornax_manifest.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ tutorials/spherex/spherex_source_discovery/spherex_source_discovery_tool/default
tutorials/spherex/spherex_source_discovery/spherex_source_discovery_tool/firefly_viz.py
tutorials/spherex/spherex_source_discovery/spherex_source_discovery_tool/sdt_utils.py
tutorials/spherex/spherex_source_discovery/spherex_source_discovery_tool/source_extraction.py
tutorials/spherex/spherex_spectrophotometry/build-spherex_spt-env.sh
tutorials/spherex/spherex_spectrophotometry/conda-spherex_spt.yml
tutorials/spherex/spherex_spectrophotometry/spherex_spectrophotometry_tool.md
tutorials/spherex/spherex_mosaic.md
tutorials/spherex/spherex_hipscube.md
tutorials/techniques-and-tools/cloud-access-intro.md
Expand Down
2 changes: 2 additions & 0 deletions ignore_tutorials/ignore_all_testing
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# Requires source extractor, which requires a conda install
tutorials/spherex/spherex_source_discovery/spherex_source_discovery_tool_demo.md
# Requires spherex-pipelines and tractor, which require a conda install
tutorials/spherex/spherex_spectrophotometry/spherex_spectrophotometry_tool.md
2 changes: 2 additions & 0 deletions ignore_tutorials/ignore_rendering_execution
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ tutorials/techniques-and-tools/Parallelize_Convolution
tutorials/wise/wise-allwise-catalog-demo
# Requires source extractor, which requires a conda install
tutorials/spherex/spherex_source_discovery/spherex_source_discovery_tool_demo
# Requires spherex-pipelines and tractor, which require a conda install
tutorials/spherex/spherex_spectrophotometry/spherex_spectrophotometry_tool
4 changes: 4 additions & 0 deletions notebook_metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@
file: tutorials/spherex/spherex_source_discovery/spherex_source_discovery_tool_demo.md
section: SPHEREx
description: Discover, extract, and visualize sources from SPHEREx Spectral Images.
- title: Spectrophotometry Tool
file: tutorials/spherex/spherex_spectrophotometry/spherex_spectrophotometry_tool.md
section: SPHEREx
description: Extract a SPHEREx spectrum for any sky position by running the Spectrophotometry Tool's forced photometry in Python.
- title: Spitzer IRS Spectra
file: tutorials/spitzer/plot_Spitzer_IRS_spectra.md
section: Spitzer
Expand Down
2 changes: 2 additions & 0 deletions toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ project:
file: tutorials/spherex/spherex_psf.md
- title: Source Discovery Tool
file: tutorials/spherex/spherex_source_discovery/spherex_source_discovery_tool_demo.md
- title: Spectrophotometry Tool
file: tutorials/spherex/spherex_spectrophotometry/spherex_spectrophotometry_tool.md
- title: Mosaic Cube
file: tutorials/spherex/spherex_mosaic.md
- title: HiPS All-Sky Cube
Expand Down
1 change: 1 addition & 0 deletions tutorials/spherex/spherex.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ tutorials/spherex/spherex_intro.md
tutorials/spherex/spherex_cutouts.md
tutorials/spherex/spherex_psf.md
tutorials/spherex/spherex_source_discovery/spherex_source_discovery_tool_demo.md
tutorials/spherex/spherex_spectrophotometry/spherex_spectrophotometry_tool.md
tutorials/spherex/spherex_mosaic.md
tutorials/spherex/spherex_hipscube.md
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Create a conda environment using conda-spherex_spt.yml, and an associated Jupyter kernel.
# Then install tractor-spherex and spherex-pipelines, which conda-spherex_spt.yml can't handle due to --no-build-isolation and --no-deps flags.
#
# Usage: ./build-spherex_spt-env.sh [args...]
# On Fornax, all arguments are passed through to setup-conda-env unchanged.
#
# If not running on Fornax, first create and activate the env, then run this script to install the rest. For example:
# conda env create -f conda-spherex_spt.yml
# conda activate spherex_spt
# python -m ipykernel install --name spherex_spt --user # optional: Jupyter kernel
# ./build-spherex_spt-env.sh

# Exit immediately if any command encounters a problem.
set -euo pipefail

# The Fornax command setup-conda-env (below) will name the env based on the filename syntax conda-{ENV_NAME}.yml.
# We expect conda-spherex_spt.yml, so the env name will be "spherex_spt".
ENV_NAME=spherex_spt

# If the command 'setup-conda-env' exists, we're on Fornax.
if command -v setup-conda-env >/dev/null; then
# Fornax: create the env and kernel based on conda-spherex_spt.yml.
setup-conda-env "$@" || exit $?

# Activate the env so we can use the numpy and swig libraries we've installed.
# setup-conda-env may have installed to $ENV_DIR or $USER_ENV_DIR, so check both.
env_path="$USER_ENV_DIR/$ENV_NAME"
[[ -d "$env_path" ]] || env_path="$ENV_DIR/$ENV_NAME"
eval "$(micromamba shell hook --shell bash)"
micromamba activate "$env_path"
else
# Elsewhere: expect the env from conda-spherex_spt.yml to already be active.
env_path="${CONDA_PREFIX:?activate the $ENV_NAME env first}"
fi

# Use uv pip if available (Fornax), else pip.
if command -v uv >/dev/null; then
pip_install=(uv pip install --python "$env_path")
else
pip_install=("$env_path/bin/python" -m pip install)
fi

# Install tractor-spherex (spherex-pipelines dependency).
# Use --no-build-isolation to use pre-installed numpy and swig (conda-spherex_spt.yml).
"${pip_install[@]}" --no-build-isolation git+https://github.com/Caltech-IPAC/tractor-spherex.git@066680f05b889c554f4dd30e8211ee957d66d56f

# Install spherex-pipelines (public tag 7.1.1+public.1).
# Without --no-deps it would try to install lsst_daf_butler[postgres], which brings in psycopg2, which requires a compiler.
# Instead, conda-spherex_spt.yml installs psycopg2-binary (and other spherex-pipelines dependencies) and we skip here using --no-deps.
# SETUPTOOLS_SCM_PRETEND_VERSION works around a known spherex-pipelines issue: setuptools_scm cannot parse
# public tags such as 7.1.1+public.1, so building from them fails. Remove it once a fix is released.
SETUPTOOLS_SCM_PRETEND_VERSION=7.1.1+public.1 \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am surprised that this hack is needed when you build from the hash only, but since it's spelt out to be just a temp workaround I suppose it is all OK.

OTOH, I wonder how we plan to notice a new release and what our process should be updating the notebook and associated files.

"${pip_install[@]}" --no-deps git+https://github.com/Caltech-IPAC/spherex-pipelines.git@2cd6ca41e5c204a0e1b3ecf803c666fcd052f469
49 changes: 49 additions & 0 deletions tutorials/spherex/spherex_spectrophotometry/conda-spherex_spt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Environment for SPHEREx notebooks.
# Additional installs are needed for Spectrophotometry Tool notebook (see build-spherex_spt-env.sh).
name: spherex_spt
channels:
- conda-forge
dependencies:
- python>=3.11.0,<=3.13 # >=3.11.0 required by spherex-pipelines. kete doesn't provide wheels for >3.13.
- pip
# ---- spherex-pipelines dependencies
- astrometry # must install astrometry before spherex-pipelines. Not available on PyPI.
- alive-progress
- astropy
- click>8.3.0 # pin required by spherex-pipelines.
- gwcs
- healpy>=1.17.1 # pin required by spherex-pipelines
- ipywidgets
- joblib
- matplotlib
- numba
- numpy
- parsl
- photutils
- psycopg2-binary # lsst_daf_butler needs psycopg2 but that requires a compiler. Use psycopg2-binary instead.
- pyarrow
- pydantic>=2.3,<3 # pin required by spherex-pipelines
- regions
- reproject
- scikit-image
- scikit-learn
- scipy>=1.6 # pin required by spherex-pipelines
- sep
- sqlalchemy
- spiceypy
- swig==4.4.1 # swig==4.5.0 breaks tractor-spherex install
- tenacity
- tqdm
# ---- Additional libraries used in Spectrophotometry Tool notebook
- astroquery
- pyvo
- specutils
- s3fs

- pip:
# ---- spherex-pipelines dependencies not available on conda-forge
- opencv-python-headless # required by tractor-spherex
- kete<2.0 # pin required by spherex-pipelines.
- lsst_ctrl_mpexec
- lsst_pipe_base
- lsst_daf_butler
Loading
Loading