Skip to content

parameters specify their cosmology - #11530

Merged
adrn merged 2 commits into
astropy:mainfrom
nstarman:cosmo_params_specify_cosmo
Apr 14, 2021
Merged

adrn merged 2 commits into
astropy:mainfrom
nstarman:cosmo_params_specify_cosmo

Conversation

@nstarman

@nstarman nstarman commented Apr 12, 2021 •

Copy link
Copy Markdown
Member

Description

Rather than assuming that the parameters are for a FlatLamdaCDM cosmology, they now specify the cosmology. This is needed for the planned functions to I/O cosmologies from/to JSON and ECSV files.

Part of #10673
Needed for #11517, #11542

Signed-off-by: Nathaniel Starkman (@nstarman) <[email protected]>
par = getattr(parameters, key)
if par["flat"]:

if par["cosmology"] == "FlatLambdaCDM":

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this need a test?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sure! ... of what sort? like that all our built-in ones are "FlatLambdaCDM"? I think there's currently an implicit test because the suite should fail on the raised warning if cosmology != FlatLambdaCDM.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just a little surprised that this change didn't result in any test updates.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ahh. currently all of them are FlatLambdaCDM and the code was doing a sanity check with the parameter "flat". Specifying the cosmology obviates that need.
Here, or in a followup, I would like to do a consistency check on ALL the key-value pairs in the parameter dictionary, because not everything is being used. That would be a good place to check that for cosmology=FlatLambdaCDM, flat is either True or not present (because not needed).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I do think a test is good... I just don't know what I would test ATM! 😆

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@adrn... bringing it on! 😆

@pllim pllim added this to the v4.3 milestone Apr 12, 2021

@mhvk mhvk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks good to me!

@mhvk

mhvk commented Apr 14, 2021

Copy link
Copy Markdown
Contributor

(I won't merge to give @adrn a chance to have a quick look, but really this just makes sense.)

Signed-off-by: Nathaniel Starkman (@nstarman) <[email protected]>
@nstarman
nstarman force-pushed the cosmo_params_specify_cosmo branch from 993ff56 to 4dc2cb3 Compare April 14, 2021 03:23
@nstarman nstarman mentioned this pull request Apr 14, 2021

@adrn adrn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OK yes this seems like a good idea! Thanks @nstarman

@adrn
adrn merged commit 8f75b61 into astropy:main Apr 14, 2021
@nstarman
nstarman deleted the cosmo_params_specify_cosmo branch April 14, 2021 17:39
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.

4 participants