cana.spectools.taxonomytool

Tool for spectral taxonomic classification.

Functions

taxonomy(spec[, system, method, return_n, …]) Perform taxonomic classification.

Classes

TaxClass(obj_class, spec, compspec, …[, label]) A taxonomic class representation.
Taxonomy([system, norm]) Class to handle spectral taxonomic classification.
class cana.spectools.taxonomytool.TaxClass(obj_class, spec, compspec, tax2comp, system, norm, label=None)[source]

A taxonomic class representation.

Methods

chisquared(spec1, spec2) Calculate the chi-squared between two spectra.
classify(spec[, cmethod, return_n, fitspec]) Classify a spectrum in the defined taxonomic system.
is_primitive() Check if the closest class is an Primitive class.
plot([fax, show, savefig, axistitles, …]) Plot taxonomic classification.
plot_class(tclass[, region, tax2comp, fax, …]) Plot taxonomic class templates.
to_csv  
to_latex  
is_primitive()[source]

Check if the closest class is an Primitive class.

plot(fax=None, show=True, savefig=None, axistitles=True, speckwargs=None, legendkwargs=None, dotskwargs=None, taxkwargs=None)[source]

Plot taxonomic classification.

Parameters:
fax (Optional): matplotlib.axes

If desired to subplot image in a figure. Default is ‘None’, which will open a new plt.figure()

show (Optional): boolean

True if want to plt.show(). Default is True.

savefig (Optional): str

The path to save the figure. If set to None, wont save the figure. Default is None

specparams: dict

Arguments for matplotlib plot function, to be applied in the spectrum plot.

fitparams: dict

Arguments for matplotlib plot function, to be applied in the fitted spectrum plot (used for the classes comparison).

tclassparams: dict

Arguments for matplotlib plot function, to be applied in the plot for the classes.

class cana.spectools.taxonomytool.Taxonomy(system='demeo', norm=0.55)[source]

Class to handle spectral taxonomic classification.

Parameters:
tax: str

The taxonomic system. Default is ‘demeo’, for a classification in the Bus-Demeo scheme. Options are: ‘demeo’.

dataset: numpy record array

The mean values for the taxonomic classes.

norm: float

The normalization point.

Methods

chisquared(spec1, spec2) Calculate the chi-squared between two spectra.
classify(spec[, cmethod, return_n, fitspec]) Classify a spectrum in the defined taxonomic system.
plot_class(tclass[, region, tax2comp, fax, …]) Plot taxonomic class templates.
chisquared(spec1, spec2)[source]

Calculate the chi-squared between two spectra.

The wavelenghts of the two spectra should be the same.

Parameters:
spec1: numpy array

2D array corresponding to the wavelength and relative reflectance of an asteroid

spec2: numpy array

2D array corresponding to the wavelength and relative reflectance of the taxonomic class

Returns:
chi: int or float

The chi-squared value

classify(spec, cmethod='chi-squared', return_n=1, fitspec=True)[source]

Classify a spectrum in the defined taxonomic system.

Parameters:
spec: Spectrum object

The spec object in which the classification is being applied. It is set as None when the class is iniciated, and filled when the classify method is called.

cmethod: str
The classification method.

Defalt is ‘chi-squared’

fitspec: boolean

If required to fit the spectrum before interpolating the values to the comparison wavelengths. Default is True.

return_n: int

The number of classes to output. Default is 1: which will output the class with

the lowest chi-squared value.

Returns:
numpy record array
dtype = (‘tax’, ‘chi’)

tax: for the taxonomic classes chi: the chi-squared value for the class

plot_class(tclass, region=None, tax2comp=None, fax=None, axistitles=True, show=True, legendkwargs=None, taxkwargs=None)[source]

Plot taxonomic class templates.

cana.spectools.taxonomytool.taxonomy(spec, system='demeo', method='chisquared', return_n=3, norm=0.55, fitspec=False, speckwargs=None)[source]

Perform taxonomic classification.

Parameters:
spec: Spectrum object

The spec object in which the classification is being applied. It is set as None when the class is iniciated, and filled when the classify method is called.

system: str

The taxonomic system.For a classification in the Bus-Demeo scheme. Options are: ‘demeo’, ‘bus’ Default: ‘demeo’

method: str

The classification method. Defalt: ‘chi-squared’

fitspec: boolean

If required to fit the spectrum before interpolating the values to the comparison wavelengths. Default: True

return_n: int

The number of classes to output. Which will output the class with the lowest chi-squared value. Default: 3

norm: float

The normalization point.

Returns:
tclass: Taxonomic classification