
Processing Module¶
flyeye.processing
provides tools for converting raw fluorescence measurements into developmental timepoints.
Triangulation¶
Tools for estimating the median distance between adjacent columns of R8 photoreceptors.
- class flyeye.processing.triangulation.ExperimentTriangulation(experiment, **kwargs)[source]¶
Object for estimating the median distance between adjacent columns of R8 cells for each disc within an experiment. Distance estimate is obtained by constructing a Delaunay graph connecting all annotated R8 neurons, filtering the edges by length and angle relative to the horizontal axis, then evaluating the median x-component of remaining edges.
The median inter-column distance is multiplied by the estimated MF velocity (0.5 columns/hr) to generate a distance-to-time scaling factor.
Attributes:
experiment (data.experiments.Experiment)
tri (dict) - {disc ID: Triangulation} pairs
- plot_expression(ax, channel, color='black', **kwargs)[source]¶
Plot expression for all triangulations.
- class flyeye.processing.triangulation.Triangulation(disc, furrow_velocity=2, threshold=None, min_angle=30, max_angle=60, include_x=True, include_y=False)[source]¶
Object for estimating the median distance between adjacent columns of R8 cells within an individual eye disc. Distance estimate is obtained by constructing a Delaunay graph connecting all annotated R8 neurons, filtering the edges by length and angle relative to the horizontal axis, then evaluating the median x-component of remaining edges.
The median inter-column distance is multiplied by the estimated MF velocity (0.5 columns/hr) to generate a distance-to-time scaling factor.
Attributes:
params (dict) - triangulation parameters, {name: value}
xycoords (np.ndarray) - R8 cell positions
delaunay (scipy.spatial.tri) - Delaunay triangulation
distances (np.ndarray) - distances between adjacent R8 cells
edges (np.ndarray) - edge vertices
hours_per_pixel (float) - distance to time scaling factor
disc (data.discs.Disc)
- add_edges_to_plot(ax, cmap=<matplotlib.colors.LinearSegmentedColormap object>)[source]¶
Add delaunay edges to existing axes.
- show(gs_parent=None, include_expression=True, channel=None, is_subplot=False, **kwargs)[source]¶
Plot inter-R8 distance distribution, Delaunay triangulation, and expression.
- triangulate(disc, furrow_velocity=2, threshold=None, min_angle=30, max_angle=60, include_x=True, include_y=False)[source]¶
Run triangulation.
Args:
disc (data.discs.Disc)
furrow_velocity (float) - furrow inverse-velocity (hr/column)
threshold (float) - max quantile of included distances, 0 to 100
min_angle, max_angle (float) - min/max angle of included edges
include_x (bool) - if True, include x-distance
include_y (bool) - if True, include y-distance
Alignment¶
Tools for aligning expression dynamics between populations of cells.
- class flyeye.processing.alignment.Alignment(t, x, t_ref=None, x_ref=None, metric='crosscorrelation', window_size=10)[source]¶
Object for alignment of a 1-D timeseries with another.
Attributes:
t, x (np.ndarray) - timeseries to be aligned
t_ref, x_ref (np.ndarray) - reference to which timeseries is aligned
window_size (int) - window size used for local smoothing
lag (float) - computed time shift for optimal alignment
score (float) - computed metric for quality of alignment
- align(metric='crosscorrelation', window_size=50, dt=0.1)[source]¶
Run alignment to determine optimal lag.
Args:
metric (str) - name of alignment criterion
window_size (int) - window size for local smoothing
dt (float) - resolution
Returns:
lag (float) - time shift that maximizes quality of alignment
score (float) - quality of alignment
- get_smoothed_scores(metric='crosscorrelation', window_size=10, dt=0.1)[source]¶
Returns smoothed alignment scores.
- class flyeye.processing.alignment.CellsAlignment(data, reference_data=None, channel='ch1_normalized', basis='t', metric='crosscorrelation', window_size=None)[source]¶
Object for alignment of one group of cells with another.
Attributes:
data (pd.DataFrame) - aligned cells data
Inherited attributes:
t, x (np.ndarray) - timeseries to be aligned
t_ref, x_ref (np.ndarray) - reference to which timeseries is aligned
window_size (int) - window size used for local smoothing
lag (float) - computed time shift for optimal alignment
score (float) - computed metric for quality of alignment
- class flyeye.processing.alignment.DiscAlignment(disc, reference_disc, channel='ch1_normalized', metric='crosscorrelation', window_size=None)[source]¶
Object for alignment of one Disc instance with another.
Attributes:
disc (data.discs.Disc) - copy of aligned disc instance
hours_per_pixel (float) - distance to time scaling factor
space_lag (float) - computed time shift for optimal alignment (x-units)
time_lag (float) - computed time shift for optimal alignment (t-units)
Inherited attributes:
t, x (np.ndarray) - timeseries to be aligned
t_ref, x_ref (np.ndarray) - reference to which timeseries is aligned
window_size (int) - window size used for local smoothing
lag (float) - computed time shift for optimal alignment
score (float) - computed metric for quality of alignment
data (pd.DataFrame) - aligned cells data
- class flyeye.processing.alignment.ExperimentAlignment(experiment, **kwargs)[source]¶
Object for the time-alignment of all discs within an experiment.
Attributes:
experiment (data.experiments.Experiment) - copy of experiment
scores (dict) - keys are disc IDs, values are quality of alignment
- class flyeye.processing.alignment.MultiExperimentAlignment(*experiments, **kwargs)[source]¶
Object for the time-alignment of multiple experiments. The first experiment serves as the reference.
Attributes:
experiments (list) - copies of Experiment instances
- static aggregate_discs(experiment)[source]¶
Aggregate all discs within an Experiment into single Cells object.
Args:
experiment (data.experiments.Experiment)
Returns:
cells (data.cells.Cells)