<commit_before>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:

- **c_Duffy(z,m)**: which is based on [Duffy et al. (2008)](http://arxiv.org/abs/0804.2486)

- **c_Prada(z,m)**: which is based on [Prada et al. (2012)](http://arxiv.org/abs/1104.5130)

- **c_DuttonMaccio(z,m)**: from
[Dutton & Maccio (2014)](http://arxiv.org/abs/1402.7073)


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

```python

#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)
<commit_msg>more formatting edits in README<commit_after>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:

- **c_Duffy(z,m)**: which is based on [Duffy et al. (2008)](http://arxiv.org/abs/0804.2486)

- **c_Prada(z,m)**: which is based on [Prada et al. (2012)](http://arxiv.org/abs/1104.5130)

- **c_DuttonMaccio(z,m)**: from
[Dutton & Maccio (2014)](http://arxiv.org/abs/1402.7073)


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

```python

#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)

{'fraction_non_alphanumeric': 0.09167616875712657, 'fraction_numerical': 0.03785632839224629, 'mean_word_length': 4.375, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '432247', 'n_tokens_mistral': 1464, 'n_tokens_neox': 1336, 'n_words': 631}