Skip to main content

Stretched Equal Area Generator

Project description

SEAGen

A python implementation of the stretched equal area (SEA) algorithm for generating spherically symmetric arrangements of particles with accurate particle densities, e.g. for SPH initial conditions that precisely match an arbitrary density profile, as presented in Kegerreis et al. (2019), MNRAS 487:4, 5029-5040, https://doi.org/10.1093/mnras/stz1606.

Jacob Kegerreis (2019) jacob.kegerreis@durham.ac.uk
Josh Borrow

Visit https://github.com/jkeger/seagen to download the code including examples and for support.

This program has been tested for a wide range of cases but not exhaustively. If you find any bugs, potential improvements, or features worth adding, then please let us know!

Contents

  • seagen.py The main program classes and functions.
  • examples.py Examples to demonstrate how to use the SEAGen module.
  • setup.py, setup.cfg, __init__.py, MANIFEST.in Python package files.
  • LICENSE.txt GNU general public license v3+.

Basic Usage

  • See the doc strings in seagen.py for all the details.
  • Create a single shell of particles and print their positions:
    import seagen
    N = 100
    r = 1
    
    particles = seagen.GenShell(N, r)
    
    print(particles.x, particles.y, particles.z)
    
  • Create a full sphere of particles on a simple density profile and print their positions and masses:
    import seagen
    import numpy as np
    N = 100000
    radii = np.arange(0.01, 10, 0.01)
    densities = np.ones(len(radii))     # e.g. constant density
    
    particles = seagen.GenSphere(N, radii, densities)
    
    print(particles.x, particles.y, particles.z, particles.m)
    
  • See examples.py for other working examples, e.g. an arbitrary density profile with multiple layers and extra temperature information.

Installation

  • PyPI: Automatically install the package with pip install seagen, see https://pypi.org/project/seagen/
  • Direct download: The single seagen.py file can be imported and used without any extra installation, so you can just download this repository and place the file in a local directory or wherever your python will look for modules.

Requirements

  • Python 3 (tested with 3.6.0).

Notation etc.

  • PEP8 is followed in most cases apart from some indentation alignment.
  • Arrays are explicitly labelled with a prefix A1_, or An_ for an n-dimensional array.
  • Particle is abbreviated to picle.

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

seagen-1.3.2.tar.gz (29.1 kB view details)

Uploaded Source

Built Distribution

seagen-1.3.2-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

Details for the file seagen-1.3.2.tar.gz.

File metadata

  • Download URL: seagen-1.3.2.tar.gz
  • Upload date:
  • Size: 29.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.5

File hashes

Hashes for seagen-1.3.2.tar.gz
Algorithm Hash digest
SHA256 e81bf36d876369e0961b82b39101a211f3b179cd065680cb75847907af8ea15f
MD5 2f2f85b7b5eb64a0e8f3c89e660e5172
BLAKE2b-256 bb09defdbc9686413d4749e8b3ffbbd8530db9e1230c34c45e0c92762a6b2e81

See more details on using hashes here.

File details

Details for the file seagen-1.3.2-py3-none-any.whl.

File metadata

  • Download URL: seagen-1.3.2-py3-none-any.whl
  • Upload date:
  • Size: 27.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.5

File hashes

Hashes for seagen-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ba40963cb61a1e6273292b21f0eaeabf1ef4801cb5a6834d0a4fd6a8d9ca72b8
MD5 17d4c4d602e72155d6bd691a8bfb088a
BLAKE2b-256 6450ae739c3a7ebdfa53a48045c40794ec01d6dadfa68a869722c0a96e5ab35a

See more details on using hashes here.

Supported by

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