No project description provided
Project description
JaxHankel
A Hankel transform implementation in jax, based in scipy's implementation
Examples
In cosmoogy, use to convert power spectrum into correlation functions and vice-versa,
import matplotlib.pyplot as plt
import jax.numpy as jnp
from jax_fht.cosmology import FFTLog
def xi(r, A=1.0):
return A * jnp.exp(-(r ** 2))
fftlog = FFTLog(num=1, log_r_min=-4.0, log_r_max=4.0)
pk = fftlog.xi2pk(xi(fftlog.r))
plt.loglog(fftlog.k, pk)
Note that it is vectorized along the last dimension.
Thanks to jax we can now compute derivatives too, see for instance the derivative of the power spectrum respect to its norm (A),
get_pk = lambda norm: fftlog.xi2pk(xi(fftlog.r, norm))
derivative = jacobian(get_pk)(5.)
Install
$ pip install JaxHankel
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
JaxHankel-0.1.2.tar.gz
(17.4 kB
view details)
File details
Details for the file JaxHankel-0.1.2.tar.gz.
File metadata
- Download URL: JaxHankel-0.1.2.tar.gz
- Upload date:
- Size: 17.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f80f88df40cac425a4cb7e37d51e1946be822e84fac2e5d204b35e0b70d912c6
|
|
| MD5 |
46d7993101b4168bda7de129c760cdd6
|
|
| BLAKE2b-256 |
7bee8ee976b02fb9b3e5b827536c8432aa5c52152a266e927a19a29a73843f36
|