{"id":18427167,"url":"https://github.com/fjebaker/lineprofiles","last_synced_at":"2026-02-13T00:11:11.016Z","repository":{"id":155012194,"uuid":"624965150","full_name":"fjebaker/lineprofiles","owner":"fjebaker","description":"A Cunningham transfer-function integrator for building relativistic lineprofile models.","archived":false,"fork":false,"pushed_at":"2024-04-17T22:11:45.000Z","size":183,"stargazers_count":1,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T22:20:16.078Z","etag":null,"topics":["astrophysics","black-holes","general-relativity","lineprofiles","xspec","xspec-model","zig"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fjebaker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-04-07T17:53:27.000Z","updated_at":"2024-05-29T09:08:01.000Z","dependencies_parsed_at":"2024-04-17T10:52:37.705Z","dependency_job_id":"ebdf895b-a5e4-4b13-a05d-21ce109a2344","html_url":"https://github.com/fjebaker/lineprofiles","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjebaker%2Flineprofiles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjebaker%2Flineprofiles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjebaker%2Flineprofiles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjebaker%2Flineprofiles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fjebaker","download_url":"https://codeload.github.com/fjebaker/lineprofiles/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241465113,"owners_count":19967243,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["astrophysics","black-holes","general-relativity","lineprofiles","xspec","xspec-model","zig"],"created_at":"2024-11-06T05:09:50.166Z","updated_at":"2026-02-13T00:11:11.010Z","avatar_url":"https://github.com/fjebaker.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\" pa=\"0\" ma=\"0\"\u003e\n\u003cimg width=\"300px\" src=\"assets/additive-example.svg\" alt=\"\"/\u003e\n\u003cimg width=\"300px\" src=\"assets/convolve-example.svg\" alt=\"\"/\u003e\n\u003c/p\u003e\n\n# klineprofiles\n\nA 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\n\n$$\nF(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),\n$$\n\non energy grids $E$ with bin width $\\delta E$.\n\nThe 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$.\n\n## Usage\n\nTo 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).\n\n- **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.\n\n## Building from source\n\nNote that building from source is not reqiured in order to use this model. See the [Usage](#usage) section above.\n\nTo build the static library from source, compile with Zig 0.12.0-dev.1647+325e0f5f0:\n\n```bash\ngit clone https://github.com/fjebaker/lineprofiles \\\n    \u0026\u0026 cd lineprofiles \\\n    \u0026\u0026 zig build -Doptimize=ReleaseFast xspec\n```\n\n## Model descriptions\n\nA number of different models are included in the source code, and additional models can be tailored to meet specific needs. _A la carte_:\n\n### Additive\n\n- `kline`: lineprofiles with power-law emissivities of the form $\\varepsilon(r) = r^{-\\alpha}$.\n\n| Parameter | Description                                        |\n| --------- | -------------------------------------------------- |\n| `a`       | Unitless black hole spin                           |\n| `incl`    | Observer inclination $\\theta$ (degrees)            |\n| `eline`   | Energy of central line (e.g. Fe K$\\alpha$ 6.4 keV) |\n| `rmin`    | Inner radius of the accretion disc                 |\n| `rout`    | Outer radius of the accretion disc                 |\n| `alpha`   | Emissivity powerlaw index                          |\n\n- `kline5`: lineprofiles with emissivity given as an interpolated power-law between 5 knots.\n\n| Parameter    | Description                                                                                |\n| ------------ | ------------------------------------------------------------------------------------------ |\n| `a`          | Unitless black hole spin                                                                   |\n| `incl`       | Observer inclination $\\theta$ (degrees)                                                    |\n| `eline`      | Energy of central line (e.g. Fe K$\\alpha$ 6.4 keV)                                         |\n| `rmin`       | Inner radius of the accretion disc                                                         |\n| `rout`       | Outer radius of the accretion disc                                                         |\n| `rcut`       | Radius at which the last emissivity knot is fixed.                                         |\n| `alpha`      | Emissivity powerlaw index beyond `e5`                                                      |\n| `e1` to `e5` | Emissivity interpolation knots (see [Emissivity interpolation](#emissivity-interpolation)) |\n\n### Convolutional\n\n- `kconv`: convolutional analog of `kline`.\n\n| Parameter | Description                             |\n| --------- | --------------------------------------- |\n| `a`       | Unitless black hole spin                |\n| `incl`    | Observer inclination $\\theta$ (degrees) |\n| `rmin`    | Inner radius of the accretion disc      |\n| `rout`    | Outer radius of the accretion disc      |\n| `alpha`   | Emissivity powerlaw index               |\n\n- `kconv5`: convolutional analog of `kline5`.\n\n| Parameter    | Description                                                                                |\n| ------------ | ------------------------------------------------------------------------------------------ |\n| `a`          | Unitless black hole spin                                                                   |\n| `incl`       | Observer inclination $\\theta$ (degrees)                                                    |\n| `rmin`       | Inner radius of the accretion disc                                                         |\n| `rout`       | Outer radius of the accretion disc                                                         |\n| `rcut`       | Radius at which the last emissivity knot is fixed.                                         |\n| `alpha`      | Emissivity powerlaw index beyond `e5`                                                      |\n| `e1` to `e5` | Emissivity interpolation knots (see [Emissivity interpolation](#emissivity-interpolation)) |\n\n- `kconv10`: the same as `kconv5` but with 10 parameters for the emissivity interpolation.\n\n| Parameter     | Description                                                                                |\n| ------------- | ------------------------------------------------------------------------------------------ |\n| `a`           | Unitless black hole spin                                                                   |\n| `incl`        | Observer inclination $\\theta$ (degrees)                                                    |\n| `rmin`        | Inner radius of the accretion disc                                                         |\n| `rout`        | Outer radius of the accretion disc                                                         |\n| `rcut`        | Radius at which the last emissivity knot is fixed.                                         |\n| `alpha`       | Emissivity powerlaw index beyond `e5`                                                      |\n| `e1` to `e10` | Emissivity interpolation knots (see [Emissivity interpolation](#emissivity-interpolation)) |\n\n## Emissivity interpolation\n\nThe 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)$:\n\n$$\n\\varepsilon(r, \\vec{k}) \\propto \\begin{matrix}\n    r^{-\\varepsilon_1}, \u0026 r \\leq r_1 \\\\\n    r^{-\\varepsilon_2}, \u0026 r_1 \u003c r \\leq r_2 \\\\\n    \\vdots \u0026 \\\\\n    r^{-\\varepsilon_N}, \u0026 r_N \u003c r \\leq r_\\text{cut} \\\\\n    r^{-\\alpha} \u0026 \\text{otherwise}\n\\end{matrix}\n$$\n\nwhere 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.\n\nThe lineprofiles are always normalised so that the area under the curve is one, due to the flexibility of the emissivity curves.\n\nThis 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.\n\nFor 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:\n\n\u003cp align=\"center\" pa=\"0\" ma=\"0\"\u003e\n\u003cimg width=\"600px\" src=\"assets/emissivity-interpolation.svg\" alt=\"\"/\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffjebaker%2Flineprofiles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffjebaker%2Flineprofiles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffjebaker%2Flineprofiles/lists"}