astrodendro.pruning

The pruning module provides several functions to perform common pruning via the is_independent keyword in the Dendrogram compute() method.

Examples:

#prune unless leaf peak value >= 5
Dendrogram.compute(data, is_independent=min_peak(5))

#prune unless leaf contains 10 pixels
Dendrogram.compute(data, is_independent=min_npix(10))

#apply both criteria
is_independent = all_true((min_peak(5), min_npix(10)))
Dendrogram.compute(data, is_independent=is_independent)
astrodendro.pruning.min_delta(delta)

Minimum delta criteria

Parameters:

delta : float

The minimum height of a leaf above its merger level

astrodendro.pruning.min_sum(sum)

Minimum sum criteria

Parameters:

sum : float

The minimum sum of the pixel values in a leaf

astrodendro.pruning.min_peak(peak)

Minimum peak criteria

Parameters:

peak : float

The minimum peak pixel value in a leaf

astrodendro.pruning.min_npix(npix)

Minimum npix criteria

Parameters:

npix : int

The minimum number of pixels in a leaf

astrodendro.pruning.contains_seeds(seeds)

Critieria that leaves contain at least one of a list of seed positions

Parameters:

seeds : tuple of array-like

seed locations. The ith array in the tuple lists the ith coordinate for each seed. This is the format returned, e.g., by np.where

astrodendro.pruning.all_true(funcs)

Combine several is_independent functions into one

Parameters:

funcs : list-like

A list of is_independent functions

Returns:

combined_func : function

A new function which returns true of all the input functions are true