Skip to content

Commit 01422e0

Browse files
committed
rename "xi" to "corr", but keep old aliases
1 parent 8e9c9d7 commit 01422e0

File tree

1 file changed

+31
-23
lines changed

1 file changed

+31
-23
lines changed

transformcl.py

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
1414
pip install transformcl
1515
16-
Then import the :func:`~transformcl.cltoxi` and :func:`~transformcl.xitocl`
16+
Then import the :func:`~transformcl.cltocorr` and :func:`~transformcl.corrtocl`
1717
functions from the package::
1818
19-
from transformcl import cltoxi, xitocl
19+
from transformcl import cltocorr, corrtocl
2020
2121
Current functionality covers the absolutely minimal use case. Please open an
2222
issue on GitHub if you would like to see anything added.
@@ -29,18 +29,18 @@
2929
:toctree: api
3030
:nosignatures:
3131
32-
cltoxi
33-
xitocl
32+
cltocorr
33+
corrtocl
3434
theta
3535
cltovar
3636
3737
'''
3838

39-
__version__ = '2022.7.28'
39+
__version__ = '2022.8.9'
4040

4141
__all__ = [
42-
'cltoxi',
43-
'xitocl',
42+
'cltocorr',
43+
'corrtocl',
4444
'theta',
4545
'cltovar',
4646
]
@@ -53,7 +53,15 @@
5353
FOUR_PI = 4*np.pi
5454

5555

56-
def cltoxi(cl, closed=False):
56+
def cltoxi(*args, **kwargs):
57+
return cltocorr(*args, **kwargs)
58+
59+
60+
def xitocl(*args, **kwargs):
61+
return corrtocl(*args, **kwargs)
62+
63+
64+
def cltocorr(cl, closed=False):
5765
r'''transform angular power spectrum to correlation function
5866
5967
Takes an angular power spectrum with :math:`\mathtt{n} = \mathtt{lmax}+1`
@@ -74,12 +82,12 @@ def cltoxi(cl, closed=False):
7482
7583
Returns
7684
-------
77-
xi : (n,) array_like
85+
corr : (n,) array_like
7886
Angular correlation function.
7987
8088
See Also
8189
--------
82-
transformcl.xitocl : the inverse operation
90+
transformcl.corrtocl : the inverse operation
8391
transformcl.theta : compute the angles at which the correlation function is
8492
evaluated
8593
@@ -101,13 +109,13 @@ def cltoxi(cl, closed=False):
101109
c *= cl
102110

103111
# perform the inverse DLT
104-
xi = idlt(c, closed=closed)
112+
corr = idlt(c, closed=closed)
105113

106114
# done
107-
return xi
115+
return corr
108116

109117

110-
def xitocl(xi, closed=False):
118+
def corrtocl(corr, closed=False):
111119
r'''transform angular correlation function to power spectrum
112120
113121
Takes an angular function in :math:`\mathtt{n}` points and returns the
@@ -121,20 +129,20 @@ def xitocl(xi, closed=False):
121129
122130
Parameters
123131
----------
124-
xi : (n,) array_like
132+
corr : (n,) array_like
125133
Angular correlation function.
126134
closed : bool
127135
Compute correlation function over open (``closed=False``) or closed
128136
(``closed=True``) interval.
129137
130138
Returns
131139
-------
132-
xi : (n,) array_like
140+
cl : (n,) array_like
133141
Angular power spectrum from :math:`0` to :math:`\mathtt{lmax}`.
134142
135143
See Also
136144
--------
137-
transformcl.cltoxi : the inverse operation
145+
transformcl.cltocorr : the inverse operation
138146
transformcl.theta : compute the angles at which the correlation function is
139147
evaluated
140148
@@ -145,19 +153,19 @@ def xitocl(xi, closed=False):
145153
'''
146154

147155
# length n of the transform
148-
if np.ndim(xi) != 1:
149-
raise TypeError('xi must be 1d array')
150-
n = np.shape(xi)[-1]
156+
if np.ndim(corr) != 1:
157+
raise TypeError('corr must be 1d array')
158+
n = np.shape(corr)[-1]
151159

152160
# compute the DLT coefficients
153-
c = dlt(xi, closed=closed)
161+
cl = dlt(corr, closed=closed)
154162

155163
# DLT coefficients = (2l+1)/(4pi) * Cl
156-
c /= np.arange(1, 2*n+1, 2, dtype=float)
157-
c *= FOUR_PI
164+
cl /= np.arange(1, 2*n+1, 2, dtype=float)
165+
cl *= FOUR_PI
158166

159167
# done
160-
return c
168+
return cl
161169

162170

163171
def cltovar(cl):

0 commit comments

Comments
 (0)