pareto_sd: Apply Pareto rule to wake behavior during SD

View source: R/qc.R

pareto_sdR Documentation

Apply Pareto rule to wake behavior during SD

Description

Require significant tube exploration to label behavior as awake.

Usage

dt_raw <- load_ethoscope(linked_metadata, FUN=sleepr::sleep_annotation) # or whatever annotation function
dt <- behavr::bin_apply_all(dt_raw, x="t", y="x", x_bin_length=behavr::mins(30), FUN=pareto_sd)

Arguments

x

Position of the animal along the main axis of variation, normalized from 0 to 1

n

Number of splits in the ROI. default 10

min_max_crop

If TRUE, x is normalized so the minimum value is 0 and the maximum is 1 This is useful if the ROI is much wider than the tube (which would mean that some sections of the tube actually cannot be explored by the fly)

space_fraction

Minimum fraction of tube that a wake animal explores. If the animal explores less than this, it is not awake

time_fraction

Maximum fraction of time that a wake animal is allowed to stay in the p fraction of the tube

Details

Minor movements (indicating little awakeness) or spiky artifacts during real sleep both result in a very small fraction of the tube being explored by the animal in a given interval of time.

This function checks that the animal did not spend > time_fraction in < space_fraction of the tube while awake, If the animal breaks this check (it spends too much time in too little space) the animal is asleep.

This make sense to do during SD because the tracking quality decreases due to background changes produced by the SD itself

Value

TRUE if the tube exploration is < expected with Pareto and FALSE otherwise A result of TRUE indicates thus a problematic data

See Also

Other pareto_sd: apply_pareto_rule()


shaliulab/fslretho documentation built on Jan. 30, 2023, 9:16 p.m.