Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Add concentration, radius, Delta_Sigma functions to halos module #467

Open
wants to merge 1 commit into
base: module/halos
Choose a base branch
from

Conversation

sutieng
Copy link
Contributor

@sutieng sutieng commented May 28, 2021

Description

This implements several functions to derive the halo concentration, scale radius, the spherical overdensity radius and the excess surface density for halos module.

Checklist

  • Follow the Contributor Guidelines
  • Write unit tests
  • Write documentation strings
  • Assign someone from your working team to review this pull request
  • Assign someone from the infrastructure team to review this pull request

@ntessore
Copy link
Member

Hi Sutieng, thank you for your pull request. Could you please set up your git username and email correctly for GitHub? There is a description in the GitHub documentation.

Afterwards, you will need to fix the existing commits in this PR. The easiest that I can think of is resetting your commits without undoing any of the changes, then simply committing again, which will use the new username and email:

$ git reset --soft module/halos
$ git commit
$ git push --force

@sutieng
Copy link
Contributor Author

sutieng commented May 28, 2021

Thanks Nicolas! I've just set up the git email and re-pushed all the commits.

@rrjbca rrjbca changed the title Add concentration, radius, Delta_Sigma functions to halos module ENH: Add concentration, radius, Delta_Sigma functions to halos module Jun 14, 2021
Copy link
Member

@Lucia-Fonseca Lucia-Fonseca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!
Very nice and clear.
A few comments on:

  • Units with h (to check)
  • Docstrings
  • More tests?

Parameters
----------
mass : float or array_like
Spherical overdensity halo mass in units of solar mass/h, corresponding
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had a debate about the use of h in units. We finally decided to work in units without h.
Is this relevant for you here?

Spherical overdensity halo mass in units of solar mass/h, corresponding
to the mass definition, mdef.
mdef : str
Halo mass definition for spherical overdensities used by colossus.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which are the options to choose from? Is it worth adding them here?

Returns
-------
concentration : float or array_like
Halo concentration(s); has the same dimensions as mass.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Units?

Comment on lines +250 to +251
r'''Calculate the scale radius and the spherical overdensity radius of halo by assuming
the NFW model.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
r'''Calculate the scale radius and the spherical overdensity radius of halo by assuming
the NFW model.
r'''Halo radii with the NFW model.

return c


def radius(mass, concentration, redshift, mdef, Delta, cosmology, sigma8, ns):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this function name descriptive enough? what about radii_NFW or anything better??

mdef : str
Halo mass definition for spherical overdensities used by colossus.
radius : float or array_like
Radius in physical kpc/h.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above re: discussion about units and h.

def test_colossus_concentration():
from skypy.halos._colossus import concentration
from astropy.cosmology import Planck15

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add a comment here, briefly explaining what this test is doing.
For example:

    # Check concentration array matches mass length

or similar

def test_colossus_radius():
from skypy.halos._colossus import radius
from astropy.cosmology import Planck15

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a short comment explaining.

def test_colossus_Delta_Sigma():
from skypy.halos._colossus import Delta_Sigma
from astropy.cosmology import Planck15

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment


DeltaSigma = Delta_Sigma(mass, c, redshift, mdef, radius, cosmo, sigma8, ns)

assert len(DeltaSigma) == len(radius)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, is there anything else we can test here? Corner cases? Does any of this follow a formula for certain parameters...?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants