Giter Site home page Giter Site logo

initialmassfunctions.jl's Introduction

InitialMassFunctions.jl

Build Status codecov Aqua QA

Stellar initial mass functions describe the distribution of initial masses that stars are born with. This package aims to implement and provide interfaces for working with initial mass functions, including but not limited to evaluating and sampling from published distributions. See the linked documentation above for more details.

Published IMFs we include are

Salpeter1955(mmin::Real=0.4, mmax::Real=Inf)
Chabrier2001BPL(mmin::Real=0.08, mmax::Real=Inf)
Chabrier2001LogNormal(mmin::Real=0.08, mmax::Real=Inf)
Chabrier2003(mmin::Real=0.08, mmax::Real=Inf)
Chabrier2003System(mmin::Real=0.08, mmax::Real=Inf)
Kroupa2001(mmin::Real=0.08, mmax::Real=Inf)

These all return subtypes of Distributions.ContinuousUnivariateDistribution and have many of the typical methods from Distributions.jl defined for them. These include

  • pdf, logpdf
  • cdf, ccdf
  • quantile(d, x::Real), quantile(d,x::AbstractArray), quantile!(y::AbstractArray, d, x::AbstractArray)
  • rand
  • minimum, maximum, extrema
  • mean, median, var, skewness, kurtosis (some of the higher moments don't work for mmax=Inf with instances of BrokenPowerLaw)

Note that var, skewness, and kurtosis are not currently defined for instances of LogNormalBPL, such as those returned by the Chabrier2003 function.

Many other functions that work on Distributions.ContinuousUnivariateDistribution will also work transparently on these AbstractIMF instances.

Continuous broken-power-law distributions (such as those used in Chabrier 2001 and Kroupa 2001) are provided through a new BrokenPowerLaw type. The lognormal distribution for masses m<1.0 with a power law extension for higher masses as given in Chabrier 2003 is provided by a new LogNormalBPL type. Simpler models (e.g., Salpeter1955 and Chabrier2001LogNormal) are implemented using built-in distributions from Distributions.jl in concert with their truncated function.

Efficient samplers are implemented for the new types BrokenPowerLaw and LogNormalBPL such that batched calls (e.g., rand(Chabrier2003(),1000)) are more efficient than single calls (e.g., d=Chabrier2003(); [rand(d) for i in 1:1000]). These samplers can be created explicitly by calling Distributions.sampler(d), with d being a BrokenPowerLaw or LogNormalBPL instance.

Versioning

InitialMassFunctions.jl follows Julia's recommended versioning strategy, where breaking changes prior to version 1.0 will result in a bump of the minor version (e.g., 0.1.x |> 0.2.0) whereas feature additions and bug patches will increment the patch version (0.1.0 |> 0.1.1).

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.