Giter VIP home page Giter VIP logo

cofm's Introduction

Concentration-Mass relations

This python code calculates halo concentration, given halo mass and redshift.

I plan to add more c(M) relations from the literature (and you are more than welcome to contribute your favorite relation), but for now, there are three c(M) relations included as functions in this module:

How to use this code

These functions require, at minimum, a single redshift and a mass, for which to calculate halo concentration. Mass is defined as M200 (the total mass interior to a sphere within which the average density is 200 times the critical energy density of the universe) and must be given in units of solar mass.

Lists or numpy arrays of redshift and/or mass can also be passed to the function. If an array-like quantity is passed for either of the input parameters, than the other parameter must be:

  1. an array-like variable of the same length, OR
  2. a single floating point value (or array of length one).

In the first case, each element of redshift is matched up with the corresponding element of mass, returning an array of concentration values that has the same length. In the second case, the single float value will be applied to each element of the array, returning an array of concentration values of the same length as the multi-element array given as input. Inputing 2 multi-element arrays of different lengths will raise an error.

Examples

#import one or all of the functions
from cofm import c_Duffy, c_Prada, c_DuttonMaccio

#for a single z and mass
print c_Duffy(0.1,3e14)
print c_Prada(0.1,3e14)
print c_DuttonMaccio(0.1,3e14)

#for several z and a single mass
z = [0.1,0.3,0.5,0.7]
m = 1e14
print c_Prada(z,m)
print c_DuttonMaccio(z,m)

#a different mass for each of the different z
m = [1e12,1e13,1e14,1e15]
print c_Prada(z,m)
print c_DuttonMaccio(z,m)
print c_Duffy(z,m)

cofm's People

Watchers

 avatar

Forkers

iw381

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.