Skip to content

Measure food anticipation

Question

Did activity rise before the declared mealtime?

See every package-generated example · Read the complete analysis pipeline

When to use

Use this with a dated restricted-feeding schedule to quantify activity before mealtime and its acquisition across days.

Example figure

Measure food anticipation output generated by Circadian Workbench

This deterministic example is calculated by the food_anticipation action and drawn by render_food_anticipation_svg, the same renderer used for publication export. Empty or withheld elements are therefore visible exactly as they are in a real result.

import circadian_workbench as cw

cw.call("food_anticipation", recording={"path": "restricted_feeding.awd"})

Required inputs and controls

The public function is the registered action below. settings= is accepted as a friendlier alias for config= by cw.call; the calculation stores the complete normalized config in provenance.

Function reference

cw.call("food_anticipation", recording, config=None)

Arguments and parameters

Name Type Required Default Units Meaning
recording recording spec yes - The record to analyse: {'path': 'data/m01.awd'} (a bare path string also works), {'demo': true} for the built-in deterministic record, {'inline': {'filename': ..., 'text': ...}} for tabular text, {'trace': {'hours': [...], 'values': [...], 'name': ...}} for one elapsed-time trace, or {'channels': {'hours': [...], 'values': {'reporter_a': [...], 'reporter_b': [...]}}} for several measurements from one subject. A returned processed_trace spec retains transformed values, their original clock, source identity and explicit processing history. Versioned recording_snapshot specs are self-contained numeric inputs for replaying in-memory Recording objects; they do not invoke a raw-activity importer.
config object no null - Partial scientific settings. Omitted or None values use the shared installed defaults; invalid fresh values are rejected. Run describe_config for names, meanings, units, bounds and choices. Explicitly load old saved mappings with load_saved_settings to report compatibility conversions.

Every nested config key, default, allowed value, and purpose is listed in the complete configuration reference.

How it works

Pre-meal activity is compared with daily and post-meal activity. Acquisition is called only after the anticipatory ratio exceeds a baseline-derived criterion for a held run.

$$ \text{anticipation index}=\frac{A_{\mathrm{pre}}}{A_{\mathrm{pre}}+A_{\mathrm{post}}} $$

Implementation: feeding.py::food_anticipation.

Outputs and interpretation

Daily rows report pre-meal activity, ratios, anticipation index, criterion crossing, acquisition day, fasting-day handling, coverage, and inferential summary.

cw.call returns a Result: use .data for calculated values, .warnings for scientific qualifications, .provenance for version and input identity, .script for an equivalent replay script, and .files for saved outputs.

Limitations

A declared feeding schedule and enough covered feeding days are required. Increased total daily activity alone does not establish food anticipation.

Example

The figure above is a real package result from a seeded, redistributable synthetic dataset. Its editable SVG embeds the exact plotted data and provenance and is included with a rendered preview in the installed help. The separate authoring bundle retains figure_data_food-anticipation.csv, a standalone plot_food-anticipation.py and source hashes; these companion files are not installed application files.

Methods text

Food-anticipatory activity was quantified in the declared pre-meal window relative to daily and post-meal activity; acquisition required the baseline-derived criterion to hold for the configured number of days.

See also

Score immobility sleep · Find ultradian rhythms · Test temperature compensation · Analysis index · Gallery