Metadata-Version: 2.4
Name: glass.ext.pkdgrav
Version: 0.3
Summary: GLASS extension for loading PKDGRAV simulations
Project-URL: Homepage, https://github.com/glass-dev/glass.ext.pkdgrav
Project-URL: Documentation, https://glass.readthedocs.io/projects/pkdgrav/
Project-URL: Issues, https://github.com/glass-dev/glass.ext.pkdgrav/issues
Author-email: Nicolas Tessore <n.tessore@ucl.ac.uk>
License: MIT License
License-File: LICENSE.txt
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Requires-Dist: glass>=2025.1
Requires-Dist: h5py
Requires-Dist: healpy
Requires-Dist: numpy
Requires-Dist: scipy
Provides-Extra: docs
Requires-Dist: furo; extra == 'docs'
Requires-Dist: numpydoc; extra == 'docs'
Requires-Dist: sphinx; extra == 'docs'
Requires-Dist: sphinxcontrib-katex; extra == 'docs'
Provides-Extra: test
Requires-Dist: pytest; extra == 'test'
Description-Content-Type: text/markdown

# GLASS extension for loading PKDGRAV simulations

This repository contains a GLASS extension for loading PKDGRAV simulations such
as the Gower St simulations.

## Installation

Install the package with pip into your GLASS environment:

    pip install glass.ext.pkdgrav

## Quick start

Load a PKDGRAV simulation by pointing the `glass.ext.pkdgrav.load()` function
to the simulation's `.par` file:

```py
sim = glass.ext.pkdgrav.load("gowerst/run014/control.par")
```

The resulting object has attributes such as `sim.parameters`, `sim.cosmology`,
and `sim.redshifts` that describe the simulation.

The matter shells can be read with the simulation-specific functions such as
`glass.ext.pkdgrav.read_gowerst(sim)`.

## Cosmology

The simulation cosmology is returned from the stored input file. No new
cosmological quantities are computed.

The returned cosmology object follows the Cosmology API standard. It can be
passed directly into GLASS functions that require it.

## Example

```py
import glass
import glass.ext.pkdgrav

# load simulation
sim = glass.ext.pkdgrav.load("gowerst/run014/control.par")

# get the simulated cosmology
cosmo = sim.cosmology

# get shells for the simulation
shells = glass.tophat_windows(sim.redshifts)

# nside for computation; could be sim.nside
nside = 1024

# more setup
...

# this will load a GowerSt simulation iteratively
# up to redshift 2 and rescaled to nside
matter = glass.ext.pkdgrav.read_gowerst(sim, zmax=2.0, nside=nside)

# this will compute the convergence field iteratively
convergence = glass.MultiPlaneConvergence(cosmo)

# load each delta map and process
for i, delta in enumerate(matter):

    # add lensing plane from the window function of this shell
    convergence.add_window(delta, shells[i])

    # process shell
    ...

```
