File: performance.inc.rst

package info (click to toggle)
astropy 5.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 41,972 kB
  • sloc: python: 219,331; ansic: 147,297; javascript: 13,556; lex: 8,496; sh: 3,319; xml: 1,622; makefile: 185
file content (20 lines) | stat: -rw-r--r-- 1,053 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
.. note that if this is changed from the default approach of using an *include*
   (in index.rst) to a separate performance page, the header needs to be changed
   from === to ***, the filename extension needs to be changed from .inc.rst to
   .rst, and a link needs to be added in the subpackage toctree

.. _astropy-nddata-performance:

Performance Tips
================

+ Using the uncertainty class `~astropy.nddata.VarianceUncertainty` will
  be somewhat more efficient than the other two uncertainty classes,
  `~astropy.nddata.InverseVariance` and `~astropy.nddata.StdDevUncertainty`.
  The latter two are converted to variance for the purposes of error
  propagation and then converted from variance back to the original
  uncertainty type. The performance difference should be small.
+ When possible, mask values by setting them to ``np.nan`` and use the
  ``numpy`` functions and methods that automatically exclude ``np.nan``,
  like ``np.nanmedian`` and ``np.nanstd``. This will typically be much
  faster than using `numpy.ma.MaskedArray`.