Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create function isStage #11

Open
jens-k opened this issue Sep 14, 2020 · 1 comment
Open

Create function isStage #11

jens-k opened this issue Sep 14, 2020 · 1 comment

Comments

@jens-k
Copy link
Member

jens-k commented Sep 14, 2020

@NNiethard comment in main function:
add a hypno function (adding for each sample the sleep stage) + a function that tells you for each sample whether its solid in a sleep stage: isStage(FT-Structure, sample, boundary_in_sec)

Problem: This would require the hypnogram and epoch length in the histogram (it would work on the output of detectEvents). What's the use case?

@jens-k
Copy link
Member Author

jens-k commented Sep 15, 2020

Something like this maybe?

function [stage, solid] = isStage(time, hyp, epoch_length, solid_margin, solid_range)
% Returns the sleep stage for a given time point. Also returns whether this
% time point is solid within that sleep stage (= more than solid_margin
% away from another stage) or any other sleep stage given in solid_range.
%
% INPUT VARIABLES:
% data							time (in sec) for which the sleep stage is 
%								requested
% hyp							hypnogram (num_epochs x 1)
% epoch_length					length of each epoch in hyp (in sec)
% solid_margin					optional; margin (in sec) around time point
%								to check for sleep stage changes (+/- solid_margin; e.g., 1.5)
% solid_range					        optional (only required if solid_margin is
%								provided); array of ints (n x 1); sleep
%								stages other than the current one
%								permissable for stage to be solid (e.g.,
%								for checking whether a time point is in
%								solid NREM sleep: [2 3 4])
% OUTPUT VARIABLES:
% stage							sleep stage of provided time point (taken from hyp)
% solid							logical; 1 if sleep stage does not change (or 
%								does not change to stage other than solid_range) 
%								within +/- solid_margin seconds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant