-
Notifications
You must be signed in to change notification settings - Fork 9
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
gh-504: deprecate old generator functions #523
Conversation
Sphinx error doesn't happen for me locally 😞 |
Marking as ready so examples are built, but not ready. |
Apparently, sphinx-autodoc-typehints is broken: tox-dev/sphinx-autodoc-typehints#523 |
Was literally just about to send that too |
I'll take over this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@paddyroddy this should be ready now!
@@ -199,44 +222,6 @@ def multalm( | |||
return out | |||
|
|||
|
|||
def transform_cls( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be deprecated before removal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't public API, it was exported by mistake.
Can't render the notebook diffs |
and introduces |
Although having a look gaussiancl depends on it anyway |
This reverts commit f5d1f80.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have run and diffed things locally. Looks good to me.
glass/fields.py
Outdated
If all gls are empty. | ||
|
||
""" | ||
"""Iteratively sample Gaussian random fields (internal use).""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why get rid of the docstring? Just because its internal doesn't mean it shouldn't have one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe @ntessore can answer this better, but the docstring was moved to generate
in another PR -
Lines 773 to 817 in 84dff24
def generate( | |
fields: Fields, | |
gls: Cls, | |
nside: int, | |
*, | |
ncorr: int | None = None, | |
rng: np.random.Generator | None = None, | |
) -> Iterator[NDArray[Any]]: | |
""" | |
Sample random fields from Gaussian angular power spectra. | |
Iteratively sample HEALPix maps of transformed Gaussian random | |
fields with the given angular power spectra *gls* and resolution | |
parameter *nside*. | |
The random fields are sampled from Gaussian random fields using the | |
transformations in *fields*. | |
The *gls* array must contain the angular power power spectra of the | |
Gaussian random fields in :ref:`standard order <twopoint_order>`. | |
The optional number *ncorr* limits how many realised fields are | |
correlated. This saves memory, as only *ncorr* previous fields are | |
kept. | |
Parameters | |
---------- | |
fields | |
Transformations for the random fields. | |
gls | |
Gaussian angular power spectra. | |
nside | |
Resolution parameter for the HEALPix maps. | |
ncorr | |
Number of correlated fields. If not given, all fields are | |
correlated. | |
rng | |
Random number generator. If not given, a default RNG is used. | |
Yields | |
------ | |
x | |
Sampled random fields. | |
""" |
I wouldn't mind having it repeated (given that they are not identical) here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I spotted it had moved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have added the docstring back. Let me know if this should be removed.
Deprecates the old random field generator functions in favour or
glass.generate()
. Internally, reimplements all old functionality in terms of the new functions, and removes the dependency on thegaussiancl
package.Still a draft as I want to check that the examples don't change under the reimplementation, before also updating them to use the new functions.
Closes: #504