Giter Site home page Giter Site logo

grburgess / popsynth Goto Github PK

View Code? Open in Web Editor NEW
14.0 2.0 5.0 127.08 MB

A generic flux/parameter population synthesis code

Home Page: https://popsynth.readthedocs.io/en/latest/?badge=latest

License: GNU General Public License v3.0

Python 98.09% Stan 0.79% TeX 1.12%
population simulation statistics population-synthesis astrophysics astronomy

popsynth's Introduction

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.

popsynth's People

Contributors

cescalara avatar codacy-badger avatar eschoesser avatar grburgess avatar xuanxu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.