Installation
The package can be installed with:
pip install light-gen
You will need the following dependencies:
numpy
astropy
h5py
multiprocessing
glob
logging
seaborn
scipy
pandas
Usage
Using the code to generate lightcones from IllustrisTNG simulations. This code is easily adaptable to other N-body simulations too. For instructions see the example notebooks provided in the notebooks folder and also see the template script.
The code needs you to point to the sim_data_dir folder, where all the snapshots and FoF and Subfind group catalogues are provided (based on hdf5). You can download them from the official TNG website here. The sim_data_dir directory structure must be as follows.
IllustrisTNG/
|-snapdir_98
| |-snap_98.0.hdf5
| |-snap_98.1.hdf5
| `-snap_98.599.hdf5
|-snapdir_97
| |-snap_97.0.hdf5
| |-snap_97.1.hdf5
| `-snap_97.599.hdf5
`-snapdir_78
|-snap_78.0.hdf5
|-snap_78.1.hdf5
`-snap_78.599.hdf5
And for the group catalogues:
IllustrisTNG/
|-groups_98
| |-fof_subhalo_tab_98.0.hdf5
| |-fof_subhalo_tab_98.1.hdf5
| `-fof_subhalo_tab_98.599.hdf5
|-groups_97
| |-fof_subhalo_tab_97.0.hdf5
| |-fof_subhalo_tab_97.1.hdf5
| `-fof_subhalo_tab_97.599.hdf5
`-groups_96
|-fof_subhalo_tab_96.0.hdf5
|-fof_subhalo_tab_96.1.hdf5
`-fof_subhalo_tab_96.599.hdf5
Where each snapdir_XX and group_XX refers to a single TNG snapshot, and each snapshot can be divided into multiple chunck files (going from 0 to 500).
Examples
The follows notebooks run you through the main concepts and implementations of this code:
01_remapping_IllustrisTNG_boxes: introduced the remapping of cuboids to construct lightcones.02_get_lightcone_geometry: implements theget_geometry.pyto get the lightcone opening angles for an given observer at the edges of the lightcone.03_get_lightcone_and_central_satellities: generates lightcone shell files for individual subshells (subhalos, halos, bhs, etc) and also classified subhalos into centrals and satellites04_applying_rotations_to_lightcone: tutorial on rotations in 3D and how you can apply it to your lightcone to center the observer on the y-z plane (x-axis is Line of Sight)
Script: main.py
You can directly run main.py after passing the sim_data_dir with the appropriate data structure within as follows.
python3 main.py 0 1 gas /path/to/sim_data_dir
This would transform the coordinates for one chunk file (there are 600/snapshot) and save the transformed coordinates in your out_data_dir path. For group (FoF halos), bh (black holes), and Subhalo (from SUBFIND) the first two int arguments specify the entire snapshots (not chuncks as done for gas and dm).
Authors
This package has been developed by Soumya Shreeram, with contributions from: Johan Comparat.
This package uses the remap.py and list7.txt files for cuboid remapping implementation, which is downloaded from http://mwhite.berkeley.edu/BoxRemap/. Additionally, see "Embedding realistic surveys in simulations through volume remapping", J. Carlson and M. White, ApJS 190(2010)311. (preprint available at arxiv:1003.3178).
Contact
If you have any question, suggestion, or need help with the code (e.g., extending to other simulations with different data formats), don't hesitate to contact the author.
Citation
If you use this code for you work, please cite the following two related papers:
- Shreeram et al. 2025a: https://www.aanda.org/articles/aa/abs/2025/05/aa52271-24/aa52271-24.html (also available or arXiv: https://arxiv.org/abs/2409.10397).
- J. Carlson and M. White, ApJS 190(2010)311. (preprint available at arxiv:1003.3178).
Metadata
Release files for light-gen 0.0.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| light-gen-0.0.12.tar.gz | 19.5 kB | Without provenance | Details for light-gen-0.0.12.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| light_gen-0.0.12-py3-none-any.whl | Python 3 | none | any | Details for light_gen-0.0.12-py3-none-any.whl |
Total release size: 45.6 kB
Release files / light-gen-0.0.12.tar.gz
| Download URL | light-gen-0.0.12.tar.gz |
|---|---|
| Size | 19.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
83a3cfae0abc16326cf5cd42bc7e9b04aacfcb8842d3073c6a9eaea9abb95c9d
|
|
BLAKE2b-256 checksum How to use checksums |
8ffcb00f9ad14aeb6000116b76ca3543162fc6579b40e116e69a21f469ea9bec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.18
|
Release files / light_gen-0.0.12-py3-none-any.whl
| Download URL | light_gen-0.0.12-py3-none-any.whl |
|---|---|
| Size | 26.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c32774e01926c88a9d069219b15b47cf562949f43ce987f48bac42eeab8e36b3
|
|
BLAKE2b-256 checksum How to use checksums |
61baea2be96bd0ee3728c69a62d3058d1e0fba79a9eb582d7832ada80de97cf5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.18
|
Security for light-gen 0.0.12
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.