Table models¶
XSPEC-style additive and multiplicative OGIP table models.
ATable, MTable,
and ETable load the OGIP 92-009 FITS format and
interpolate it over model parameters and requested energy bins. They remain
differentiable with respect to model parameters and bin edges. Import them explicitly;
they require a table path and therefore are not included in jaxspec.model.list.
ATable
¶
Bases: _TableComponent, AdditiveComponent
Additive OGIP table model — the equivalent of XSPEC's atable{file}.
The tabulated spectra are per-bin integrated photon fluxes \(\left[\frac{\text{photons}}{\text{cm}^2\text{s}}\right]\); they are interpolated multilinearly over the parameter grid and redistributed onto the requested bins proportionally to overlap (integral preserving):
Constructor arguments
path: OGIP 92-009 table-model FITS file.energy_band: optional(e_min, e_max)in keV cropping the tabulated energy bins at load time (cropped copies are cached and shared between instances). When fitting a redshift or energy scale, widen the band so \(E \times (1+z)/E_{\text{scale}}\) stays covered, or flux is silently lost.
Parameters
Read from the file's PARAMETERS extension: one fittable parameter per row,
renamed to valid dotted-path segments (see table_parameters for the mapping),
plus escale when the file sets ESCALE, z when it sets REDSHIFT, and
norm (normalisation of the spectrum). Every parameter needs a prior entry
(a fixed value is enough to freeze it).
Warning
Parameter values outside the tabulated grid are clipped to the nearest grid
node (XSPEC raises a hard error instead) — keep priors inside the grid.
Bins outside the tabulated energy range get zero flux (XSPEC ignores
LOELIMIT/HIELIMIT for additive tables, and so does jaxspec). Energy flux
uses a mid-bin approximation, like every purely bin-integrated component.
The table is baked into the compiled program as a constant: instances built
from the same file share one in-memory copy, but very large tables cost their
full size once per compiled fit.
Enable float64 (jax.config.update("jax_enable_x64", True)) when the per-bin
fluxes span many decades: the rebinning cumulative sum saturates single
precision and silently corrupts the faint tail otherwise.
Source code in src/jaxspec/model/tabulated.py
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 | |
ETable
¶
Bases: MTable
Exponential multiplicative OGIP table model — XSPEC's etable{file}.
Identical to MTable except the combined table
value (additional parameters included) is mapped through
so the tabulated quantity is an optical depth (additional parameters combine
linearly before the exponential, XSPEC's design point for column densities).
LOELIMIT/HIELIMIT are final factors and are not exponentiated, matching
XSPEC. See MTable for the constructor
arguments, parameter discovery and edge-behaviour caveats.
Source code in src/jaxspec/model/tabulated.py
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 | |
MTable
¶
Bases: _TableComponent, MultiplicativeComponent
Multiplicative OGIP table model — the equivalent of XSPEC's mtable{file}.
The tabulated values are dimensionless multiplicative factors; the factor applied to an output bin is their width-weighted average over the covered table bins:
evaluated at \(E \times (1+z)/E_{\text{scale}}\) when the file declares redshift or energy-scale parameters (no \(1/(1+z)\) flux factor for multiplicative tables).
Constructor arguments
path: OGIP 92-009 table-model FITS file.energy_band: optional(e_min, e_max)in keV cropping the tabulated energy bins at load time (cropped copies are cached and shared between instances). When fitting a redshift or energy scale, widen the band so \(E \times (1+z)/E_{\text{scale}}\) stays covered, or the out-of-range factor silently applies instead.
Parameters
Read from the file's PARAMETERS extension: one fittable parameter per row,
renamed to valid dotted-path segments (see table_parameters for the mapping),
plus escale when the file sets ESCALE and z when it sets REDSHIFT.
Every parameter needs a prior entry (a fixed value is enough to freeze it).
Warning
Parameter values outside the tabulated grid are clipped to the nearest grid
node (XSPEC raises a hard error instead) — keep priors inside the grid.
Bins fully outside the tabulated energy range use LOELIMIT/HIELIMIT from
the file when present, and 1.0 otherwise. A bin partially covering the low end
of the table averages over its covered fraction; XSPEC 12.15.1 drops such bins
entirely (asymmetrically with the high end) — jaxspec keeps the symmetric,
integral-consistent behaviour. The table is baked into the compiled program as
a constant: instances built from the same file share one in-memory copy.
Enable float64 (jax.config.update("jax_enable_x64", True)) when the factors
span many decades: the rebinning cumulative sum saturates single precision.
Source code in src/jaxspec/model/tabulated.py
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 | |
factor(energy)
¶
Pointwise factor (step function over the table bins) for direct calls;
the fit hot path goes through the exact bin-averaged _factor instead.
Source code in src/jaxspec/model/tabulated.py
447 448 449 450 451 452 453 454 455 456 457 458 | |