Access Xspec models and corresponding JAX/XLA ops.
Project description
xspex
Access Xspec models and corresponding JAX/XLA ops, based on xspec_models_cxc and extending-jax.
Installation
Note: HEASoft & Xspec v12.12.1+ are required to be installed on your system.
You can download it from here.
pip install xspex
Example
import jax
import jax.numpy as jnp
import numpy as np
import xspex
# For accuracy, it is recommended to enable double precision
jax.config.update('jax_enable_x64', True)
# Get APEC model primitive, whose JVP rule is defined by finite difference
apec, info = xspex.get_primitive('apec')
# Evaluate the model via JAX primitive
value = apec(
params=jnp.array([1.0, 1.0, 0.0]),
egrid=jnp.geomspace(0.1, 0.2, 6),
spec_num=1,
)
print(value) # [1.27358561 0.37946811 0.2477116 0.1071355 0.10049102]
# Evaluate the model function
value2 = xspex.apec(
pars=np.array([1.0, 1.0, 0.0]),
energies=np.geomspace(0.1, 0.2, 6),
)
print(value2) # [1.27358561 0.37946811 0.2477116 0.1071355 0.10049102]
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
xspex-0.0.6.tar.gz
(70.5 kB
view details)
File details
Details for the file xspex-0.0.6.tar.gz.
File metadata
- Download URL: xspex-0.0.6.tar.gz
- Upload date:
- Size: 70.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce8edb3c8a55d1aac9fcd7330b893bbcc73572ba2e7cd7a1c7d92e1585d01684
|
|
| MD5 |
37fec03eaa1490f34b67876cd8d53c49
|
|
| BLAKE2b-256 |
edd33bccb73c399fd5d3899a93cfd11e3c2fc1c347d0cdf1985ce54fda457df8
|
Provenance
The following attestation bundles were made for xspex-0.0.6.tar.gz:
Publisher:
ci.yml on wcxve/xspex
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xspex-0.0.6.tar.gz -
Subject digest:
ce8edb3c8a55d1aac9fcd7330b893bbcc73572ba2e7cd7a1c7d92e1585d01684 - Sigstore transparency entry: 205092654
- Sigstore integration time:
-
Permalink:
wcxve/xspex@c03e99fc2d9c4e66f5582000d7dd7723fa9c5cd9 -
Branch / Tag:
refs/tags/v0.0.6 - Owner: https://github.com/wcxve
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@c03e99fc2d9c4e66f5582000d7dd7723fa9c5cd9 -
Trigger Event:
push
-
Statement type: