from nbdev.showdoc import *
from esploco import esplocoAPI
esploco.__init__
esploco.__init__ (dataFolder, startMin=0, endMin=120, companionEspObj=None, initialResamplePeriod=50, smoothing=True, longForm=False)
Reads and stores information from countLogs produced by Critta espresso plugin
| Type | Default | Details | |
|---|---|---|---|
| dataFolder | str | path to the directory containing all output files of espresso assay | |
| startMin | int | 0 | starting minute for analysis |
| endMin | int | 120 | ending minute for analysis |
| companionEspObj | NoneType | None | from the espresso analysis package |
| initialResamplePeriod | int | 50 | period of sample in ms (initialResamplePeriod = 50 ms, sampling frequency = 1000/50 = 20 Hz), default 50 |
| smoothing | bool | True | whether or not to smooth the trajectories, default True |
| longForm | bool | False | whether or not the data input is the same set of flies but over many days. |
| Returns | esploco object |
esploco.resultsDf : contains relevant output metrics esploco.resultsDf.ID : from metadataesploco.resultsDf.Status : ‘Test’ or ‘Ctrl’esploco.resultsDf.Genotype : genotypeesploco.resultsDf.Sex : from metadataesploco.resultsDf.MinimumAge : from metadataesploco.resultsDf.MaximumAge : from metadata esploco.resultsDf.Food1 : from metadataesploco.resultsDf.Food2 : from metadata esploco.resultsDf.Temperature : from metadata esploco.resultsDf.#Flies : from metadata esploco.resultsDf.Starvedhrs : from metadata esploco.resultsDf.Date : date of feedlogesploco.resultsDf.averageSpeed_mm/s : instantaneous speed of the fly esploco.resultsDf.xPosition_mm : instantaneous x position of the fly esploco.resultsDf.yPosition_mm : instantaneous y position of the fly esploco.resultsDf.inLeftPort : proportion of time the fly was in left portesploco.resultsDf.inRightPort : proportion of time the fly was in right port esploco.resultsDf.countLogDate : date from countlogesploco.resultsDf.feedLogDate : date from feedlog |
esploco.calculatePeriFeedSpeed
esploco.calculatePeriFeedSpeed (companionEspObj, monitorWindow=120, startSeconds=0, plotDiagonal=True, plotContrast=True)
Calculates speed of the fly around a feed
| Type | Default | Details | |
|---|---|---|---|
| companionEspObj | object, default None | from the espresso analysis package | |
| monitorWindow | int | 120 | size of the window in seconds before and after the feed to monitor speed in |
| startSeconds | int | 0 | lower range of data to analyse, deprecated in v.23.12.11 |
| plotDiagonal | bool | True | whether or not to plot the diagonal speed plot |
| plotContrast | bool | True | whether or not to plot the contrast plots |
| Returns | esploco.feedsRevisedDf |
pandas dataframe that contains individual feeds and info about them in a time series. |
esploco.calculateFallEvents
esploco.calculateFallEvents (nstd=4, windowsize=1000, ewm1=12, ewm2=26, ewm3=9)
Detects fall events
| Type | Default | Details | |
|---|---|---|---|
| nstd | int | 4 | parameter in macd analysis |
| windowsize | int | 1000 | window size in macd analysis |
| ewm1 | int | 12 | parameter in macd analysis |
| ewm2 | int | 26 | parameter in macd analysis |
| ewm3 | int | 9 | parameter in macd analysis |
| Returns | self.resultsDf |
updated to include falls |
esploco.plotStacked
esploco.plotStacked (endMin=120, metricsToStack=['Volume', 'Speed'], colorBy='Genotype', plotTitle='', customPalette=None, figsize=None, plotNonFeeders=True, dotratio=20, dotbase=5, dotalpha=0.4, bubbleYLabelSize=12, ylimPresets=None, showRasterYticks=False, ribbonLegend=False, bubbleLegend=True)
Plots a raster of feeds stacked with a selection of other metrics in a ribbon
esploco.plotChamberSmallMultiples
esploco.plotChamberSmallMultiples (ncol=15, customPalette=None, setNumber=None)
Plots trajectories and or heatmaps in the arrangement of the chambers for each dataset
| Type | Default | Details | |
|---|---|---|---|
| ncol | int | 15 | number of columns for the plots. |
| customPalette | NoneType | None | user can supply a dict for use as a custom palette. |
| setNumber | NoneType | None | user specfied set to plot. |
| Returns | chamberSmallsTrack |
figure object. |
esploco.plotMeanHeatMaps
esploco.plotMeanHeatMaps (binSize=0.2, row=None, col=None, reverseRows=False, reverseCols=False, verbose=False, heatmapCMap='RdYlBu_r', smooth=2, plotZScore=False, vmin=None, vmax=None)
Plots heatmap of mean duration stayed at each location throughout the chamber grouped by criteria
| Type | Default | Details | |
|---|---|---|---|
| binSize | float | 0.2 | the size of the pixel in the heatmap |
| row | NoneType | None | a column name or independent variable to use for grouping the rows |
| col | NoneType | None | a column name or independent variable to use for grouping the columns |
| reverseRows | bool | False | to reverse the order of the rows |
| reverseCols | bool | False | to reverse the order of the columns |
| verbose | bool | False | to produce output |
| heatmapCMap | str | RdYlBu_r | colormap used for the heatmap |
| smooth | int | 2 | this defines how much smoothing happenes in with the Gaussian Kernel. |
| plotZScore | bool | False | this toggles between plotting raw heatmap in seconds and z-score |
| vmin | NoneType | None | this forces the vmin on the heatmap color scale |
| vmax | NoneType | None | this forces the vmax on the heatmap color scale |
| Returns | meanHeatmapFig |
figure object. |