Skip to content

Commit

Permalink
typos in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zblz committed Feb 1, 2015
1 parent 6cd4e86 commit 025d7c2
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 29 deletions.
15 changes: 8 additions & 7 deletions docs/MCMC.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,33 @@ Under this assumption, the likelihood of observed data given the spectral model

.. math::
\mathcal{L} = \prod^N_{i=1} \frac{1}{\sqrt{2 \pi \sigma^2_i}}
\exp\left(-\frac{(S(\vec{p};E_i) - F_i)^2}{2\sigma^2_i}\right)
\exp\left(-\frac{(S(\vec{p};E_i) - F_i)^2}{2\sigma^2_i}\right),
where :math:`(F_i,\sigma_i)` are the flux measurement and uncertainty at an
energy :math:`E_i` over :math:`N` spectral measurements. Taking the logarithm,

.. math::
\ln\mathcal{L} = K - \sum^N_{i=1} \frac{(S(\vec{p};E_i) - F_i)^2}{2\sigma^2_i}
\ln\mathcal{L} = K - \sum^N_{i=1} \frac{(S(\vec{p};E_i) - F_i)^2}{2\sigma^2_i}.
Given that the MCMC procedure will sample the areas of the distribution with
maximum value of the objective function, it is useful to define the objective
function as the negative log-likelihood (NLL) disregarding constant factors:

.. math::
\mathrm{NLL} = \sum^N_{i=1} \frac{(S(\vec{p};E_i) - F_i)^2}{\sigma^2_i}
\mathrm{NLL} = \sum^N_{i=1} \frac{(S(\vec{p};E_i) - F_i)^2}{\sigma^2_i}.
The NLL function in this assumption can be related to the :math:`\chi^2`
parameter as :math:`\chi^2=-2\mathrm{NLL}`, so that maximization of the NLL is
equivalent to a minimization of :math:`\chi^2`.

This NLL function is passed onto the `emcee.EnsembleSampler`, and the MCMC run
is started. `emcee <http://dan.iel.fm/emcee/current/>`_ uses an affine-invariant
MCMC sampler (`Goodman & Weare (2010)
MCMC sampler (`Goodman & Weare 2010
<http://msp.org/camcos/2010/5-1/p04.xhtml>`_) that has the advantage of being
able to sample complex parameter spaces without any sampling. In addition,
having multiple simultaneous *walkers* improves the efficiency of the sampling
and reduces the number of computationally-expensive likelihood calls required.
able to sample complex parameter spaces without any tuning required. In
addition, having multiple simultaneous *walkers* improves the efficiency of the
sampling and reduces the number of computationally-expensive likelihood calls
required.

The sampler works best by using as many samplers as possible, and starting them
in a compact ball around the best fitting parameter values. After a *burn-in*
Expand Down
10 changes: 0 additions & 10 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,4 @@ version is released), install ``naima`` from the `github repository`_ through pi

pip install git+http://github.com/zblz/naima.git#egg=naima


Contributing
------------

All development of ``naima`` is done through the `github repository`_, and
contributions to the code are welcome. The development model is similar to that
of `astropy`_, so you can check the `astropy Developer Documentation
<https://astropy.readthedocs.org/en/latest/#developer-documentation>`_ if you
need information on how to make a code contribution.

.. _github repository: https://github.com/zblz/naima
19 changes: 10 additions & 9 deletions docs/radiative.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ advantage of being computationally cheap compared to a numerical integration
over the spectrum of the blackbody, and remain accurate within one percent over
a wide range of energies. Both the isotropic IC and anisotropic IC
approximations are available in ``naima``. If you use this class in your
research, please cite `Khangulyan, D., Aharonian, F.A., & Kelner, S.R. 2014,
Astrophysical Journal, 783, 100
research, please consult and cite `Khangulyan, D., Aharonian, F.A., & Kelner,
S.R. 2014, Astrophysical Journal, 783, 100
<http://adsabs.harvard.edu/abs/2014ApJ...783..100K>`_.

.. _Khangulyan et al. (2014): http://adsabs.harvard.edu/abs/2014ApJ...783..100K
Expand Down Expand Up @@ -152,7 +152,7 @@ A full description and derivation of its properties can be found in `Blumenthal
uniform magnetic field direction, but that is rarely thought to be the case in
astrophysical sources. Considering random magnetic fields results in a shift of
the maximum emissivity from :math:`E_\mathrm{peak}=0.29 E_\mathrm{c}` to
:math:`0.3 E_c`, where :math:`E_c` is the synchrotron characteristic energy. The
:math:`0.23 E_c`, where :math:`E_c` is the synchrotron characteristic energy. The
`~naima.models.Synchrotron` class implements the parametrization of the
emissivity function of synchrotron radiation in random magnetic fields presented
by `Aharonian et al. (2010; Appendix D)`_. This parametrization is particularly
Expand All @@ -173,15 +173,15 @@ Nonthermal Bremsstrahlung radiative model

Nonthermal bremsstrahlung radiation arises when a population of relativistic
particles interact with a thermal particle population (see `Blumenthal & Gould
(1970)`_). For the computation of the bremsstrahlung emission spectrum, The
1970`_). For the computation of the bremsstrahlung emission spectrum, The
`~naima.models.Bremsstrahlung` class implements the approximation of `Baring et
al. (1999)`_ to the original cross-section presented by `Haug (1975)`_.
Electron-electron bremsstrahlung is implemented for the complete energy range,
whereas electron-ion bremsstrahlung is at the moment only available for photon
energies above 10 MeV. The normalization of the emission, and importance of the
electron-electron versus the electron-ion channels, are given by the class
arguments ``n0`` (ion total number density), ``weight_ee`` (weight of the e-e
channel, given by :math:`\sum_i Z_i X_i`, and ``weight_ep`` (weight of the e-p
channel, given by :math:`\sum_i Z_i X_i`), and ``weight_ep`` (weight of the e-p
channel, given by :math:`\sum_i Z_i^2 X_i`). The defaults for ``weight_ee`` and
``weight_ep`` correspond to a fully ionised medium with solar abundances.

Expand All @@ -202,8 +202,8 @@ followed by pion decay, which results in a photon with :math:`E_\gamma >
100\,\mathrm{MeV}`. Until recently, the only parametrizations available for the
integral cross-section and photon emission spectra were either only applicable
to limited energy ranges, or were given as extensive numerical tables (e.g.,
`Kelner et al. (2006) <http://ukads.nottingham.ac.uk/abs/2006PhRvD..74c4018K>`_;
`Kamae et al. (2006) <http://ukads.nottingham.ac.uk/abs/2006ApJ...647..692K>`_).
`Kelner et al. 2006 <http://ukads.nottingham.ac.uk/abs/2006PhRvD..74c4018K>`_;
`Kamae et al. 2006 <http://ukads.nottingham.ac.uk/abs/2006ApJ...647..692K>`_).
By considering Monte Carlo results and a compilation of accelerator data on p-p
interactions, `Kafexhiu et al. (2014)
<http://adsabs.harvard.edu/abs/2014PhRvD..90l3014K>`_ were able to develop
Expand All @@ -212,8 +212,9 @@ rays from p-p interactions. The `~naima.models.PionDecay` class uses an
implementation of the formulae presented in their paper, and gives the choice of
which high-energy model to use (from the parametrization to the different Monte
Carlo results) through the `hiEmodel` parameter. If you use this class, please
cite `Kafexhiu, E., Aharonian, F., Taylor, A.M., & Vila, G.S. 2014, Physical
Review D, 90, 123014 <http://adsabs.harvard.edu/abs/2014PhRvD..90l3014K>`_.
consult and cite `Kafexhiu, E., Aharonian, F., Taylor, A.M., & Vila, G.S. 2014,
Physical Review D, 90, 123014
<http://adsabs.harvard.edu/abs/2014PhRvD..90l3014K>`_.


.. _Blumenthal & Gould 1970:
Expand Down
6 changes: 3 additions & 3 deletions docs/units.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Units system used
=================

The package makes use of the :mod:`astropy.units` package to handle units and
unit conversions. Several of the options that need to be specified in the
functions described below require :class:`~astropy.units.quantity.Quantity`
instances. Defining quantities is straightforward::
unit conversions. Several of the arguments of the functions and classes of
``naima`` require :class:`~astropy.units.quantity.Quantity` instances. Defining
quantities is straightforward::

from astropy import units as u

Expand Down

0 comments on commit 025d7c2

Please sign in to comment.