SimuSIGW
Small numerical package for evolving scalar-induced gravitational-wave source fields on periodic 3-D grids.
Backends
run_evolution: CPU FFT pseudospectral backend.run_evolution_fd: CPU Numba finite-difference backend, withfd_order=2orfd_order=4.run_evolution_torch: optional PyTorch dense Fourier-matrix backend for the original GPU-style calculation.run_evolution_torch_fft: optional PyTorch FFT pseudospectral backend.
Install
pip install -e .
For the optional PyTorch backend, install a PyTorch build that matches your CUDA setup. If you use the package metadata extra:
pip install -e ".[gpu]"
Custom Model
Users provide a dimensional power spectrum function power_spectrum(k) and,
optionally, a non-Gaussian transform non_gaussian_transform(zeta_g).
import numpy as np
from SimuSIGW import (
EvolutionConfig,
gaussian_random_fields,
run_evolution_fd,
)
def my_power_spectrum(k):
kstar = 20.0
width = 0.1
amplitude = 1e-2
return (
amplitude
* (1 / kstar) ** 3
/ (np.sqrt(2 * np.pi) * width)
* np.exp(-((k / kstar - 1) ** 2) / (2 * width**2))
* (2 * np.pi**2)
)
def my_non_gaussian_transform(zeta_g):
return zeta_g + 0.5 * (zeta_g**2 - np.mean(zeta_g**2))
config = EvolutionConfig(
n=128,
max_steps=1000,
output_every=1000,
output_path="log/custom_run",
workers=-1,
fd_order=4,
save_initial=False,
)
field_g, phi_initial = gaussian_random_fields(
config.n,
power_spectrum=my_power_spectrum,
non_gaussian_transform=my_non_gaussian_transform,
seed=1234,
workers=config.workers,
dtype=config.dtype,
)
final_state = run_evolution_fd(phi_initial, config)
The default non-Gaussian transform is the logarithmic transform used in the
original notebook. For exploratory finite-difference runs, dtype=np.float32
can be faster; use np.float64 for reference runs.
GPU Backend
from SimuSIGW import run_evolution_torch
final_state = run_evolution_torch(phi_initial, config, device="cuda")
The dense backend follows the original Fourier differentiation-matrix approach. For larger grids, prefer the FFT backend:
from SimuSIGW import run_evolution_torch_fft
config = EvolutionConfig(...)
final_state = run_evolution_torch_fft(
phi_initial,
config,
device="cuda",
dtype=np.float32, # or np.float64
)
Both PyTorch backends accept dtype=np.float32 or dtype=np.float64. If
omitted, they use config.dtype. Choose np.float32 for speed and lower GPU
memory use, or np.float64 for reference runs. They are optional and import
PyTorch only when called.
Benchmarks
python benchmark_leapfrog_workers.py
python benchmark_leapfrog_backends.py
python benchmark_torch_backends.py --dtype float32
python benchmark_torch_backends.py --dtype float64 --skip-dense
Metadata
Release files for SimuSIGW 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| simusigw-0.1.0.tar.gz | 16.9 kB | Without provenance | Details for simusigw-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| simusigw-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for simusigw-0.1.0-py3-none-any.whl |
Total release size: 35.2 kB
Release files / simusigw-0.1.0.tar.gz
| Download URL | simusigw-0.1.0.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37bde376ef679ece26e4e92bf8446a717c00a4a0f84c7ff10618bb3e44da1801
|
|
BLAKE2b-256 checksum How to use checksums |
ff5e80904c07ea9bada16fdff67a5338e17d37706f6d0362f05f832d01ab8232
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Release files / simusigw-0.1.0-py3-none-any.whl
| Download URL | simusigw-0.1.0-py3-none-any.whl |
|---|---|
| Size | 18.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
21d59afd4b9b3d3f1130d492738805389b7fb823c6bfda23056b8cc7a7cd2f32
|
|
BLAKE2b-256 checksum How to use checksums |
8f9d57725d4768cc155e4b63b7df8bf5beba4b52011199b9dd52a50656c6be66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Security for SimuSIGW 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.