Subobjects within the Project class

This page presents documentation for the subobjects that are contained within a Project object. All of the methods of these objects can be accessed from the Project object, so the documentation here is sparse. The Project object will contain ExperimentGroup and InterlabArray objects. ExperimentGroup objects will, in turn, contain DistanceMetric objects, and both InterlabArray and DistanceMetric objects will contain Population objects. Container objects usually contain an interface to the equivalent method in the contained object.

Class documentation

class utilities.ExperimentGroup(name=None, xdata=None, rawdata=None, data=None, data_names=None, distance_metrics=None, distribution=None)[source]

Container for spectral data and methods for analysis

This object contains a group of spectral measurements that are related, usually by being of the same physical object and having the same structure.

Key name:The name of the group of measurements.
Key data:Array of data to be used for the interlab analysis
Key rawdata:Array of unprocessed data, if different from data
Key data_names:List of data sets (labs) with data for each sample
Key distance_metrics:
 List of distance metrics. Each metric in this list will be used to create a DistanceMetric object.
Key distribution_function:
 Which distribution will be assumed when assigning Z scores to each measurement of a sample.
class utilities.InterlabArray(name=None, data_array=None, lablist=None, datasets=None, distribution_function=<scipy.stats._continuous_distns.lognorm_gen object>)[source]

Object for executing interlaboratory comparison

Key name:Name for the interlab object
Key data_array:Z-score array for the measurements in this interlaboratory study
Key lablist:List of laboratories that have data in this interlab
Key datasets:List of datasets that are in this interlab
Key distribution_function:
 Which distribution will be assumed when assigning Z scores to laboratories. The default is sp.stats.lognorm
class utilities.DistanceMetric(metric, function, distribution=None, mahalanobis_dict=None)[source]

A distance metric and the interspectral distances associated with it

Parameters:
  • metric – The name of the metric function
  • function – The metric function. Can be a binary function f(x,y) or a string identifying a metric recognized by scipy.spatial.distance.pdist()
Key distribution_function:
 

Which distribution will be assumed when assigning Z scores to each measurement of a sample.

Key mahalanobis_dict:
 
class utilities.Population(name, distribution=None, values=None)[source]

Object containing some values, a distribution function fit to those values, and corresponding scores

Parameters:name – The name assigned to this Population
Key distribution:
 Which distribution will be assumed when assigning Z scores to laboratories.
Key values:The values to which the distribution will be fit

Method summary

ExperimentGroup([name, xdata, rawdata, …]) Container for spectral data and methods for analysis
ExperimentGroup.distance(metric) Pass-through to DistanceMetric
ExperimentGroup.fit_zscores(metric) Pass-through to DistanceMetric
ExperimentGroup.find_outliers(metric, **kwargs) Pass-through to DistanceMetric
ExperimentGroup.histogram(metric, *args, …) Pass-through to DistanceMetric
ExperimentGroup.plot_data(ax[, linecolor]) Line plot of the spectral data in this group.
ExperimentGroup.plot_zscores(metric, *args, …) Pass-through to DistanceMetric
ExperimentGroup.distance_measure_plot(ax_row) Heatmaps of interspectral distances and (optionally) line plots of data
InterlabArray([name, data_array, lablist, …]) Object for executing interlaboratory comparison
InterlabArray.fit_transform() Fits the sklearn.pca object and then removes the mean-centering.
InterlabArray.fit_zscores(**kwargs) Pass-through for Population.fit_zscores
InterlabArray.find_outliers(**kwargs) Pass-through for Population.find_outliers
InterlabArray.plot_components(ax) Plots the principal component loadings for the statistical distances
InterlabArray.plot_zscores(*args, **kwargs) Plots the projected statistical distances annotated with the corresponding laboratory-level Z scores.
InterlabArray.plot_outliers(ax[, y_component]) Plots the principal component scores for each lab along with the final distribution used to calculate the outliers
DistanceMetric(metric, function[, …]) A distance metric and the interspectral distances associated with it
DistanceMetric.distance(data) Calculates the pairwise interspectral distances and the average interspectral distance, then loads the average distances into the Population.
DistanceMetric.fit_zscores(**kwargs) Pass-through to Population
DistanceMetric.find_outliers([recursive]) Pass-through to Population
DistanceMetric.plot_zscores(*args, **kwargs) Pass-through to Population
Population(name[, distribution, values]) Object containing some values, a distribution function fit to those values, and corresponding scores
Population.fit_zscores([data, mask]) Fit the distribution to the data using a provided mask and calculate the scores of the data
Population.find_outliers([recursive, …]) Finds the outliers of the distribution
Population.histogram(ax[, num_bins, …]) Plots a histogram of the populations values with the corresponding distribution function
Population.plot_zscores(ax[, rotation]) Plots a bar chart of the populations values and annotates it with the corresponding zscores