Next.js website for the merged JWST GO-7935 EMERALD and GO-8018 DIVER collaboration.
It includes:
- Public program pages for overview, science goals, observing plan, team, and data policy.
- Password-protected portal pages for the target catalog, quick interactive spectrum viewer, redshift reports, and internal links.
- Science-projects page with Google Sheet integration.
- Interactive 1D spectrum viewing for DIVER PRISM, DIVER G140M/F070LP grating, and EMERALD G395M/F290LP grating data.
- Install dependencies.
- Copy
.env.exampleto.env.local. - Set required passwords and cookie secrets.
- Run the development server.
npm install
cp .env.example .env.local
npm run validate:data
npm run devIf Next.js build output gets into a bad local state, clean .next first:
npm run clean:next
npm run devRequired portal settings:
EMERALD_PORTAL_PASSWORDEMERALD_PORTAL_COOKIE_SECRET
Optional storage and media settings:
EMERALD_SIGNED_URL_TTL_SECONDSAWS_REGIONEMERALD_ASSET_BUCKETEMERALD_ASSET_PREFIXAWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_ENDPOINT_URLEMERALD_LOCAL_MEDIA_DIRNEXT_PUBLIC_BASE_PATH
If EMERALD_LOCAL_MEDIA_DIR is not set, production defaults to /data/emerald/media.
.env.local should stay gitignored.
npm run dev
npm run dev:clean
npm run build
npm run start
npm run lint
npm run typecheck
npm run validate:data
npm run test- Target catalog:
data/targets.csv - DIVER grating VI catalog:
data/DIVER_grating_vi.csv - Co-I list:
data/coi.yaml - Redshift submissions log:
data/redshift-submissions.ndjson - Science-project catalog:
lib/science-projects-catalog.ts
Default media roots:
- Local:
/Users/sunfengwu/jwst_cycle4/emerald_cy4/media/emerald_msa_ptg-2026 - Server:
/data/emerald/media
Important subdirectories:
diver_prism_plots/- PRISM PNG quicklooks
- PRISM
*_x1d.fits,*_x1d.json - PRISM
*_s2d.fits - PRISM joint line-fit JSON products
diver_grating_plots/- DIVER G140M PNG quicklooks
- DIVER
bundle_1d.csv - DIVER generated
__*_x1d.json
emerald_grating_plots/- EMERALD G395M PDF quicklooks
- EMERALD G395M PNG quicklooks converted from PDF
- EMERALD
*_x1d.fits,*_x1d.json - EMERALD
*_s2d.fits
jades_photometry/- JADES DR5 per-source CIRC and KRON CSV products
- EMERALD catalog targets default to instrument
G395M/F290LP. - Targets found in
DIVER_grating_vi.csvalso receive instrumentG140M/F070LP. - PRISM products add instrument
PRISM. - A source can carry more than one instrument label.
- Instrument status is tracked per observation mode, not only once per source.
- Emission-line tags are imported from the DIVER grating VI table, including
Continuum_detected. - Quick tags are derived from notes and standardized for selected categories such as AGN, DSFG, EMPG candidate, JADES-NIRSpec source, and literature UV emitters.
- The interactive viewer loads JSON-backed 1D spectra only, not FITS directly.
- DIVER G140M and EMERALD G395M JSON spectra are both stored in
f_lambdaunits (erg/s/cm^2/A) with wavelength inum. - EMERALD G395M hover previews in the catalog prefer PNG quicklooks; PDF files remain downloadable assets.
Interactive x1d plotting uses precomputed JSON cache files next to FITS files in:
<EMERALD_LOCAL_MEDIA_DIR>/diver_prism_plots/.
Run:
python3 scripts/build_prism_x1d_cache.py --media-dir /path/to/mediaExample on server:
python3 scripts/build_prism_x1d_cache.py --media-dir /data/emerald/mediaInteractive DIVER grating plotting uses precomputed JSON cache files next to CSV files in:
<EMERALD_LOCAL_MEDIA_DIR>/diver_grating_plots/.
Run:
python3 scripts/build_grating_x1d_cache.py --media-dir /path/to/mediaInteractive EMERALD G395M plotting uses precomputed JSON cache files next to FITS files in:
<EMERALD_LOCAL_MEDIA_DIR>/emerald_grating_plots/.
Run:
python3 scripts/build_emerald_g395m_x1d_cache.py --media-dir /path/to/mediaExample with the stenv conda environment:
/Users/sunfengwu/anaconda3/bin/conda run --no-capture-output -n stenv \
python scripts/build_emerald_g395m_x1d_cache.py --media-dir /data/emerald/mediaThe G395M/F290LP hover preview in the target catalog uses PNG previews derived from PDF quicklooks.
Run locally:
sh scripts/convert_emerald_g395m_pdfs_to_png.sh \
/Users/sunfengwu/jwst_cycle4/emerald_cy4/media/emerald_msa_ptg-2026/emerald_grating_plotsCurrent converter note:
- The script uses macOS
qlmanage.
- Live redshift reports are stored in
data/redshift-submissions.ndjson. - The portal target catalog and quick interactive viewer read the latest submitted redshift in real time.
- On the server, this file must remain writable by the service user.
Useful helper:
./zspec_to_local.shThe science-projects page is backed by Google Sheets for collaborative project entry and tracking.
Recommended before deployment:
npm run lint
npm run typecheck
npm run validate:data
npm run buildServer repo:
/data/emerald/emerald
Server media root:
/data/emerald/media
Systemd service:
emerald.service
Typical update flow:
cd /data/emerald/emerald
git pull origin main
npm run build
sudo systemctl restart emerald.serviceUseful checks:
systemctl is-active emerald.service
curl -IL https://magnif.as.arizona.edu/emerald/teamKnown permission issue:
- If build fails with
EACCESunder.next/diagnostics, fix ownership first:
sudo chown -R fsun:jades /data/emerald/emerald/.nextImportant runtime-writable file:
/data/emerald/emerald/data/redshift-submissions.ndjson
This should remain writable by the service user (emeraldsvc on server setups using the systemd service).