https://github.com/fjebaker/lineprofiles
A Cunningham transfer-function integrator for building relativistic lineprofile models.
https://github.com/fjebaker/lineprofiles
astrophysics black-holes general-relativity lineprofiles xspec xspec-model zig
Last synced: 4 months ago
JSON representation
A Cunningham transfer-function integrator for building relativistic lineprofile models.
- Host: GitHub
- URL: https://github.com/fjebaker/lineprofiles
- Owner: fjebaker
- License: mit
- Created: 2023-04-07T17:53:27.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-17T22:11:45.000Z (about 2 years ago)
- Last Synced: 2025-02-28T22:20:16.078Z (over 1 year ago)
- Topics: astrophysics, black-holes, general-relativity, lineprofiles, xspec, xspec-model, zig
- Language: Zig
- Homepage:
- Size: 179 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# klineprofiles
A Cunningham transfer function integrator written in the [Zig programming language](https://ziglang.org/). Constructs relativistic lineprofile spectra for use with [SpectralFitting.jl](https://github.com/fjebaker/SpectralFitting.jl), HEASoft's [XSPEC](https://heasarc.gsfc.nasa.gov/xanadu/xspec/), and beyond. This code integrates pre-computed Green's function / Cunningham transfer functions with an interpolated emissivity function, solving
$$
F(E, \delta E) = \int_{r_0}^{R} \text{d} r \int_{E}^{E+\delta E} \text{d}g I_{\text{obs}}(r, g) \varepsilon(r),
$$
on energy grids $E$ with bin width $\delta E$.
The pre-computed transfer functions in $I_\text{obs}$ can be obtained using general relativistic ray-tracing software, such as [Gradus.jl](https://github.com/astro-group-bristol/Gradus.jl/). With every [release](https://github.com/fjebaker/lineprofiles/releases), an example table is provided for the Kerr spacetime, which interpolates over black hole spin $a$ and observer inclination $\theta$.
## Usage
To install into XSPEC, follow the guide in the [release](https://github.com/fjebaker/lineprofiles/releases) description. The latest pre-computed table model is currently v0.1.0, and can be downloaded directly from [here](https://github.com/fjebaker/lineprofiles/releases/download/v0.1.0/kerr-transfer-functions-v0.1.0.zip).
- **Note**: this model is compatible with XSPEC v12.13 onwards, and will not compile for older versions due to breaking changes in the generated model wrappers.
## Building from source
Note that building from source is not reqiured in order to use this model. See the [Usage](#usage) section above.
To build the static library from source, compile with Zig 0.12.0-dev.1647+325e0f5f0:
```bash
git clone https://github.com/fjebaker/lineprofiles \
&& cd lineprofiles \
&& zig build -Doptimize=ReleaseFast xspec
```
## Model descriptions
A number of different models are included in the source code, and additional models can be tailored to meet specific needs. _A la carte_:
### Additive
- `kline`: lineprofiles with power-law emissivities of the form $\varepsilon(r) = r^{-\alpha}$.
| Parameter | Description |
| --------- | -------------------------------------------------- |
| `a` | Unitless black hole spin |
| `incl` | Observer inclination $\theta$ (degrees) |
| `eline` | Energy of central line (e.g. Fe K$\alpha$ 6.4 keV) |
| `rmin` | Inner radius of the accretion disc |
| `rout` | Outer radius of the accretion disc |
| `alpha` | Emissivity powerlaw index |
- `kline5`: lineprofiles with emissivity given as an interpolated power-law between 5 knots.
| Parameter | Description |
| ------------ | ------------------------------------------------------------------------------------------ |
| `a` | Unitless black hole spin |
| `incl` | Observer inclination $\theta$ (degrees) |
| `eline` | Energy of central line (e.g. Fe K$\alpha$ 6.4 keV) |
| `rmin` | Inner radius of the accretion disc |
| `rout` | Outer radius of the accretion disc |
| `rcut` | Radius at which the last emissivity knot is fixed. |
| `alpha` | Emissivity powerlaw index beyond `e5` |
| `e1` to `e5` | Emissivity interpolation knots (see [Emissivity interpolation](#emissivity-interpolation)) |
### Convolutional
- `kconv`: convolutional analog of `kline`.
| Parameter | Description |
| --------- | --------------------------------------- |
| `a` | Unitless black hole spin |
| `incl` | Observer inclination $\theta$ (degrees) |
| `rmin` | Inner radius of the accretion disc |
| `rout` | Outer radius of the accretion disc |
| `alpha` | Emissivity powerlaw index |
- `kconv5`: convolutional analog of `kline5`.
| Parameter | Description |
| ------------ | ------------------------------------------------------------------------------------------ |
| `a` | Unitless black hole spin |
| `incl` | Observer inclination $\theta$ (degrees) |
| `rmin` | Inner radius of the accretion disc |
| `rout` | Outer radius of the accretion disc |
| `rcut` | Radius at which the last emissivity knot is fixed. |
| `alpha` | Emissivity powerlaw index beyond `e5` |
| `e1` to `e5` | Emissivity interpolation knots (see [Emissivity interpolation](#emissivity-interpolation)) |
- `kconv10`: the same as `kconv5` but with 10 parameters for the emissivity interpolation.
| Parameter | Description |
| ------------- | ------------------------------------------------------------------------------------------ |
| `a` | Unitless black hole spin |
| `incl` | Observer inclination $\theta$ (degrees) |
| `rmin` | Inner radius of the accretion disc |
| `rout` | Outer radius of the accretion disc |
| `rcut` | Radius at which the last emissivity knot is fixed. |
| `alpha` | Emissivity powerlaw index beyond `e5` |
| `e1` to `e10` | Emissivity interpolation knots (see [Emissivity interpolation](#emissivity-interpolation)) |
## Emissivity interpolation
The emissivity function in `klineN` and `kconvN` is calculated with a linear interpolation in $\log \varepsilon$, $\log r$ space; that is to say, the power law index is piecewise constant between $N$ knots $\vec{k} = (r_1, r_2, \ldots, r_N)$:
$$
\varepsilon(r, \vec{k}) \propto \begin{matrix}
r^{-\varepsilon_1}, & r \leq r_1 \\
r^{-\varepsilon_2}, & r_1 < r \leq r_2 \\
\vdots & \\
r^{-\varepsilon_N}, & r_N < r \leq r_\text{cut} \\
r^{-\alpha} & \text{otherwise}
\end{matrix}
$$
where the different $r_i$ are calculated as $N$ log linear intervals between the inner and some cutoff radius of the disc. The normalisations of the emissivity are calculated so that the emissivity is joined into a piecewise curve (see figure below). This piecewise function applies over the region $r_{\text{in}}$ to $r_{\text{cut}}$, after which $r^{-alpha}$ is used for the emissivity profile.
The lineprofiles are always normalised so that the area under the curve is one, due to the flexibility of the emissivity curves.
This interpolation regime is in order to mimic the different emissivity functions of a disc irradiated by some arbitrary, axis-symmetric ionizing flux. The ionizing flux may itself be a consequence of different coronal models for the black hole. Fitting the emissivity functions should thereby allow the model to infer general properties about e.g. the morphology or position of the corona.
For example, the ionizing flux of a lamp post corona around a maximally spinning black hole at height $h = 10 r_\text{g}$ may be approximated with this emissivity interpolation: