Skip to content
This repository has been archived by the owner on Feb 8, 2025. It is now read-only.
/ gaussiancl Public archive

Commit

Permalink
rename package
Browse files Browse the repository at this point in the history
  • Loading branch information
ntessore committed May 6, 2021
1 parent 5a130d6 commit 5f510f1
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 101 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@

lognormcl
=========
normcl
======

**angular power spectra of lognormal random fields**
**angular power spectra conversions for normal random fields**

This is a minimal Python package for working with the angular power spectra of
lognormal spherical random fields. It can currently convert between the power
spectra of lognormal random fields and their constituent normal random fields.
spherical random fields constructed from normals. It can currently convert
between the power spectra of lognormal random fields and their constituent
normal random fields.

The package can be installed using pip:

pip install lognormcl
pip install normcl

Then import the `ln2n` and `n2ln` functions from the package:
Then import the `lognormal` and `lognormal_normal` functions from the package:

from lognormcl import ln2n, n2ln
from normcl import lognormal, lognormal_normal

For more information, please see the [documentation].

Current functionality covers the absolutely minimal use case. Please open an
issue on GitHub if you would like to see anything added.

[documentation]: https://cltools.readthedocs.io/lognormcl/
[documentation]: https://cltools.readthedocs.io/normcl/
86 changes: 0 additions & 86 deletions lognormcl.py

This file was deleted.

93 changes: 93 additions & 0 deletions normcl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# author: Nicolas Tessore <n.tessore@ucl.ac.uk>
# license: MIT
r'''
Angular power spectra conversions for normal fields (:mod:`normcl`)
====================================================================
This is a minimal Python package for working with the angular power spectra of
spherical random fields constructed from normals. It can currently convert
between the power spectra of lognormal random fields and their constituent
normal random fields.
The package can be installed using pip::
pip install normcl
Then import the :func:`~normcl.lognormal` and :func:`~normcl.lognormal_normal`
functions from the package::
from normcl import lognormal, lognormal_normal
Current functionality covers the absolutely minimal use case. Please open an
issue on GitHub if you would like to see anything added.
Distributions
-------------
Lognormal
~~~~~~~~~
.. math::
Y = e^X - \lambda
.. math::
\alpha = {\rm E}[Y] + \lambda
Reference/API
-------------
.. autosummary::
:toctree: api
:nosignatures:
lognormal
lognormal_normal
'''

__version__ = '2021.5.5'

__all__ = [
'lognormal',
'lognormal_normal',
]


import numpy as np
from transformcl import cltoxi, xitocl


def lognormal(cl, alpha, alpha2=None, *, inv=True):
'''lognormal angular power spectrum
'''
if alpha2 is None:
alpha2 = alpha

xi = cltoxi(cl)
if not inv:
xi /= alpha
xi /= alpha2
np.log1p(xi, out=xi)
else:
np.expm1(xi, out=xi)
xi *= alpha
xi *= alpha2
return xitocl(xi)


def lognormal_normal(cl, alpha, *, inv=False):
'''lognormal cross normal angular power spectrum
'''
xi = cltoxi(cl)
if not inv:
xi /= alpha
else:
xi *= alpha
return xitocl(xi)
12 changes: 6 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[metadata]
name = lognormcl
version = attr:lognormcl.__version__
name = normcl
version = attr:normcl.__version__
maintainer = Nicolas Tessore
maintainer_email = n.tessore@ucl.ac.uk
description = angular power spectra of lognormal random fields
description = angular power spectra conversions for normal random fields
long_description = file: README.md
long_description_content_type = text/markdown
license = MIT
license_file = LICENSE
url = https://github.com/ntessore/lognormcl
url = https://github.com/ntessore/normcl
project_urls =
Documentation = https://cltools.readthedocs.io/lognormcl/
Documentation = https://cltools.readthedocs.io/normcl/
classifiers =
Programming Language :: Python :: 3
License :: OSI Approved :: MIT License
Expand All @@ -21,4 +21,4 @@ python_requires = >=3.6
install_requires =
numpy
transformcl
py_modules = lognormcl
py_modules = normcl

0 comments on commit 5f510f1

Please sign in to comment.