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

Realization from Galacticus output #43

Merged
merged 19 commits into from
Sep 21, 2023

Conversation

cgannonucm
Copy link
Contributor

Implements the ability to create a realization from a Galacticus output file.

  • TNFWFromParams (class)
  • DMFromGalacticus (method)
  • pyHalo/Halo/galacticus_util (Utilities for working with Galacticus output)

Copy link
Owner

@dangilman dangilman left a comment

Choose a reason for hiding this comment

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

Hi @cgannonucm, looks like a reasonable implementation to me! I left a few comments just on the new Halo class for now.

First, since some of the methods are identical to the other TNFW halo class I think you should have this class be a subclass of TNFW, i.e. TNFWFromParams(TNFW) instead of TNFWFromParams(Halo). That way you don't have to copy the same method into different classes. Note that you will have override some methods in the new class, in particular the params_physical calculation, calculating the concentration, and the lenstronomy_params method.

On the last point, you'll need to compute theta_Rs and Rs_angle directly from params physical rather than using the mass and concentration. You can use the methods in lens_cosmo for this


y = y_kpc / self._kpc_per_arcsec_at_z

self._params_physical = args
Copy link
Owner

Choose a reason for hiding this comment

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

In general args might have other parameters besides the physical parameters describing the NFW profile. Can you extract only the parameters you need from args to define self._params_physical?

x = r / r_s
tau = r_t / r_s

n = 0
Copy link
Owner

Choose a reason for hiding this comment

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

why n=0?

Copy link
Contributor Author

@cgannonucm cgannonucm Sep 7, 2023

Choose a reason for hiding this comment

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

Good catch, this was left in from when I was running some checks. Will remove.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

n should be 1

"""
if not hasattr(self, '_kwargs_lenstronomy'):
[concentration, rt] = self.profile_args
Rs_angle, theta_Rs = self._lens_cosmo.nfw_physical2angle(self.mass, concentration, self.z)
Copy link
Owner

Choose a reason for hiding this comment

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

This method will have to change to compute Rs_angle and theta_Rs directly from self._params_physical

…dels/TNFWFromParams

Other changes
- General improvements to code / documentation
- Changed the way subhalo coordinates are projected
@dangilman
Copy link
Owner

Hi @cgannonucm, looks good to me. For some reason your pull request doesn't trigger tests and the coveralls run, I'm not sure why. In the meantime, it looks like there are some merge conflicts with the main branch that need to be resolved. In particular, the preset model functions are now all distributed in their files in the PresetModels class folder -- you can put this one in the external.py file. Maybe if you fix the merge conflicts it will trigger the tests and coverage runs.....

@cgannonucm
Copy link
Contributor Author

Hi @dangilman This branch and the main branch should be merged now, and all conflicts resolved.

@dangilman
Copy link
Owner

@cgannonucm thanks! It looks like there is a problem with one of the test functions for a different method that is causing the tests to fail, would you mind fixing it so that the coverage and tests run? You just have to change the function names in the import statement of test_realization_extensions.py from _xi_l, _xi_l_to_Pk_l to "xi_l" and "xi_l_to_Pk_l". Then it should work

@cgannonucm
Copy link
Contributor Author

@dangilman Done. The tests should run now.

Copy link
Owner

@dangilman dangilman left a comment

Choose a reason for hiding this comment

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

Looks great, thanks @cgannonucm !

@dangilman dangilman merged commit 30d2665 into dangilman:master Sep 21, 2023
1 check passed
@cgannonucm cgannonucm deleted the import_galacticus_subhalos branch September 24, 2023 08:47
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.

2 participants