Skip to main content

Python Reader for Adaptive Mesh Interface Simulations

Project description

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.

Installing

Using pip

pip install pyramis

Using developement mode

git clone https://github.com/sanhancluster/pyramis
cd pyramis
pip install -e .

Using conda

To create new conda environment specifically for Pyramis,

git clone https://github.com/sanhancluster/pyramis
cd pyramis
conda env create -f environment.yml
conda activate pyramis
pip install -e .

If you want to install in an already existing environment,

git clone https://github.com/sanhancluster/pyramis
cd pyramis
conda activate myenv
conda env update -f environment.yml
pip install -e .

How to use

Reading RAMSES raw data

pyramis uses multi-threading (concurrent.futures.ThreadPoolExecutor) by default for reading RAMSES snapshot files. 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. Pyramis computes list of cpu domains to read the complete data witin the region using Peano-Hilbert space filling curve.

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.

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.

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

pyramis uses concurrent.futures.ProcessPoolExecutor by default to enable parallel read from HDF files. This requires main block guard for the top-level script.

The particle and cell data

if __name__ == '__main__':
    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)

Particle type (part_type) need to be always present for reading particle data.

Reading Dyablo cell data

dyablo_path = '/path/to/dyablo/'
pr.dyablo.read_cell(dyablo_path, istep=0)

Reading HaloMaker data

DM Halo and Galaxy Catalog

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyramis-0.1.16.tar.gz (56.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyramis-0.1.16-py3-none-any.whl (61.3 kB view details)

Uploaded Python 3

File details

Details for the file pyramis-0.1.16.tar.gz.

File metadata

  • Download URL: pyramis-0.1.16.tar.gz
  • Upload date:
  • Size: 56.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for pyramis-0.1.16.tar.gz
Algorithm Hash digest
SHA256 087066a6647d3e9d1ba3c2801173f63000696641988f61650a845e5f7e6736fc
MD5 7909d4a77f316356d6b7a7ebbfe74e91
BLAKE2b-256 f04fc09f5fd285a32eb852e8347593e44db600e7377bae32848062fb28a0dab9

See more details on using hashes here.

File details

Details for the file pyramis-0.1.16-py3-none-any.whl.

File metadata

  • Download URL: pyramis-0.1.16-py3-none-any.whl
  • Upload date:
  • Size: 61.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for pyramis-0.1.16-py3-none-any.whl
Algorithm Hash digest
SHA256 debd76edc2d2b15d73f257859dfa1e487cd03d0e7e84a74b25a586a78e368f61
MD5 ef74d462ec27f94207d9f598d3de0138
BLAKE2b-256 237c3e90147cf44dc0b32b9d223ca1a8e458a6e27d137c5d016a7e8c18f9d5aa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page