Skip to content

Commit

Permalink
fix docs, optimise forward model
Browse files Browse the repository at this point in the history
  • Loading branch information
FredDeCeuster committed Jul 27, 2023
1 parent 2aa4a5f commit 48b6d8b
Show file tree
Hide file tree
Showing 11 changed files with 657 additions and 507 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ _Probabilistic 3D Reconstruction of Spectral Line Observations._

## About

p3droslo is a software library for probabilistic 3D reconstruction of astronomical spectral line observations.
Observations of [spectral lines](https://en.wikipedia.org/wiki/Spectral_line) are indespensible in astronomy, since they encode a lot of information about the physical and chemical conditions of the medium in which they were formed.
For instance, their narrow extend in frequency space make them very sensitive to Doppler shifts, such that their shape encodes the motion of the medium along the line of sight.
Given a good model for the line formation process and a good inversion method, these physical and chemical properties can be retrieved.
**p3droslo** is a software library for **probabilistic 3D reconstruction** of astronomical **spectral line observations**.
Observations of [spectral lines](https://en.wikipedia.org/wiki/Spectral_line) are indespensible in astronomy, since they encode a wealth of information about the physical and chemical conditions of the medium in which they were formed.
For instance, their narrow extent in frequency space make them very sensitive to Doppler shifts, such that their shape encodes the motion of the medium along the line of sight.
As a result, given a good model for the line formation process and a good inversion method, these physical and chemical properties can be retrieved from observations.
Currently, we mainly focus on retrieving the distributions of the abundance of the chemical species producing the line, the velocity field, and its kinetic temperature.

More information about the model for [spectral line formation](https://p3droslo.readthedocs.io/en/latest/background/spectral_line_formation.html) and the [probabilistic reconstruction methods](https://p3droslo.readthedocs.io/en/latest/background/probabilistic_reconstruction.html) can be found in the [background](https://p3droslo.readthedocs.io/en/latest/background/index.html) pages.

p3droslo is built on top of [PyTorch](https://pytorch.org) and benefits a lot from functionality provided by [Astropy](https://www.astropy.org).
**p3droslo** is built on top of [PyTorch](https://pytorch.org) and benefits a lot from functionality provided by [Astropy](https://www.astropy.org).
It is currently developed and maintained by [Frederik De Ceuster](https://freddeceuster.github.io) at [KU Leuven](https://www.kuleuven.be/english/kuleuven/index.html).


Expand Down
2 changes: 1 addition & 1 deletion docs/src/background/probabilistic_reconstruction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Probabilistic Reconstruction"
"# Probabilistic reconstruction"
]
},
{
Expand Down
17 changes: 9 additions & 8 deletions docs/src/background/spectral_line_formation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Spectral Line Formation"
"# Spectral line formation"
]
},
{
Expand Down Expand Up @@ -43,6 +43,7 @@
"\\begin{equation*}\n",
"\\Delta \\tau \\ = \\ \\Delta x \\int_{0}^{1} \\text{d}\\lambda \\ \\chi (\\lambda) .\n",
"\\end{equation*}\n",
"(Note: in the implementation we included the factor $\\Delta x$ in the definition of $a$, for efficiency.)\n",
"Using the linear interpolation scheme,\n",
"\\begin{align*}\n",
"a(\\lambda) \\ &= \\ (1-\\lambda) a_{0} \\ + \\ \\lambda a_{1}, \\\\\n",
Expand Down Expand Up @@ -104,25 +105,25 @@
"\\end{align*}\n",
"for the source function, $S$, and the optical depth, $tau$, this yields,\n",
"\\begin{equation*}\n",
"\\Delta I \\ = \\ \\frac{1}{2\\Delta\\tau^{2}} \\Big( S_{0} \\, e^{-\\tau_{0}} \\left( e^{-\\Delta\\tau} - (1 - \\Delta\\tau) \\right) \\ + \\\n",
"\\Delta I \\ = \\ \\frac{1}{2\\Delta\\tau} \\Big( S_{0} \\, e^{-\\tau_{0}} \\left( e^{-\\Delta\\tau} - (1 - \\Delta\\tau) \\right) \\ + \\\n",
"S_{1} \\, e^{-\\tau_{1}} \\left( e^{+\\Delta\\tau} - (1 + \\Delta\\tau) \\right) \\Big),\n",
"\\end{equation*}\n",
"where $\\Delta\\tau \\equiv \\tau_{1} - \\tau_{0}$. This expression is numerically stable as long as $\\Delta \\tau$ is not too small, but will suffer from cancellation errors otherwise.\n",
"\n",
"Therefore, for $\\Delta \\tau < 10^{-2} we use the first four terms in the Taylor expansion,\n",
"Therefore, for $\\Delta \\tau < 10^{-2}$ we use the first four terms in the Taylor expansion,\n",
"\\begin{equation*}\n",
"\\begin{split}\n",
"& \\frac{1}{2\\Delta\\tau^{2}} \\left(e^{-\\Delta\\tau} - (1 - \\Delta\\tau) \\right) \\ \\approx \\ \\frac{1}{2} \\ - \\ \\frac{1}{6}\\Delta\\tau \\ + \\ \\frac{1}{120}\\Delta\\tau^{2} \\ - \\ \\frac{1}{24}\\Delta\\tau^{3}, \\\\\n",
"& \\frac{1}{2\\Delta\\tau^{2}} \\left(e^{+\\Delta\\tau} - (1 + \\Delta\\tau) \\right) \\ \\approx \\ \\frac{1}{2} \\ + \\ \\frac{1}{6}\\Delta\\tau \\ + \\ \\frac{1}{120}\\Delta\\tau^{2} \\ + \\ \\frac{1}{24}\\Delta\\tau^{3},\n",
"\\end{split}\n",
"\\frac{1}{2\\Delta\\tau} \\left(e^{-\\Delta\\tau} - (1 - \\Delta\\tau) \\right) \\ \\approx \\ \\frac{1}{2}\\Delta\\tau \\ - \\ \\frac{1}{6}\\Delta\\tau^{2} \\ + \\ \\frac{1}{120}\\Delta\\tau^{3} \\ - \\ \\frac{1}{24}\\Delta\\tau^{4},\n",
"\\end{equation*}\n",
"\n",
"\\begin{equation*}\n",
"\\frac{1}{2\\Delta\\tau} \\left(e^{+\\Delta\\tau} - (1 + \\Delta\\tau) \\right) \\ \\approx \\ \\frac{1}{2} \\Delta\\tau \\ + \\ \\frac{1}{6}\\Delta\\tau^{2} \\ + \\ \\frac{1}{120}\\Delta\\tau^{3} \\ + \\ \\frac{1}{24}\\Delta\\tau^{4},\n",
"\\end{equation*}"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"in which you can recognize the expansion of the exponential minus the first two terms.\n",
"The implementation of this intensity increment can be found in [src/p3droslo/forward.py](https://github.com/Magritte-code/p3droslo/blob/main/src/p3droslo/forward.py)."
]
Expand Down
Loading

0 comments on commit 48b6d8b

Please sign in to comment.