Skip to main content

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))
    
return 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 -e .

Project details


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.tar.gz (17.3 kB view details)

Uploaded Source

File details

Details for the file JaxHankel-0.1.tar.gz.

File metadata

  • Download URL: JaxHankel-0.1.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for JaxHankel-0.1.tar.gz
Algorithm Hash digest
SHA256 705fc7d642735916762c6aa332f55a2993d24ac1c2059a7e97e367c0d53cd4a2
MD5 c339117b085f9e253d5840f916c543a6
BLAKE2b-256 7f9079470b600be5cd1af9e96ca0a48d7789e6a7414fdc7b18e271dbae39439d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page