jaxwave API Reference
This section provides the auto-generated reference documentation for JAX-based waveform generation, JIT compilation, shape-bucketing, and inference modules in jaxwave.
For physical coverage and execution restrictions, see model support. For numerical qualification, see accuracy and validation.
Core Waveform Functions
jaxwave.get_fd_waveform(approximant, mass1, mass2, chi1=_UNSET, chi2=_UNSET, spin1x=0.0, spin1y=0.0, spin1z=None, spin2x=0.0, spin2y=0.0, spin2z=None, distance=100.0, inclination=0.0, phic=0.0, tc=0.0, lambda1=None, lambda2=None, f_ref=None, phasing_convention=None, reference_frame=None, f_lower=None, f_final=None, delta_f=None, sample_frequencies=None, modes=None, dtype=jnp.float64, frequency_support=None, **kwargs)
Generate frequency-domain gravitational-wave polarizations h_plus(f) and h_cross(f) in JAX.
Source code in src/jaxwave/waveforms.py
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | |
jaxwave.WaveformGenerator
Class-based interface for gravitational waveform generation.
Configured with static waveform parameters and grid specification, allowing repeated waveform evaluation across varying binary parameters.
Source code in src/jaxwave/waveforms.py
658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 | |
generate_fd_waveform(parameters=None, **kwargs)
Generate frequency-domain polarizations for given parameters.
Source code in src/jaxwave/waveforms.py
generate_td_waveform(parameters=None, **kwargs)
Generate time-domain polarizations for given parameters.
Source code in src/jaxwave/waveforms.py
get_compiled_fd_waveform(parameter_order=('mass1', 'mass2', 'spin1z', 'spin2z', 'distance', 'inclination', 'phic', 'tc'))
Return a cached @jax.jit compiled function evaluating (hp, hc) for an ordered parameter vector.
The callable closes over grid specifications and approximant metadata. Repeated calls with compatible parameter shapes and dtypes can reuse compilation; new signatures may require recompilation.
Source code in src/jaxwave/waveforms.py
jaxwave.get_td_waveform(approximant='IMRPhenomD', mass1=30.0, mass2=25.0, chi1=_UNSET, chi2=_UNSET, spin1x=0.0, spin1y=0.0, spin1z=None, spin2x=0.0, spin2y=0.0, spin2z=None, distance=100.0, inclination=0.0, phic=0.0, tc=0.0, lambda1=None, lambda2=None, delta_t=1.0 / 2048.0, f_lower=20.0, f_final=None, duration=None, t_pad=0.2, center_coalescence=True, return_times=False, **kwargs)
Generate conditioned time-domain gravitational-wave polarizations h_plus(t) and h_cross(t) in JAX.
Literature: - Allen et al. (2012), Phys. Rev. D 85, 122006 (arXiv:gr-qc/0509116) - Buonanno et al. (2009), Phys. Rev. D 80, 084043 (arXiv:0907.0700)
The IMRPhenomT family is evaluated natively in time; f_ref fixes its orbital phase. Other models use the inverse Fourier path, which conserves signal energy: int |h(t)|^2 dt = 2 * int |h_tilde(f)|^2 df
Source code in src/jaxwave/waveforms.py
511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | |
Native Time-Domain Models
See the IMRPhenomT guide for examples and conventions.
jaxwave.IMRPhenomT
Aligned-spin dominant (2,2) IMRPhenomT waveform in JAX.
Source code in src/jaxwave/approximants/imrphenomt.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 | |
time_domain(times, mass1, mass2, chi1=0.0, chi2=0.0, distance=100.0, inclination=0.0, phic=0.0, tc=0.0, f_ref=20.0, *, _final_spin_override=None)
Return h_plus, h_cross on times in seconds relative to the peak.
Masses are solar masses, distance is Mpc, and f_ref is Hz. Parameter batches precede the shared time axis. This method applies no start mask.
Source code in src/jaxwave/approximants/imrphenomt.py
frequency(times, mass1, mass2, chi1=0.0, chi2=0.0, *, _final_spin_override=None)
Instantaneous gravitational-wave frequency in Hz at peak-relative times.
Source code in src/jaxwave/approximants/imrphenomt.py
time_at_frequency(frequency, mass1, mass2, chi1=0.0, chi2=0.0, *, _final_spin_override=None)
Return peak-relative time at a requested instantaneous frequency.
The bracket is grown from the Newtonian inspiral estimate so that it remains useful for low-frequency BNS requests. Bisection itself is stopped from the differentiation graph; an implicit Newton correction then restores the derivative through the frequency equation while keeping JIT and batched execution fully functional.
Source code in src/jaxwave/approximants/imrphenomt.py
jaxwave.IMRPhenomTHM
Aligned-spin dominant and subdominant time-domain modes.
Source code in src/jaxwave/approximants/imrphenomthm.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | |
time_domain(times, mass1, mass2, chi1=0.0, chi2=0.0, distance=100.0, inclination=0.0, phic=0.0, tc=0.0, f_ref=20.0, mode_array=None, final_spin=None, modes=None)
Source code in src/jaxwave/approximants/imrphenomthm.py
modes(times, mass1, mass2, chi1=0.0, chi2=0.0, distance=100.0, phic=0.0, tc=0.0, f_ref=20.0, mode_array=None, final_spin=None, modes=None)
Source code in src/jaxwave/approximants/imrphenomthm.py
jaxwave.IMRPhenomTP
Bases: IMRPhenomT
Precessing dominant-harmonic PhenomT with selectable Euler-angle prescriptions.
Source code in src/jaxwave/approximants/imrphenomtp.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |
time_domain(times, mass1, mass2, chi1=0.0, chi2=0.0, distance=100.0, inclination=0.0, phic=0.0, tc=0.0, f_ref=20.0, spin1x=0.0, spin1y=0.0, spin2x=0.0, spin2y=0.0, precession_method='nnlo', modes=None, final_spin=None, precession_version=None, _precession_state=None)
Source code in src/jaxwave/approximants/imrphenomtp.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
jaxwave.IMRPhenomTPHM
Bases: IMRPhenomT
Precessing multipolar PhenomT with selectable Euler-angle prescriptions.
Source code in src/jaxwave/approximants/imrphenomtphm.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
time_domain(times, mass1, mass2, chi1=0.0, chi2=0.0, distance=100.0, inclination=0.0, phic=0.0, tc=0.0, f_ref=20.0, spin1x=0.0, spin1y=0.0, spin2x=0.0, spin2y=0.0, precession_method='nnlo', modes=None, final_spin=None, precession_version=None, _precession_state=None)
Source code in src/jaxwave/approximants/imrphenomtphm.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | |
Shape Bucketing & MCMC Evaluators
jaxwave.inference.bucketing.BucketedWaveformEvaluator
Manages JIT-compiled waveform evaluators across fixed shape buckets.
Routes evaluations to the nearest bucket size and caches each evaluator. Each new bucket compiles on first use. Changed dtypes or other traced shapes can trigger additional compilations.
Source code in src/jaxwave/inference/bucketing.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
__call__(parameters, **kwargs)
Evaluate waveforms for an arbitrary batch size with automatic bucketing.
Source code in src/jaxwave/inference/bucketing.py
jaxwave.inference.bucketing.get_bucketed_batch_size(batch_size, buckets=DEFAULT_BATCH_BUCKETS)
Find the smallest bucket capacity greater than or equal to batch_size.
If batch_size exceeds all predefined buckets, rounds up to the next power of 2.
Source code in src/jaxwave/inference/bucketing.py
jaxwave.inference.bucketing.pad_parameters_to_bucket(parameters, bucket_size)
Pad parameter arrays along axis 0 up to bucket_size.
Pads using the last value of each parameter array to reuse an existing parameter row.
Returns:
| Name | Type | Description |
|---|---|---|
padded_parameters |
Dict[str, ndarray]
|
Dict with arrays of length bucket_size. |
valid_mask |
ndarray
|
Boolean array of shape (bucket_size,) indicating valid (non-padded) entries. |
Source code in src/jaxwave/inference/bucketing.py
jaxwave.inference.bucketing.unpad_waveform_from_bucket(hp, hc, original_batch_size)
Slice evaluated batched waveforms back to the original proposal batch size.
Source code in src/jaxwave/inference/bucketing.py
Bayesian Inference & Fisher Matrix
jaxwave.inference.fisher.fisher_information_matrix(parameters_dict, waveform_fn, psd_dict, detector_network=None, f_low=20.0, f_high=1024.0, df=None, frequencies=None, parameter_order=None, method='autodiff', step_sizes=None)
Compute the differentiable Fisher Information Matrix Gamma_ij using JAX autodiff or parameter differences.
Literature: Cutler & Flanagan (1994), Vallisneri (2008).
Formula
Gamma_ij = sum_{k in network} 4 Re int_{f_low}^{f_high} (1 / Sn^(k)(f)) * (dh_k(f)/dtheta_i) * (dh_k(f)/dtheta_j)* df
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters_dict
|
Dict[str, Union[float, ndarray]]
|
Dict mapping parameter names to parameter values/arrays |
required |
waveform_fn
|
Callable[[Dict[str, ndarray]], Union[ndarray, Dict[str, ndarray], Tuple[ndarray, ndarray]]]
|
Function mapping parameter dictionary to frequency-domain strain(s) |
required |
psd_dict
|
Union[ndarray, Dict[str, ndarray]]
|
Real PSD array or dict of PSDs for each detector {det: psd_det} |
required |
detector_network
|
Optional[Any]
|
Optional DetectorNetwork instance to project (h_plus, h_cross) |
None
|
f_low
|
float
|
Low-frequency cutoff in Hz |
20.0
|
f_high
|
float
|
High-frequency cutoff in Hz |
1024.0
|
df
|
Optional[float]
|
Frequency resolution in Hz |
None
|
frequencies
|
Optional[ndarray]
|
Optional frequency vector in Hz |
None
|
parameter_order
|
Optional[Sequence[str]]
|
Optional explicit order of parameter keys |
None
|
method
|
str
|
"autodiff" (forward-mode JVP), "hessian" (autodiff Whittle Hessian), or "finite_diff" |
'autodiff'
|
step_sizes
|
Optional[Dict[str, float]]
|
Optional dict of step sizes for finite differences |
None
|
Returns:
| Type | Description |
|---|---|
(fisher_matrix, param_names)
|
(P, P) symmetric Fisher matrix and list of parameter names. |
List[str]
|
Degenerate parameters can make the matrix singular. |
Source code in src/jaxwave/inference/fisher.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
jaxwave.inference.relative_binning.RelativeBinningLikelihood
Approximate Whittle log-likelihood using relative binning (Zackay et al. 2018).
Precomputes summary coefficients from dense data and a fiducial waveform, then evaluates candidate waveforms at M bin frequencies instead of N_f dense frequencies. The approximation uses local linear waveform ratios.
Accuracy and evaluation cost depend on binning, the reference waveform, signal properties, and parameter displacement. Validate likelihood and gradient errors against dense evaluation over the intended parameter region. Autodiff differentiates this approximation, not the dense likelihood.
Source code in src/jaxwave/inference/relative_binning.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 | |
compute_r0_r1(h_centers, h0_centers, bin_centers)
staticmethod
Compute the ratio r_0 and slope r_1 at bin centers in JAX.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
h_centers
|
ndarray
|
Test waveform evaluated at bin centers, shape (..., M). |
required |
h0_centers
|
ndarray
|
Reference waveform evaluated at bin centers, shape (M,) or (..., M). |
required |
bin_centers
|
ndarray
|
Bin center frequencies, shape (M,). |
required |
Returns:
| Type | Description |
|---|---|
Tuple[ndarray, ndarray]
|
Tuple of (r0, r1) with same batch dimensions as h_centers. |
Source code in src/jaxwave/inference/relative_binning.py
inner_product_dh(r0, r1, detector)
Compute noise-weighted inner product
Source code in src/jaxwave/inference/relative_binning.py
inner_product_hh(r0, r1, detector)
Compute waveform self inner product
Source code in src/jaxwave/inference/relative_binning.py
log_likelihood(templates_at_bin_centers, h0_at_bin_centers=None, slopes=None)
Compute relative binning log-likelihood from waveforms evaluated at bin centers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
templates_at_bin_centers
|
Union[Dict[str, ndarray], ndarray]
|
Dictionary mapping detector name to waveform array h(theta; f_bar) evaluated ONLY at bin centers, or single array if only one detector is configured. |
required |
h0_at_bin_centers
|
Optional[Dict[str, ndarray]]
|
Optional fiducial waveform h0(f_bar). |
None
|
slopes
|
Optional[Dict[str, ndarray]]
|
Optional explicit slopes r_1(f_bar). If None, calculated via centered finite differences. |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Scalar or batched log-likelihood array. |
Source code in src/jaxwave/inference/relative_binning.py
log_likelihood_from_r(r0_dict, r1_dict)
Compute relative binning log-likelihood from pre-computed ratios (r0, r1).
ln L = sum_{det} [