Skip to content

Lightcone photometry (SED false-colour imaging), camera/export/flythrough fixes - #38

Merged
MBradley1985 merged 8 commits into
mainfrom
dev
Jul 30, 2026
Merged

Lightcone photometry (SED false-colour imaging), camera/export/flythrough fixes#38
MBradley1985 merged 8 commits into
mainfrom
dev

Conversation

@MBradley1985

Copy link
Copy Markdown
Owner

Summary

A large batch of Lightcone / synthetic-photometry work.

Photometry (SED) — now a false-colour image builder on its own layer

  • Replaces the Box tab with a Photometry tab in Lightcone Mode; a genuinely separate galaxy-splat layer with its own Visible/Opacity — show it with the galaxies on, off, or on its own.
  • Multi-select filter stack (ticks), each filter tinted a representative colour by wavelength; mass-to-light entries stack too. Proper Lupton-style false-colour composite (flux ratios → hue, asinh brightness) so galaxies read visibly blue/red/yellow instead of washing to white.
  • Every galaxy with light renders (hue and brightness decoupled); dim galaxies are transparent (per-point alpha) so no dark blobs; nested shells for splat definition.

SED synthesis options (LightSAGE run stage) — metallicity (per-galaxy mass-weighted Z, on), dust (Calzetti attenuation, off), and dust emission (Draine & Li IR re-emission, off — makes WISE physical). Also on the visage-sed CLI.

Lightcone camera — reset zooms in / horizontal / end-to-end; go-to-centre stands at the observer looking outward; fixed galaxies popping in/out on rotate/pan.

Other — Load Existing Lightcone button; catalogue export supports lightcones (Whole Lightcone scope, carries SED columns); lightcone output → sage_outputs/lightcone/; flythrough first-group approach sped up; ./bin/visage runs the checkout (PYTHONPATH) with a version banner; session-model registry prunes dead entries; pinned/fenced black so commits stop bouncing. Docs + CHANGELOG updated throughout.

Test plan

  • pytest — 96 passed
  • ruff check / black --check clean; pre-commit hooks pass
  • Verified against the real lightcone on the actual scene plotter: photometry renders, ~99% coloured, all galaxies drawn, dust reddens g-r, dust-emission raises far-IR flux ~170×, camera behaviours correct

…through

Structure panel:
- SED section is now fully independent of the GALAXIES section (own
  colormap + colourbar state), so changing one no longer mirrors into the
  other. Both colour the single galaxy layer; last-touched wins. Fixes the
  bug where SED colormap changes sometimes didn't apply (band switches were
  resetting a just-picked colormap via the shared state).
- SED section gains a Visible checkbox and loads with a band selected +
  applied instead of a blank dropdown, matching the other sections.
- Colourbar limit labels lightened (#6b7280 -> #a3adbb) for legibility.

Lightcone camera:
- Reset/default view zooms in to fill the viewport width (was fitting the
  bounding sphere to the shorter axis, leaving the cone a tiny sliver),
  kept horizontal and centred end to end.
- Go-to-centre now stands at the observer (origin) looking outward along
  the cone, sky spread horizontally, instead of box-centre math.

Catalogue export:
- Reads a flat cli_lightcone file directly (no Snap_N group), carrying its
  synthetic-photometry columns through, and adds a "Whole Lightcone" scope
  (default in Lightcone Mode).

Flythrough:
- Lightcone first move is distance-scaled to fly at Box Mode's linear
  speed, so the zoom into the first group is no longer an abrupt swoop.
…cher fixes

Photometry (SED) is now a genuinely separate galaxy-splat layer, shown in a
dedicated Photometry tab that replaces the Box tab in Lightcone Mode:
- Its own Visible/Opacity, fully independent of the galaxies — show it with
  the galaxies on, off, or on its own. Hidden by default; enabling it hides
  the normal galaxies by default (and disabling restores them) so the image
  reads cleanly.
- A false-colour image built from a multi-select STACK of filters, each
  tinted a representative colour by wavelength (u/UV violet, g green,
  r/i/z + JHK/WISE deepening reds); mass-to-light entries stack alongside.
  Drawn as nested gaussian shells for splat definition. Galaxies with no
  flux in the stack are skipped, so no black blobs. Colour-swatch legend.

Lightcone camera:
- go-to-observer focal point at the cone centre (was ~1 Mpc from the eye),
  fixing galaxies popping in/out of the clip planes on rotate/pan.
- reset/default view zooms to fill the width (cone was a tiny sliver).

Flythrough: first-group approach sped up a little in both modes.

Catalogue export: reads a flat lightcone file directly (carrying SED
columns) + a Whole Lightcone scope.

Launcher: ./bin/visage prepends the repo root to PYTHONPATH so it runs this
checkout rather than a pip-installed copy, and prints a path/version banner.
…ghtcone

Compositing: the stack was normalising each band independently, throwing away
the relative flux between bands, so combining filters washed to flat white.
Rewritten as a Lupton-style false-colour composite — work in flux, keep the
per-galaxy channel ratios (median-balanced, gamma + saturation boosted) as the
hue, asinh-stretch the luminance — so galaxies read visibly blue/red/yellow by
their real SED shape (~99% of lit pixels now coloured, none near-white).

Splats: retuned the photometry shells into a sharply peaked profile (small
opaque core inside smaller fainter haloes, outer halo well under Rvir) so each
galaxy is a crisp defined point rather than a soft blob.

Wizard: the LightSAGE scan step gains a Load Existing Lightcone button that
discovers cli_lightcone .h5 files in sage_outputs/lightcone (+ legacy dir +
recent session models) and opens one straight into Lightcone Mode — no
clone/build/run needed.

Removes the now-dead single-scalar SED colour helpers.
…plats

The dark spots were a rendering artifact, not the SED grid: ~22% of galaxies
are dim-but-drawn, and with flat alpha a dim foreground galaxy painted an
opaque dark disk over brighter galaxies behind it. Now each splat's alpha is
its own composite brightness, so faint galaxies are transparent (they can't
darken anything) while bright ones keep an opaque, defined core — additive
blending isn't usable here (VTK point-gaussian emissive only renders at
opacity 1.0). Retuned the nested shells tighter/smaller (down to 0.05*Rvir)
for a crisper, more defined point per the suggestion. Verified on the real
scene plotter (the earlier "RGBA doesn't render" was a test-harness bug that
passed the plotter into Scene's primary_par_path slot).
…city + dust options

Rendering / composite (Photometry layer):
- Every galaxy that has light now renders. ~28% were vanishing because the
  colour-contrast gamma also crushed the faint end of the luminance below the
  draw threshold. Hue (gamma + saturation) and brightness (raw luminance,
  asinh stretch with a floor) are now computed separately, so faint galaxies
  stay visible while the blue/red/yellow colour spread is unchanged.
- Dark spots fixed: each splat's alpha is its own brightness, so a dim
  foreground galaxy is transparent instead of an opaque dark disk over
  brighter ones behind it. Nested shells retuned tighter for more definition.

SED synthesis (LightSAGE run stage):
- Metallicity checkbox (SED_METALLICITY_ENABLED, on): use each galaxy's own
  mass-weighted stellar Z (MetalsStellarMass/StellarMass); off = solar.
- Dust checkbox (SED_DUST_ENABLED, off) + SED_DUST2: Calzetti starburst
  attenuation that reddens the SEDs. Both also on the visage-sed CLI
  (--no-metallicity / --dust / --dust2). Verified against real FSPS: dust
  reddens g-r, the metallicity toggle changes the colours.
The repo pins black 24.10.0 in pre-commit, but the black installed here is
26.5.1, and the two format the one `dedent("""…""")` block in app.py
differently — so a local `black` run and the commit hook kept reformatting
each other's output and every commit aborted with "files were modified by
this hook". (Bumping the pin to 26.5.1 isn't an option: its pytokens native
dep only ships an x86_64 wheel, which crashes the hook on Apple Silicon.)

Fenced that one block with `# fmt: off` / `# fmt: on` (bare directives on
their own lines) so no black version touches it. Both 24.10.0 and 26.5.1 now
leave app.py unchanged, and commits go through without bouncing.
…sical

Adds a Draine & Li (2007) dust-emission option that re-emits (energy-balanced,
per SSP) the energy the Calzetti attenuation removed. Exposed as an
SED_DUST_EMISSION_ENABLED checkbox in the run script (only forwarded when dust
attenuation is also on) and a --dust-emission CLI flag, threaded through
compute_photometry -> SSPGrid. Verified against real FSPS: with emission on,
the far-IR (5-100um) flux of an SSP rises ~170x, so WISE W1-W4 stop being the
caveated bands. Docs/comments updated accordingly.
- README Lightcone Mode: add the Photometry tab (false-colour image builder),
  observer/reset camera behaviour, and Load Existing Lightcone; note the
  [sed] optional install (FSPS + SPS_HOME).
- installation.md: document the optional [sed] extra and its FSPS/SPS_HOME
  requirement; add fsps/astropy to the dependency table.
- navigation.md: note the Box tab becomes Photometry in Lightcone Mode
  (cross-linked to lightcone.md).
- index.md: mention the synthetic-photometry imaging layer.
@MBradley1985
MBradley1985 merged commit 621b4d8 into main Jul 30, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant