|
| 1 | +# Line profiles |
| 2 | + |
| 3 | +Line profiles are kernels that represent the blurring of spectral lines from e.g. an accretion disc around a black hole. They show how the flux is smeared over a range of energies relative to the rest energy due to relativistic effects and Doppler shifts. |
| 4 | + |
| 5 | +Gradus.jl has various methods for calculating line profiles (see |
| 6 | +[`Methods`](@ref)). Here we will explore how to compute line profiles with |
| 7 | +Gradus using the [`BinningMethod`](@ref) and the |
| 8 | +[`TransferFunctionMethod`](@ref). |
| 9 | + |
| 10 | +As with any Gradus.jl simulation, we start by picking the basic components of our model: |
| 11 | +```julia |
| 12 | +using Gradus |
| 13 | + |
| 14 | +m = KerrMetric(M = 1.0, a = 0.998) |
| 15 | +# an infinite thin disc in the equatorial plane |
| 16 | +d = ThinDisc(0.0, Inf) |
| 17 | +x = SVector(0.0, 10_000.0, deg2rad(60), 0.0) |
| 18 | +``` |
| 19 | + |
| 20 | +We can compute a line profile directly using the [`lineprofile`](@ref) method: |
| 21 | + |
| 22 | +```@docs |
| 23 | +lineprofile |
| 24 | +``` |
| 25 | + |
| 26 | +We can invoke this directly |
| 27 | +```julia |
| 28 | +bins, flux = lineprofile(m, x, d) |
| 29 | +``` |
| 30 | + |
| 31 | +If a custom (enregy) bins is desired, it can be passed using the keyword arguments. We can plot these vectors directly: |
| 32 | +```julia |
| 33 | +using Plots |
| 34 | +plot(bins, flux; xlabel = "g", ylabel = "flux") |
| 35 | +``` |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | +To pass a custom emissivity function, we can use a different dispatch that takes the `bins` and the emissivity function as the first argument. Here is a shallower power-law, reusing the same bins: |
| 40 | +```julia |
| 41 | +emissivity(r) = r^-2 |
| 42 | +bins, flux = lineprofile(bins, emissivity, m, x, d) |
| 43 | +plot!(bins, flux) |
| 44 | +``` |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | +To use the emissivity calcualted via an [`AbstractDiscProfile`](@ref) from a coronal model, we can do something like |
| 49 | +```julia |
| 50 | +model = LampPostModel(h = 10.0) |
| 51 | +profile = emissivity_profile(m, d, model) |
| 52 | +bins, flux = lineprofile(m, x, d, profile; bins = bins) |
| 53 | +plot!(bins, flux) |
| 54 | +``` |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | +We can at any point switch to the [`BinningMethod`](@ref) dispatches, which have largely the same functions calls. These methods take significantly longer to execute, and often give slightly lower resolution, however are much more flexible in the underlying assumptions of the model: |
| 59 | +```julia |
| 60 | +bins, flux = lineprofile(m, x, d, profile; bins = bins, method = BinningMethod()) |
| 61 | +plot!(bins, flux) |
| 62 | +``` |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | +The defaults have been chosen to balance accuracy and speed. The above [`TransferFunctionMethod`](@ref) calculations only take a handful of seconds to compute from scratch. If all we are changing are properties of the disc, we do not necessarily need to recompute the transfer functions, and can make use of caches instead. Here is an example recipe using the [`transferfunctions`](@ref) utility: |
| 67 | + |
| 68 | +```julia |
| 69 | +tfs = transferfunctions(m, x, d) |
| 70 | + |
| 71 | +f1 = integrate_lineprofile(r -> r^-3, tfs, bins) |
| 72 | +f2 = integrate_lineprofile(profile, tfs, bins) |
| 73 | + |
| 74 | +plot(bins, f1) |
| 75 | +plot!(bins, f2) |
| 76 | +``` |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | +Similar pre-computation can be done with the binning method, however there are currently no utility functions available in the same way as with the transfer functions. |
| 81 | + |
| 82 | +```@docs |
| 83 | +integrate_lineprofile |
| 84 | +``` |
| 85 | + |
| 86 | + |
| 87 | + |
0 commit comments