Giter VIP home page Giter VIP logo

imf's Introduction

IMF

Simple tools to work with the Initial Mass Function

Some basic examples below.

  1. Make a simple 1000 Msun cluster sampled from the default Kroupa IMF:

    cluster = imf.make_cluster(1000)
    

    or from a Salpeter IMF:

    cluster = imf.make_cluster(1000, massfunc='salpeter')
    
  2. Create a sample of clusters to do some analysis of later. This will make clusters with masses Gaussian-distributed around a given mean mass in the list of cluster_masses, so that you could then do things like estimate the typical luminosity of a cluster for a given mass:

    from imf import imf from astropy.utils.console import ProgressBar cluster_masses = [100, 1000, 10000] nclusters_per_bin = 30 clusters = np.array([[imf.make_cluster(mass*(np.random.randn()/20.+1.), silent=True)

    for ii in range(nclusters_per_bin)] for mass in ProgressBar(cluster_masses)])

  3. Calculate the mass fraction represented by M>8 Msun stars in a Kroupa IMF when the maximum mass is 200 Msun:

    kroupa = imf.Kroupa()
    
    mmax = 200
    cutoff1 = 8
    
    over8fraction = (kroupa.m_integrate(cutoff1, mmax)[0] /
                     kroupa.m_integrate(kroupa.mmin, mmax)[0])
    
  4. This figure was made with examples/imf_figure.py

examples/plots/imf.png
Credits:
  • Adam Ginsburg (@keflavich, wrote most of this)
  • Sergey Koposov (@segasai, majorly refactored the distribution functions)
  • Tiffany Christian (@teachristian, made some small corrections)

No formal citation is available yet; please just reference the repository (https://github.com/keflavich/imf) if you use this.

Bitdeli badge

imf's People

Contributors

keflavich avatar segasai avatar teachristian avatar adamginsburg avatar bitdeli-chef 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.