Skip to content

Measure phase angle

Question

How far is the daily marker from the zeitgeber transition?

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

When to use

Use this for the timing of onset, offset, or acrophase relative to a declared light or feeding transition.

Example figure

Measure phase angle output generated by Circadian Workbench

This deterministic example is calculated by the phase_angle action and drawn by render_phase_angle_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("phase_angle", recording={"path": "mouse01.awd"}, marker="onset")

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("phase_angle", recording, cohorts=None, config=None, marker=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.
cohorts object no null - Recordings grouped by label, to test whether the groups hold different angles of entrainment: {'WT': [spec, ...], 'KO': [...]}. One angle per animal, so the unit of analysis is the animal. Omit it and only the focal recording is answered for.
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.
marker string no null - Which daily marker the angle of entrainment is measured from: onset, offset or acrophase. Defaults to the entrainment_marker config key, and is never guessed from the data.

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

How it works

Daily marker times are compared with the chosen zeitgeber transition on the circle. Entrainment additionally requires clustered phase and no material daily drift.

$$ \Psi=\operatorname{wrap}(\text{marker}-\text{zeitgeber transition}) $$

Implementation: entrainment.py::phase_angle.

Outputs and interpretation

The result reports daily angles, circular mean, resultant length, Rayleigh evidence, phase drift, included days, entrainment verdict, and optional cohort comparison.

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

Real calendar timestamps and the actual schedule are required. A stable phase angle describes alignment but does not prove that the zeitgeber caused it.

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_phase-angle.csv, a standalone plot_phase-angle.py and source hashes; these companion files are not installed application files.

Methods text

Daily phase angle was calculated as the wrapped difference between the selected activity marker and the declared zeitgeber transition; clustering and drift were assessed before calling the record entrained.

See also

Fit a phase response curve · Measure a dose response · Measure re-entrainment · Analysis index · Gallery