dreye.ReceptorEstimator#
- class dreye.ReceptorEstimator(filters, domain=1.0, filters_uncertainty=None, w=1.0, labels=None, K=1.0, baseline=0.0, sources=None, lb=None, ub=None, sources_labels=None)[source]#
Core class in drEye for analyzing and fitting to capture values given a set of receptor filters and a set of stimulation sources that comprise an experimental system.
- Parameters:
- filtersndarray of shape (n_filters, n_domain)
Filter functions for each receptor type.
- domainfloat or ndarray of shape (n_domain), optional
Domain array specifying the domain covered by the filter function. If float, it is assumed to be the step size in the domain (e.g. dx=1nm for wavelengths). If array-like, it is assumed to be an ascending array where each element is the value in domain coordinates (e.g. [340, 350, …, 670, 680]nm for wavelengths). By default 1.0.
- filters_uncertaintyndarray of shape (n_filters, n_domain) or (n_samples, n_filters, n_domain), optional
The standard deviation for each element in filters. If the array has three dimensions, the array is assumed to correspond to samples from a distribution of filters. By default None.
- wfloat or ndarray of shape (n_filters), optional
Importance weighting for each filter during fitting procedures, by default 1.0.
- labelsndarray of shape (n_filters), optional
The label names of each filter, by default None
- Kfloat or ndarray of shape (n_filters) or (n_filters, n_filters), optional
The adaptational state of each receptor type, by default 1.0.
- baselinefloat or ndarray of shape (n_filters), optional
The baseline capture value of each receptor type, by default 0.0
- sourcesndarray of shape (n_sources, n_domain), optional
The stimulation sources’ normalized (excitation/spectral) distribution, by default None
- lbfloat or ndarray of shape (n_sources), optional
The lower bound value for each stimulation source, by default set to 0.
- ubfloat or ndarray of shape (n_sources), optional
The upper bound value for each stimulation source, by default set to inf
- sources_labelsndarray of shape (n_sources), optional
The label names of each source, by default None
Attributes
Stimulation system is registered
If targets have been registered.
Stimulation system underdetermined
Methods
capture(signals[, domain])Calculate the absolute excitation/light-induced capture.
compute_gamut(*args, **kwargs)Alias for ReceptorEstimator.compute_hull.
compute_hull([fraction, at_l1, metric, ...])Compute the hull metric.
filter_plot([ax, colors, labels])Plot the filter functions.
fit([B, model, batch_size, verbose])Fitting source intensities given relative capture values.
fit_adaptive([B, neutral_point, ...])Fit source intensities adaptively to fit capture values within the system's hull.
fit_decomposition([B, n_layers, mask, lbp, ...])Fit source intensities by assigning sources adaptively to independent layers.
fit_underdetermined([B, ...])Fit capture values that are within the system's hull and where the system is underdetermined (i.e. multiple solutions exist).
gamut_dist_scaling(*args, **kwargs)Alias for ReceptorEstimator.hull_dist_scaling
gamut_l1_scaling(*args, **kwargs)Alias for ReceptorEstimator.hull_l1_scaling
gamut_plot(*args, **kwargs)Alias for ReceptorEstimator.hull_plot.
hull_dist_scaling(B[, neutral_point, relative])Scale B within L1-normalized simplex plot to fit within hull of system.
hull_l1_scaling(B[, relative])Scale B to fit within the hull of the system.
hull_plot([B, axes, labels, sources_labels, ...])Plot the hull of the system on all possible pairs of filter combinations (2D-plot).
in_gamut(*args, **kwargs)Alias for ReceptorEstimator.in_hull.
in_hull([B, relative, normalized])If relative captures are within the system's hull.
in_system(X)Are a set of intensities within the bounds?
minimize_variance([B, Epsilon, batch_size, ...])Minimize the variance of capture values given the fitted intensities.
range_of_solutions([B, relative, error, n, eps])Range of possible solutions for capture values.
Register a new adaptational state.
register_background_adaptation(background[, ...])Register a new adaptational state using a background excitation function.
register_baseline(baseline)Register a new baseline value
register_bounds([lb, ub])Register new lower and upper bounds, if given.
register_system(sources[, domain, lb, ub, ...])Register a new stimulation system.
register_system_adaptation(x[, ...])Register an adaptational state according to a set of intensities
register_targets(B[, W])Register a set of relative total capture values.
register_uncertainty(filters_uncertainty)Register a new filter uncertainty function
relative_capture(signals[, domain])Calculate the relative capture given a signal
sample_in_gamut(*args, **kwargs)Alias for ReceptorEstimator.sample_in_hull.
sample_in_hull([n, seed, engine, l1, relative])Sample capture values within the hull of the stimulation system.
simplex_plot([B, domain, ax, cmap, ...])Plot the simplex plot (aka chromaticity diagram) of all filter types.
sources_plot([ax, colors, labels])Plot the normalized excitation functions of the sources.
Calculate the absolute light-induced capture given intensities of the stimulation system.
Calculate the relative total capture given intensities of the stimulation system.
uncertainty_capture(signals[, domain])Calculate the variance of the absolute excitation/light-induced capture.