API Reference

Input/Output

Loading and saving routines to be used with the AstroLink class.

Author: William H. Oliver <william.hardie.oliver@gmail.com> License: MIT

astrolink.io.loadAstroLinkObject(fileName)

Load a saved AstroLink instance.

Parameters

fileNamestr

The name of the file to load the instance from.

Returns

clustererAstroLink

The loaded AstroLink instance.

astrolink.io.saveAstroLinkObject(clusterer, fileName)

Save an AstroLink instance.

Parameters

clustererAstroLink

The AstroLink instance to save.

fileNamestr

The name of the file to save the instance to.

Visualization

Plotting routines to be used with the AstroLink class.

Author: William H. Oliver <william.hardie.oliver@gmail.com> License: MIT

astrolink.visualize.aggregationTree(clusterer, ax=None, plotKwargs={}, treeKwargs={})

Make the AstroLink aggregation tree plot.

Parameters

clustererAstroLink

An instance of the AstroLink class.

axmatplotlib.axes._axes.Axes

The axes on which to plot the aggregation tree. If not provided, the current axes will be used.

plotKwargsdict, optional

Keyword arguments to be passed to the plot function that makes the ordered-density function.

treeKwargsdict, optional

Keyword arguments to be passed to the hlines and vlines functions that make the aggregation tree.

astrolink.visualize.labelsOnX(clusterer, X, skipZeroth=True, ax=None, scatterKwargs={})

Make a plot of the data X coloured by the AstroLink cluster labels.

Parameters

clustererAstroLink

An instance of the AstroLink class.

Xarray

The data to be plotted.

axmatplotlib.axes._axes.Axes

The axes on which to plot the data. If not provided, the current axes will be used.

scatterKwargsdict, optional

Keyword arguments to be passed to the scatter function.

astrolink.visualize.logRhoOnX(clusterer, X, ax=None, colorbar=True, scatterKwargs={}, colorbarKwargs={})

Make a plot of the data X coloured by the AstroLink log-density on the data.

Parameters

clustererAstroLink

An instance of the AstroLink class.

Xarray

The data to be plotted.

axmatplotlib.axes._axes.Axes

The axes on which to plot the data. If not provided, the current axes will be used.

colorbarbool, optional

Whether to add a colour bar to the plot.

scatterKwargsdict, optional

Keyword arguments to be passed to the scatter function.

colorbarKwargsdict, optional

Keyword arguments to be passed to the colorbar function.

astrolink.visualize.orderedDensity(clusterer, skipZeroth=True, ax=None, plotKwargs={}, fillKwargs={})

Make the AstroLink ordered-density plot.

Parameters

clustererAstroLink

An instance of the AstroLink class.

axmatplotlib.axes._axes.Axes, optional

The axes on which to plot the ordered density. If not provided, the current axes will be used.

plotKwargsdict, optional

Keyword arguments to be passed to the plot function that makes the ordered-density function.

fillKwargsdict, optional

Keyword arguments to be passed to the fill_between function that highlights the clusters.

Returns

linematplotlib.lines.Line2D

The line object representing the dendrogram.

polyCollectionslist of matplotlib.collections.PolyCollection

The PolyCollection objects representing the clusters as filled regions on the ordered-density plot.

astrolink.visualize.prominenceModel(clusterer, ax=None, histKwargs={}, modelKwargs={}, cutoffKwargs={})

Make a plot of AstroLink prominences.

Parameters

clustererAstroLink

An instance of the AstroLink class.

axmatplotlib.axes._axes.Axes

The axes on which to plot the prominences. If not provided, the current axes will be used.

histKwargsdict, optional

Keyword arguments to be passed to the hist function.

modelKwargsdict, optional

Keyword arguments to be passed to the plot function for the fitted prominence model.

cutoffKwargsdict, optional

Keyword arguments to be passed to the vlines function for the cutoff value.

Returns

harray

The values of the histogram bins.

binsarray

The edges of the bins.

patcheslist of matplotlib.patches.Patch

The Patch objects representing the histogram bars.

linematplotlib.lines.Line2D

The line object representing the fitted prominence model.

lineCollectionmatplotlib.collections.LineCollection

The LineCollection object representing the cutoff over the prominences histogram.

astrolink.visualize.significanceModel(clusterer, ax=None, histKwargs={}, modelKwargs={}, cutoffKwargs={})

Make a plot of AstroLink significances.

Parameters

clustererAstroLink

An instance of the AstroLink class.

axmatplotlib.axes._axes.Axes

The axes on which to plot the significances. If not provided, the current axes will be used.

histKwargsdict, optional

Keyword arguments to be passed to the hist function.

modelKwargsdict, optional

Keyword arguments to be passed to the plot function for the fitted significance model.

cutoffKwargsdict, optional

Keyword arguments to be passed to the vlines function for the cutoff value.

Returns

harray

The values of the histogram bins.

binsarray

The edges of the bins.

patcheslist of matplotlib.patches.Patch

The Patch objects representing the histogram bars.

linematplotlib.lines.Line2D

The line object representing the fitted prominence model.

lineCollectionmatplotlib.collections.LineCollection

The LineCollection object representing the cutoff over the prominences histogram.