Skip to content

Meta PR: Extensible Cosmology - #10673

Closed
nstarman wants to merge 1 commit into
astropy:mainfrom
nstarman:cosmo_refactor
Closed

nstarman wants to merge 1 commit into
astropy:mainfrom
nstarman:cosmo_refactor

Conversation

@nstarman

@nstarman nstarman commented Aug 23, 2020 •

Copy link
Copy Markdown
Member

What this PR does already and how it should be split into smaller PRs for review. In no particular order:

  1. upgrade default_cosmology to be a registry (a la galactocentric_frame_defaults) so users can add their own cosmology realizations and set them as the default.

4.1 Add entrypoints to the realizations, so that third-party packages can add specific cosmology realizations and users can access them straight through astropy.

4.2 Also allow auto-import of user-defined realizations from a file(s).

  1. Enhance the Cosmology class so it initializes the default cosmology, with any user-passed modifications. This centralizes the cosmology creation process for any "perturbations" about the default cosmology. Finally a use for the base class.

  2. [Not in this PR] Add entrypoints to core, where the Cosmology classes are defined, so that third-party packages can add cosmologies and have them integrate well with the realizations machinery.

At the end, astropy will provide a core set of cosmology classes and realizations, but be highly extensible to allow user-defined realizations, and aggregate third-party cosmologies and realizations.

This PR might also might partially alleviate the lack-of-maintainer problem. Instead of programming more Cosmology classes, we let third-party packages demonstrate user need. If a Cosmology class becomes stable & popular enough then it could be added as a built-in.


migrated to #11777 since this will never be a Pr

@pllim

pllim commented Aug 24, 2020

Copy link
Copy Markdown
Member

I am not sure if we have a cosmology maintainer who has time to review a +1,727 −576 PR. 👀

@nstarman

nstarman commented Aug 24, 2020 via email •

Copy link
Copy Markdown
Member Author

@nstarman
nstarman force-pushed the cosmo_refactor branch 3 times, most recently from 4537419 to ea493fe Compare August 24, 2020 03:03
@nstarman
nstarman force-pushed the cosmo_refactor branch 2 times, most recently from 1ce02fb to d934aaa Compare September 2, 2020 15:12
@nstarman

nstarman commented Sep 2, 2020

Copy link
Copy Markdown
Member Author

@pllim. Can you add a milestone, even if it's 6.0, so I can try to achieve all passing checks.

@pllim pllim added this to the v5.0 milestone Sep 2, 2020
@pllim

pllim commented Sep 2, 2020

Copy link
Copy Markdown
Member

Done. @nstarman , for future reference, to ensure your work is not wasted, it is preferable to discuss your development plan for something that takes significant effort (such as refactoring a subpackage) with the core maintainers first before doing the work. Not all PRs are merged for a reason or another. Thanks for your effort!

@nstarman

nstarman commented Sep 2, 2020 •

Copy link
Copy Markdown
Member Author

Thanks!

Completely fair and I definitely should have done that. I had most of this code done for personal research and sitting around since last summer. I just added some of the cleanup from #10624 before submitting this PR.

Most of this PR is just moving code from core to builtin. It's a much smaller set of changes than it appears.

@nstarman

nstarman commented Sep 3, 2020 •

Copy link
Copy Markdown
Member Author

@pllim What's the best way to reach out? There are a number of convenience functions, such as to calculate z matter-radiation equality, that I would like to add (as a separate PR from this one).

@pllim

pllim commented Sep 3, 2020

Copy link
Copy Markdown
Member

There are a few channels listed at https://www.astropy.org/help.html . Maybe try the "developer email list"?

@nstarman

nstarman commented Sep 4, 2020

Copy link
Copy Markdown
Member Author

For this PR, whom can I contact or with whom can I work?

@pllim

pllim commented Sep 4, 2020

Copy link
Copy Markdown
Member

😬

@nstarman
nstarman marked this pull request as draft September 30, 2020 19:46
@nstarman nstarman changed the title Refactor Cosmology Extensible Cosmology Dec 1, 2020
@embray

embray commented Apr 6, 2021

Copy link
Copy Markdown
Member

I think there should also be a way to provide new cosmology realizations without having to do anything with entrypoints. I'm not really up on how this works currently though (I used to be but I haven't looked at it in a looong time).

@nstarman

nstarman commented Apr 6, 2021 •

Copy link
Copy Markdown
Member Author

I think there should also be a way to provide new cosmology realizations without having to do anything with entrypoints. I'm not really up on how this works currently though (I used to be but I haven't looked at it in a looong time).

@embray
I certainly agree. In PR 3 I have

Also add a configuration parameter for a list of locations of JSON files of cosmology realizations to make along with the built-in options at import, allowing for users to set a directory of custom cosmo realizations.

On further thought, I'm kind of leaning towards an ECSV instead of JSON because of the built-in unit and metadata support and the cool possibility of converting an MCMC chain to an ECSV file and built able to work with sets of cosmology realizations. Also, I think the astropy config folder would be a good place to auto-import user-provided realizations. Anything else would be done by the user.

I would love to implement this... #11345 is the first step... 🚀

builtin cosmology entrypoints
codecov
RTD and CircleCI fixes
fix typo in test_builtin
change handing of read-only states
update milestone

Signed-off-by: Nathaniel Starkman <[email protected]>
@nstarman nstarman changed the title Extensible Cosmology Meta PR: Extensible Cosmology Apr 13, 2021
This was referenced Apr 14, 2021
@nstarman nstarman mentioned this pull request May 23, 2021
2 of 7 tasks
@nstarman nstarman closed this May 23, 2021
@nstarman
nstarman deleted the cosmo_refactor branch May 23, 2021 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants