Skip to main content

A population synthesis code

Project description

CI codecov Codacy Badge Documentation Status DOI PyPI PyPI - Downloads status

popsynth

alt text

popsynth core function is to create observed surveys from latent population models.

First, let's define what a population of objects is in terms of a generative model. The two main ingredients are the objects' spatial distribution () and the distribution of their inherent properties (). Here, are the latent population parameters, are the spatial locations of the objects, and are the properties of the individual objects (luminosity, spin, viewing angle, mass, etc.). The spatial distribution is defined such that:

is the intensity of objects for a given set of population parameters. With these definitions we can define the probability for an object to have position and properties as

popsynth allows you to specify these spatial and property distributions in an object-oriented way to create surveys. The final ingredient to creating a sample for a survey is knowing how many objects to sample from the population (before any selection effects are applied). Often, we see this number in simulation frameworks presented as "we draw N objects to guarantee we have enough." This is incorrect. A survey takes place over a given period of time () in which observed objects are counted. This is a description of a Poisson process. Thus, the number of objects in a simulation of this survey is a draw from a Poisson distribution:

Thus, popsynth first numerically integrates the spatial distribution to determine the Poisson rate parameter for the given $\vec{\psi}$, then makes a Poisson draw for the number of objects in the population survey. For each object, positions and properties are drawn with arbitrary dependencies between them. Finally, selection functions are applied to either latent or observed (with or without measurement error) properties.

Note: If instead we draw a preset number of objects, as is done in many astrophysical population simulation frameworks, it is equivalent to running a survey up until that specific number of objects is detected. This process is distributed as a negative binomial process, i.e, wait for a number of successes and requires a different statistical framework to compare models to data.

Installation

pip install popsynth

Note: This is not synth pop! If you were looking for some hard driving beats out of a yamaha keyboard with bells... look elsewhere

alt text

Contributing

Contributions to popsynth are always welcome. They can come in the form of:

Bug reports

Please use the Github issue tracking system for any bugs, for questions, and or feature requests.

Code and more distributions

While it is easy to create custom distributions in your local setup, if you would like to add them to popsynth directly, go ahead. Please include tests to ensure that your contributions are compatible with the code and can be maintained in the long term.

Documentation

Additions or examples, tutorials, or better explanations are always welcome. To ensure that the documentation builds with the current version of the software, I am using jupytext to write the documentation in Markdown. These are automatically converted to and executed as jupyter notebooks when changes are pushed to Github.

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

popsynth-1.0.5.tar.gz (77.6 kB view details)

Uploaded Source

Built Distribution

popsynth-1.0.5-py3-none-any.whl (78.9 kB view details)

Uploaded Python 3

File details

Details for the file popsynth-1.0.5.tar.gz.

File metadata

  • Download URL: popsynth-1.0.5.tar.gz
  • Upload date:
  • Size: 77.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for popsynth-1.0.5.tar.gz
Algorithm Hash digest
SHA256 2498074f73f3bb323257f8dcb1276378b5017c327e000cb29c085d4f19bba9c3
MD5 8f2446ecb1f844b5863c96dba47d6a28
BLAKE2b-256 4385ef0b6affa7fd084b9b6a46daf725d2bf18c55043d8049765a6c92dcf416e

See more details on using hashes here.

File details

Details for the file popsynth-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: popsynth-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 78.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for popsynth-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 613c33cff815dd545951dd28380c9100a0ab5ad9b50e690ee6c37b0d822b653e
MD5 14e87b92c1a9d335839270c09e96c2c6
BLAKE2b-256 aad362cef9512eee0b5d63c7cb2ed0deab0663cf2e8e35d2949d93f1c9abeb6a

See more details on using hashes here.

Supported by

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