Measure acute masking¶
Question¶
Did a light pulse change activity while it was present?
See every package-generated example · Read the complete analysis pipeline
When to use¶
Use this for the immediate activity response during a light pulse, distinct from a later clock phase shift.
Example figure¶
This deterministic example is calculated by the masking action and drawn by render_masking_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("masking", recording={"path": "mouse01.awd"}, pulse_start="2026-01-12T22:00", pulse_hours=1)
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("masking", recording, pulse_start, pulse_hours, 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. |
pulse_start |
string | yes | — | - | When the light pulse began, as an ISO date-time (2026-05-11T22:00). The same clock window on the days before it becomes the control. |
pulse_hours |
float | yes | — | hours | How long the pulse lasted. Must be greater than zero. |
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¶
Activity during the declared pulse duration is compared with the same clock-time window on preceding control days using a predictive t statistic.
$$ t=\frac{x_{\mathrm{pulse}}-\bar x_c}{s_c\sqrt{1+1/n_c}} $$
Implementation: entrainment.py::masking.
Outputs and interpretation¶
The result reports pulse and control activity, change and percentage change, predictive interval, p value, coverage, direction, significance, and matched control dates.
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¶
At least half of the pulse window and the configured number of control days must be covered. Masking is an acute response and is not evidence of phase resetting.
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_masking.csv, a standalone plot_masking.py and source hashes; these companion files are not installed application files.
Methods text¶
Activity during the declared pulse start and duration was compared with the same clock-time interval on preceding control days using a predictive t statistic.
See also¶
Fit a phase response curve · Measure a dose response · Measure phase angle · Analysis index · Gallery