Plonk

Plonk: Smoothed particle hydrodynamics analysis and visualization with Python - Published in JOSS (2019)

https://github.com/dmentipl/plonk

Science Score: 98.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 11 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org, zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

astronomy python smoothed-particle-hydrodynamics visualization

Scientific Fields

Mathematics Computer Science - 84% confidence
Last synced: 4 months ago · JSON representation ·

Repository

Smoothed particle hydrodynamics analysis and visualization with Python.

Basic Info
  • Host: GitHub
  • Owner: dmentipl
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 30.9 MB
Statistics
  • Stars: 39
  • Watchers: 2
  • Forks: 12
  • Open Issues: 7
  • Releases: 19
Topics
astronomy python smoothed-particle-hydrodynamics visualization
Created almost 7 years ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog Contributing License Citation

README.md

Plonk

Smoothed particle hydrodynamics analysis and visualization with Python.

Build Status Coverage Status Documentation Status

PyPI conda-forge License

JOSS Zenodo

Description

Plonk is a Python tool for analysis and visualization of smoothed particle hydrodynamics data with a focus on astrophysical fluid dynamics.

With Plonk we aim to integrate the high quality SPH visualisation of Splash into the modern Python astronomer workflow, and provide a framework for analysis of smoothed particle hydrodynamics simulation data.

Usage

Plonk supports the following SPH file formats:

Note: you can convert Phantom non-HDF5 snapshots to HDF5. See the Phantom docs.

Accessing data

To read in a simulation with snapshot files like disc_00000.h5, and global quantity time series files like disc01.ev, in the current directory, and see what snapshots there are:

```python

import plonk

simulation = plonk.loadsim(prefix='disc') simulation.snaps [<plonk.Snap "disc00000.h5">, ... ] ```

You can load individual snapshots and access the particle arrays:

```python

snap = plonk.loadsnap(filename='disc00030.h5') snap['position'] array([[-3.69505001e+12, 7.42032967e+12, -7.45096980e+11], ..., [ 1.21421196e+12, 2.08618956e+13, 1.12998892e+12]]) ```

The Snap objects contain the particle arrays, lazily loaded from the HDF5 file, as well as simulation metadata properties stored as a dictionary.

Visualization

To visualize the column density on a snapshot:

```python

snap.image(quantity='density') ```

For a more complicated example, here is the deviation from Keplerian velocity around a planet embedded in a protoplanetary disc.

Planet embedded in protoplanetary disc

Deviation from Keplerian velocity around a planet: at the disc midplane (left), and 10 (middle) and 20 au (right) above the disc midplane. See here for details.

Analysis

Extra quantities not written to the snapshot file are available:

```python

snap['angular_momentum'] array([ ... ]) ```

You can generate radial profiles on the snapshot. For example, to calculate the scale height in a disc:

```python

prof = plonk.load_profile(snap)

prof['scale_height'] array([ ... ]) ```

Physical units of array quantities and other properties allow for unit conversion:

```python

pos = snap['position'][0] pos array([-3.69505001e+12, 7.42032967e+12, -7.45096980e+11])

pos.to('au') array([-24.6998837 , 49.60184016, -4.98066567]) ```

You can get a subset of particles as a SubSnap.

```python

subsnap = snap[:1000] subsnap = snap[snap['x'] > 0] subsnap = snap.family('gas') ```

More

For further usage, see documentation. The code is internally documented with docstrings. Try, for example, help(plonk.Snap) or help(plonk.load_snap).

Install

Conda

You can install Plonk via the package manager Conda from conda-forge.

bash conda install plonk --channel conda-forge

This will install the required dependencies.

Note: You can simply use conda install plonk if you add the conda-forge channel with conda config --add channels conda-forge. I also recommend strictly using conda-forge which you can do with conda config --set channel_priority true. Both of these commands modify the Conda configuration file ~/.condarc.

pip

You can also install Plonk from PyPI via pip.

bash python -m pip install plonk

This should install the required dependencies.

Source

You can install Plonk from source as follows.

```bash

clone via HTTPS

git clone https://github.com/dmentipl/plonk.git

or clone via SSH

git clone git@github.com:dmentipl/plonk

cd plonk python -m pip install -e . ```

This assumes you have already installed the dependencies. One way to do this is by setting up a conda environment. The environment.yml file provided sets up a conda environment "plonk" for using or developing Plonk.

bash conda env create --file environment.yml conda activate plonk

Requirements

Python 3.6+ with h5py, matplotlib, numba, numpy, pandas, pint, scipy, toml. Installing Plonk with conda or pip will install these dependencies.

Getting help

If you need help, please try the following:

  1. Check the documentation.
  2. Check the built-in help, e.g. help(plonk.load_snap).
  3. Raise an issue, as a bug report or feature request, using the issue tracker.

Please don't be afraid to raise an issue. Even if your issue is not a bug, it's nice to have the question and answer available in a public forum so we can all learn from it together.

If you don't get an immediate response, please be patient. Plonk is maintained by one person, @dmentipl.

Contributing

All types of contributions are welcome from all types of people with different skill levels.

Thank you for considering contributing to Plonk. There are many ways to contribute:

  1. If you find any bugs or cannot work out how to do something, please file a bug report in the issue tracker. Even if the issue is not a bug it may be that there is a lack of documentation.
  2. If you have any suggestions for new features, please raise a feature request in the issue tracker.
  3. If you use Plonk to do anything please consider contributing to the examples section in particular, or any other section, of the documentation.
  4. If you would like to contribute code, firstly thank you! We take code contributions via pull request.

See CONTRIBUTING.md for detailed guidelines on how to contribute.

Citation

If you use Plonk in a scientific publication, please cite the paper published in JOSS.

Plonk: Smoothed particle hydrodynamics analysis and visualization with Python

A BibTeX entry is available in CITATION.bib

If you use the interpolation to pixel grid component of Plonk please cite the Splash paper. You should also consider citing any other scientific software packages that you use.

Change log

The change log is available in CHANGELOG.md

Owner

  • Name: Daniel Mentiplay
  • Login: dmentipl
  • Kind: user
  • Location: Melbourne, Australia
  • Company: Bureau of Meteorology

Scientific software engineer at the Bureau of Meteorology and former astrophysicist

JOSS Publication

Plonk: Smoothed particle hydrodynamics analysis and visualization with Python
Published
December 01, 2019
Volume 4, Issue 44, Page 1884
Authors
Daniel Mentiplay ORCID
School of Physics and Astronomy, Monash University
Editor
Dan Foreman-Mackey ORCID
Tags
astronomy smoothed particle hydrodynamics visualization

Citation (CITATION.bib)

@ARTICLE{2019JOSS....4.1884M,
       author = {{Mentiplay}, Daniel},
        title = "{Plonk: Smoothed particle hydrodynamics analysis and visualization with Python}",
      journal = {The Journal of Open Source Software},
         year = "2019",
        month = "Dec",
       volume = {4},
       number = {44},
        pages = {1884},
          doi = {10.21105/joss.01884},
}

GitHub Events

Total
  • Watch event: 4
  • Pull request event: 3
  • Fork event: 2
Last Year
  • Watch event: 4
  • Pull request event: 3
  • Fork event: 2

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 1,041
  • Total Committers: 2
  • Avg Commits per committer: 520.5
  • Development Distribution Score (DDS): 0.001
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Daniel Mentiplay d****y@g****m 1,040
Matthew Turk m****k@g****m 1

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 29
  • Total pull requests: 17
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 4 months
  • Total issue authors: 12
  • Total pull request authors: 4
  • Average comments per issue: 2.59
  • Average comments per pull request: 0.35
  • Merged pull requests: 13
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: about 15 hours
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • dmentipl (12)
  • joshcalcino (2)
  • benedettaveronesi (2)
  • bjnorfolk (2)
  • Faride-Dm (2)
  • cjfontec (2)
  • AdamFenton (2)
  • becnealon (1)
  • matthewturk (1)
  • cpinte (1)
  • zingale (1)
  • rieder (1)
Pull Request Authors
  • dmentipl (12)
  • operagxsasha (2)
  • joshcalcino (2)
  • matthewturk (1)
Top Labels
Issue Labels
enhancement (8) bug (7) help wanted (2) good first issue (1) wontfix (1)
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 103 last-month
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 1
    (may contain duplicates)
  • Total versions: 34
  • Total maintainers: 1
pypi.org: plonk

Smoothed particle hydrodynamics analysis and visualization with Python.

  • Versions: 18
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 103 Last month
Rankings
Dependent packages count: 10.1%
Forks count: 10.9%
Stargazers count: 11.1%
Average: 14.5%
Downloads: 19.0%
Dependent repos count: 21.6%
Maintainers (1)
Last synced: 4 months ago
conda-forge.org: plonk

Smoothed particle hydrodynamics analysis and visualization with Python.

  • Versions: 16
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 34.0%
Stargazers count: 41.7%
Forks count: 42.2%
Average: 42.3%
Dependent packages count: 51.2%
Last synced: 4 months ago

Dependencies

docs/requirements.txt pypi
  • h5py *
  • matplotlib *
  • myst-parser *
  • numba *
  • numpy *
  • pandas *
  • pint >=0.10.1
  • pydata-sphinx-theme *
  • scipy *
  • toml *
.github/workflows/tests.yml actions
  • actions/checkout v2 composite
environment.yml conda
  • black
  • coverage
  • doc8
  • ffmpeg
  • flake8
  • h5py
  • ipython
  • isort >=5.0
  • jupyterlab
  • matplotlib
  • mypy
  • myst-parser
  • numba
  • numpy
  • pandas
  • pint >=0.10.1
  • pip
  • pydata-sphinx-theme
  • pydocstyle
  • pylint
  • pytest
  • python >=3.6
  • scikit-image >=0.16
  • scipy
  • sphinx
  • toml
  • tqdm
  • twine
pyproject.toml pypi
setup.py pypi