NDCombine: Fast ND arrays combination


This documentation is for the version currently under development.

CI Status Coverage Status

NDCombine is a Python package to combine efficiently n-dimensional arrays such as images or datacubes. It is implemented in Cython which allows to parallelize the computation at the C level with OpenMP.

Currently the implemented algorithms are:

  • Combination: mean, median, sum.

  • Rejection: sigma clipping, variance clipping.

If variance arrays are provided, the variance is propagated with the usual uncertainty propagation formulas.


  • Rejection algorithms: minmax (value or number or percentile ?)

  • Weights, scaling factor or function, offsets (?)


(Not yet on PyPI!)

The last stable release of NDCombine can be installed simply with pip:

pip install ndcombine


See this example notebook.


ndcombine.combine_arrays(data, mask=None, variance=None, clipping_limits=(3, 3), clipping_method='none', max_iters=100, method='mean', num_threads=0)[source]

Run the combination with an optional rejection.

  • data (list of ndarray or list of NDData) – Data arrays.

  • mask (list of ndarray, optional) – Mask arrays.

  • variance (list of ndarray, optional) – Variance arrays.

  • clipping_limits (tuple of int) – For sigma clipping, the lower and upper bounds: (sigma_lower, sigma_upper).

  • clipping_method (str, {'sigclip', 'varclip', 'none'}) – Clipping method.

  • max_iters (int) – Maximum number of iterations (for sigma clipping).

  • method (str, {'mean', 'median', 'sum'}) – Combination method.

  • num_threads (int) – Number of threads.