Metadata-Version: 2.4
Name: pyramis
Version: 0.1.15
Summary: Python Reader for Adaptive Mesh Interface Simulations
Author-email: San Han <san.han@iap.fr>
License: MIT License
        
        Copyright (c) 2025 San Han
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Repository, https://github.com/sanhancluster/pyramis
Keywords: ramses
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: h5py>=3.11.0
Requires-Dist: numpy>=1.26.4
Requires-Dist: scipy>=1.13.1
Requires-Dist: scikit-image>=0.21.0
Requires-Dist: platformdirs>=2.0.0
Dynamic: license-file

# Pyramis: Python Reader for Adaptive Mesh Interface Simulations
A python library, to provide essential and efficient framework for management and analysis of the adaptive mesh simulation such as [RAMSES](https://github.com/ramses-organisation/ramses).

## Installing
### Using pip
```bash
pip install pyramis
```
### Using developement mode
```bash
git clone https://github.com/sanhancluster/pyramis
cd pyramis
pip install -e .
```

## How to use
### Reading RAMSES raw data
pyramis uses multi-threading (concurrent.futures.ThreadPoolExecutor) by default for reading RAMSES simulation data. Number of workers will be automatically decided by the available resources when the package is imported.
#### The particle data
You can read particle data directly from specific region by following commands.
```python
import pyramis as pr
ramses_path = '/path/to/ramses/' # path to the directory where output_* are located
region = [[0.4, 0.6], [0.4, 0.6], [0.4, 0.6]] # targeting box in code unit
part = pr.ramses.read_part(ramses_path, iout=1, region=region) # reads output_00001
print(f"Total particle mass within the box is {np.sum(part['m'])}") # in code unit
``` 
For a particular type of particles, ```part_type``` option can be used
```python
part = pr.ramses.read_part(ramses_path, iout=1, part_type='star')
```
#### The cell data
You can read all cells from specific region by following commands.
```python
ramses_path = '/path/to/ramses/' # path to the directory where output_* are located
region = [[0.4, 0.6], [0.4, 0.6], [0.4, 0.6]] # targeting box in code unit
cell = pr.ramses.read_cell(ramses_path, iout=1, region=region)
print(f"Mean gas density within the box is {np.mean(cell['rho'])}") # in code unit
```

### Reading RAMSES HDF format data
#### The particle and cell data
HDF format requires particle type to be specified.
```python
hdf_path = '/path/to/hdf/' # path to the directory where part_*.h5, cell_*.h5 are located
region = [[0.4, 0.6], [0.4, 0.6], [0.4, 0.6]] # targeting box in code unit
part = pr.hdf.read_part(hdf_path, part_type='star', iout=1, region=region)
cell = pr.hdf.read_cell(hdf_path, iout=1, region=region)
```

### Reading HaloMaker data
#### DM Halo and Galaxy Catalog
```python
halomaker_path = '/path/to/halos/' # path the directory where tree_bricks* are located
halo = pr.halo_finder.read_halomaker(halomaker_path, iout=1)
galaxy = pr.halo_finder.read_halomaker(galaxymaker_path, iout=1, galaxy=True)
```
