From 5eafdb53618c2c0e8ed7d1ae64f1dfdf2f4a9243 Mon Sep 17 00:00:00 2001 From: John Helly Date: Sat, 25 Apr 2026 18:55:02 +0100 Subject: [PATCH 1/2] Show how to compute comoving distance --- source/lightcones/healpix_shell_redshifts.rst | 7 ++++ source/snapshots/swiftsimio.rst | 37 ++++++++++++++----- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/source/lightcones/healpix_shell_redshifts.rst b/source/lightcones/healpix_shell_redshifts.rst index 93c97f1..596e349 100644 --- a/source/lightcones/healpix_shell_redshifts.rst +++ b/source/lightcones/healpix_shell_redshifts.rst @@ -32,6 +32,13 @@ Each shell is defined by a minimum and maximum redshift, as shown below. All simulations use the same redshift shells except that shells beyond the maximum redshift are omitted. +.. note:: Not all of the FLAMINGO simulations use the same + cosmological parameters, so the relation between redshift + and comoving distance varies. If you need to translate + between redshift, distance and time in the cosmology of a + specific simulation, we recommend :ref:`using swiftsimio + `. + .. _shell_redshift_table: .. list-table:: diff --git a/source/snapshots/swiftsimio.rst b/source/snapshots/swiftsimio.rst index fbcde36..b674ec8 100644 --- a/source/snapshots/swiftsimio.rst +++ b/source/snapshots/swiftsimio.rst @@ -73,16 +73,7 @@ metadata. The simulation box size is available as:: snap.metadata.boxsize -If you need cosmology information, you can get an astropy `cosmology -object `__ -with:: - - cosmo = snap.metadata.cosmology - -This allows accurate calculation of the age of the universe or the -comoving distance at a particular redshift in the FLAMINGO cosmology, -for example. The numbers of particles of each type in the snapshot are -available as:: +The numbers of particles of each type in the snapshot are available as:: snap.metadata.n_gas snap.metadata.n_dark_matter @@ -111,6 +102,32 @@ See the `swiftsimio documentation `__ on snapshot metadata for more information. +.. _swiftsimio_cosmology: + +Cosmology +--------- + +If you need cosmology information, you can get an astropy `cosmology +object `__ +with:: + + cosmo = snap.metadata.cosmology + +This is the recommended way to translate between redshift, comoving +distance and lookback time in the FLAMINGO simulations. You can +compute the age of the universe at :math:`z = 0.5`, for example, +with:: + + age_of_universe = cosmo.age(0.5) + +or compute the comoving distance to the same redshift with:: + + comoving_distance = cosmo.comoving_distance(0.5) + +See the `astropy documentation +`__ for more +details. + Reading particle data --------------------- From 9d3d6bfa0b2f18ca40ca7a10cabbfa0fead6be10 Mon Sep 17 00:00:00 2001 From: John Helly Date: Sat, 25 Apr 2026 19:00:09 +0100 Subject: [PATCH 2/2] Link cosmology info from particle lightcone redshifts too --- source/lightcones/particle_lightcone_redshifts.rst | 5 ++++- source/snapshots/swiftsimio.rst | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/source/lightcones/particle_lightcone_redshifts.rst b/source/lightcones/particle_lightcone_redshifts.rst index 5bf8420..38a08db 100644 --- a/source/lightcones/particle_lightcone_redshifts.rst +++ b/source/lightcones/particle_lightcone_redshifts.rst @@ -3,7 +3,10 @@ Particle lightcone redshift ranges The tables below show the maximum redshift at which particles of each type are output in each of the FLAMINGO simulations. Where no redshift -is listed no lightcone particle data are available. +is listed no lightcone particle data are available. The corresponding +comoving distances vary depending on the cosmological parameters of +the simulation and can be :ref:`computed with swiftsimio +`. There are two thresholds for gas particles to be output. All gas particles are output up to the redshift specified in the "All gas" diff --git a/source/snapshots/swiftsimio.rst b/source/snapshots/swiftsimio.rst index b674ec8..bb0a38a 100644 --- a/source/snapshots/swiftsimio.rst +++ b/source/snapshots/swiftsimio.rst @@ -108,8 +108,9 @@ Cosmology --------- If you need cosmology information, you can get an astropy `cosmology -object `__ -with:: +object `__ by +opening a snapshot as shown above, then accessing its cosmology +field:: cosmo = snap.metadata.cosmology