Time courses, preference and transitions

How feeding develops over the recording, food preference, switching between foods and distributions.

✓ All descriptions on these pages have been reviewed against the current analysis code.

Time courses

Grid of 1000-sample bins (10.0 s). Column k holds the events up to and including sample k × 1000 (MATLAB cumsum(...)(1:SFactor:end)). Curves = mean ± SEM over flies (SEM = sample SD / sqrt(n)).

PI = (S1 − S2) / (S1 + S2 + 2)S = sips (or activity) of the same fly on substrate 1 and 2, cumulative or per time bin
Figure 5. Preference index of one fly over time (constructed example): (S1 - S2) / (S1 + S2 + 2) from its cumulative sips on the two substrates.
Figure 5. Preference index of one fly over time (constructed example): (S1 – S2) / (S1 + S2 + 2) from its cumulative sips on the two substrates.

Cumulative sips / feeding bursts

per fly and time binunit: count
How it is computed

Number of sip (burst) onsets up to the end of the bin. For a recording shorter than the analysis duration the bins after its end are empty (no data), not 0, and are left out of the group mean/median.

Interpretation

Time course of intake; the slope is the feeding rate.

MATLAB: CumulativeFeedingEvents_2S.m
Where: Cumulative plots, Cumulative*InExcelFormat.xlsx
Code: analysis/cumulative.py::compute_cumulative_events · fingerprint 69903d3cb515

Cumulative activity

per fly and time binunit: s
How it is computed

Active samples up to the end of the bin / 100. Bins after the end of a shorter recording are empty (no data), as for cumulative sips.

Interpretation

Time course of engagement with the food.

MATLAB: CumulativeActBouts_2S.m
Code: analysis/cumulative.py::compute_cumulative_events · fingerprint 69903d3cb515

Non-cumulative (per bin)

per fly and time binunit: count or s per bin
How it is computed

Difference of consecutive cumulative values (first bin = its own value).

Interpretation

Instantaneous rate; shows satiation (decline) or late feeding.

MATLAB: NONCumulative*_2S.m, CumDifference
Code: analysis/cumulative.py::compute_non_cumulative_rates · fingerprint cc8e1b6009eb

Preference index (sips, activity)

per fly and time binunit: -1 .. 1
How it is computed

(S1 – S2) / (S1 + S2 + 2) with S = cumulative (or per-bin) value of substrate 1 / 2 of the same fly (MATLAB adds 1 to each count). Flies are paired explicitly; a fly missing one substrate is left out. Bins without data (after a shorter recording's end) are left out of the mean/median. When conditions have their own food pairs, each condition's PI compares its own two foods (legend: C01 (1 mM vs 2 mM)).

Interpretation

+1 = only substrate 1, -1 = only substrate 2, 0 = no preference or no feeding. The +2 pulls values of flies with few events towards 0.

MATLAB: CumulPI, nonCumulPI, CumulBoutsPI
Where: Preference index plots, *PIInExcelFormat.xlsx
Code: analysis/preference_index.py::compute_preference_index, analysis/cumulative.py::_summarise · fingerprint 752f4ca823bd

Time-resolved per-fly parameters

per fly and time binunit: count or s
How it is computed

Number of transitions, median transition IBI, median activity bout duration and median bout IBI per bin (events assigned to the bin of their time sample), cumulative and per bin. One row per fly, one column per 10-s bin; recordings longer than 45.5 h (more bins than Excel's 16,384 columns) get the same grids as CSV files in TimeResolvedCSV/, one per sheet.

Interpretation

Changes of visit and switching behaviour over the recording.

MATLAB: ExportExtraTimeResolvedOutputs.m
Where: Cumulative/NONCumulative*InExcelFormat.xlsx, FlyIndexInExcelFormat.xlsx
Code: export/extra_outputs.py::export_extra_time_resolved, export/extra_outputs.py::bin_events_to_grid · fingerprint e2a600eeb198

Substrate transitions (two substrates)

Only for configurations with two substrates per fly.

Figure 6. Substrate transitions (constructed example): after each visit (activity bout) of one cup, the time until the fly starts a visit on the other cup, if it did not go back to the same cup first.
Figure 6. Substrate transitions (constructed example): after each visit (activity bout) of one cup, the time until the fly starts a visit on the other cup, if it did not go back to the same cup first.

Transition IBI

per transitionunit: s
How it is computed

For each activity bout offset on one substrate: the time to the next bout onset on the other substrate, counted only if the fly reaches the other substrate before its own next bout on the same substrate.

Interpretation

Travel time between the two foods when switching; the number of transitions measures switching between foods (exploration / choice).

MATLAB: PostProcess TransitionIBI, TransitionSample
Code: analysis/statistics.py::compute_transition_metrics, export/extra_outputs.py::transitions · fingerprint dd519f804342

Number of transitions / median transition IBI

per fly and directionunit: count, s
How it is computed

Per fly: number of transition IBIs (0 if none) and their median (left out if none), for substrate 1 → 2 and 2 → 1.

Interpretation

Frequency and speed of switching.

MATLAB: NumberOfTransitionIBIs, DurationOfTransitionIBIs
Where: Transition IBIs plot
Code: analysis/statistics.py::compute_transition_metrics · fingerprint 4fe961c25f12

Visit sequence / transition matrix

per flyunit: -
How it is computed

Activity bouts of both cups in time order as visits A/B; counts and probabilities of A→A, A→B, B→A, B→B. With per-condition food pairs, the food names in the tables are those of the fly's condition.

Interpretation

Structure of food choice over time (staying vs switching).

MATLAB: ExportTransitionSequences.m
Where: TransitionSequence*.xlsx/csv, TransitionMatrixInExcelFormat.xlsx
Code: export/extra_outputs.py::export_transition_sequences · fingerprint be4c0fb2bf42

Distributions

Sip duration / inter-sip interval histograms

per binunit: count per fly
How it is computed

Per fly: MATLAB hist(x, 1:50) – bin centres 1..50 samples (10-500 ms), values outside counted in the end bins (the last bin therefore also holds everything > 0.5 s). Curves = mean ± SEM over all flies (flies without sips count as zeros).

Interpretation

Shape of the sip and rhythm distributions (e.g. a peak shift = slower rhythm). The last bin is inflated by long values by design.

MATLAB: dataHist, GetAnyEvents(@hist)
Where: Histogram plots, Sip*HistogramsInExcelFormat.xlsx
Code: analysis/distributions.py::matlab_hist, analysis/distributions.py::compute_grouped_histograms, analysis/distributions.py::collect_per_fly_histograms · fingerprint 0245fcda189c

CCDF

per valueunit: fraction
How it is computed

1 – empirical CDF of all values of a condition (plot currently disabled).

Interpretation

Tail of distributions on log scales.

Code: analysis/distributions.py::compute_ccdf · fingerprint ccdca7dfcfa5