PercentSleep Manual

advertisement
Percent Sleep Intervals(v1.1)
October 2014
Convert MouseRec Sleep-Wake Feature Vector
Files
Copyright 2013: Signal Solutions , LLC, Lexington, KY 40503, www.sigsoln.com
Percent Sleep Intervals(v 1.1)
Kevin D. Donohue (kevin.donohue@sigsoln.com) and Jeffrey Ashley, Jr.
(jeff.ashley@sigsoln.com)
October 2014
Table of Contents
1
Introduction: ........................................................................................................................2
2
Installation ...........................................................................................................................2
3
Using Software ....................................................................................................................3
4
Notes .................................................................................................................................. 5
1
1 Introduction:
Percent Sleep is a Windows application that can be used to open the feature vector files from
Signal Solutions’ software products MouseRec or PiezoSleep, which perform data acquisition
with sleep-wake monitoring. Percent Sleep opens the feature vector files (FeatVec extension)
and creates a series of files that describe the data and sleep-wake behavior in terms of sleep
percentages over user defined intervals. The output files are in .csv format (comma separated
values) that can be easily imported to any spreadsheet software. This program was designed to
make information from experimental recordings from MouseRec or PiezoSleep widely
accessible. Useful information is extracted in the form of sleep percentages that can be used to
compute more complex sleep-wake characteristics. If more advanced analysis is required, Signal
Solutions sells advanced toolboxes in Matlab, as well as stand-alone products and custom
software products ( www.sigsoln.com ).
2 Installation:
The current version runs on Windows 7 and Window XP machines.
1) Download most recent version from
http://sigsoln.net/SupportSofware/SPver1r1.zip
2) Unzip package and execute the Setup file to launch the install wizard.
3) If installation successful, the program will installed in the “\Program Files\Signal
Solutions” folder. A shortcut is created on the Desktop shown below in Fig. 1, and it is
also accessible from the Start button under All Programs and the Signal Solutions folder.
Figure 1. Desktop Icon to launch program.
2
3 Software Usage:
1) A screenshot of Percent Sleep after program launch (accessible from the programs menu
and a desktop shortcut) is shown in Figure 2a.
2) Select the Open Feature Vector button to open a file. Navigate to directory of interest
and open file. For large files the open procedure may take several seconds. The status
window will post updates on the progress and when complete will acknowledge that the
data was loaded as in Fig. 2b. Additionally, details of the experiment stored in the header
of the feature vector file are displayed, such as number of mice recorded in the
experiment, total time of the recording in hours, and the onset times for light and dark.
(a)
(b)
Figure 2. a) Program after startup b) Program after opening file.
3
3) Select the appropriate options. Options for processing are as follows:
a. Window Size (minutes) – This is the duration for contiguous time interval over
which sleep percentages are computed. The default window size is 60 minutes,
and the minimum duration is 1 minute. The window size must be a positive
integer, which limits window sizes to an integer number of minutes.
b. Export Sleep statistic histogram data – When selected, this exports the
histogram data for the sleep decision statistics in each channel. This is useful for
checking data quality of for manually setting threshold values. The classifier was
design based a variety of normal mice. It is expected in these cases that the
distribution of decision statistics over 24 hour periods will be widely distributed
over positive and negative values, often with a bimodal distribution, where more
negative decision statistics suggest wake and more positive suggest sleep. If the
distribution looks uniform or unimodal, little confidence should be placed in the
sleep-wake results.
c. Recalculate Threshold Values- By default, Percent Sleep checks the output file
directory for a csv file that contains the threshold values used in the sleep-wake
decision process. If a valid file exists, then program applies these values for the
sleep percentage calculations. If the FeatVec file has never been processed by the
Percent Sleep application, or if Recalculate Threshold Values option is checked,
then Percent Sleep calculates the threshold that results in a minimum variance
between classes (clustering) of decision statistics when the distribution is
sufficiently bimodal, otherwise threshold is set at 0.
4) After the feature vector file has been opened, the Calculate and export sleep
percentages button becomes selectable. After selecting the settings the options listed in
item 3, this button performs the following actions:
a. Updates status window, showing progress for each mouse through completion.
b. Creates folder with the same name as base file name (if it did not already exist)
for saving files generated by Percent Sleep. Folder is typically a subfolder of the
folder containing the feature vector file. In some cases under a Windows 7
operating system, it may be located in the My Documents\Signals Solutions folder
(this can occur because of certain security policies and settings associated with
Windows 7).
c. Calculate sleep percentages for each mouse and create csv files. An example
folder with output csv files is shown in Fig. 3. The “filenameSleepHist.csv”
contains the histogram data, “filenameThresholds.csv” contains the thresholds
applied to each set of mouse decision statistics, “filenameHeader.csv” contains
information on the experimental recording such as number of channels, names,
date, … etc. and “filenameSlpPcntXX.csv” contains the Percent Sleep data for a
window size of XX minutes.
4
Figure 3. Output csv files created by program
5) Selecting Reset will set the default window size and default selections for the other
checkbox options. Selecting “Exit” will terminate the program.
4 Notes:
1) If you are using Percent Sleep on a Windows 7 computer and get a an error message
related to creating or accessing the output directory then it is likely that the Windows 7
feature User Account Control (UAC) is preventing the action. A common solution is to
ensure that the data files are located in a User safe directory or folder (such as in a subfolder of the User’s “My Documents” folder). You might also see this error if there exists
a file with the same name as the Feature Vector file opened but without an extension. The
fix here is to either delete the file, move it, or rename it by adding an extension (such as
.txt). Please note that UAC is a critical security tool and should not be turned off.
2) You can directly edit the threshold values in file “filenameThresholds.csv” and save the
file. These values will be used in subsequent calculations as long as Recalculate
Threshold Values is not selected. Make sure to save back as a csv file (it should have
this file extension).
3) You will want to close any open copies of the output csv files before processing a feature
vector file that will try to overwrite the open file. If you want save previous output files
for the same feature vector file for comparisons, can save previous output files to a
different folder, or with a different file name or extension (i.e. xls, or .xlsx). Otherwise,
the program will exit without processing.
5
4) This program is very processor intensive and depending on the size of the files opened it
may take several minutes to process.
5) The feature vector file with the FeatVec extension is a binary file (non-readable in text
viewers) that contains sets of signal features updated every two seconds of experiment
time for each mouse. These are used to calculate the sleep-wake decision statistics
through a weighted sum derived from the linear discriminate analysis (LDA). Together
with the threshold values sleep-wake decision are made every 2 seconds. The specified
window size determines how many of these sleep-wake values are used to compute the
output sleep percentages (the default window size of 60 minutes corresponds to 1800
sleep-wake values).
6) The LDA classifier was designed to result in a threshold of 0. However, variations in
mouse weight, health, and noise can cause some shifting in the decision statistics.
Therefore, an adaptive threshold was developed to make adjustments based on a
clustering of the decision statistics for the 2 target behaviors sleep and not sleep (i.e. rest,
eating, grooming, active …). Features were weighted so that sleep-like signals result in
positive decision statistic values, while non-sleep results in negative values. In the case of
a bimodal distribution on the decision statistics, the adaptive threshold typically
converges to the null point between the 2 peaks. Threshold values typically vary between
1 and -1. If the distribution is not sufficiently bimodal, the threshold is left at 0. If
setting thresholds manually, plots of the exported sleep statistics histogram data are
helpful. In general it is not recommended to change the thresholds. The current system
predicts less than a 10% error on decision made over the 2 second intervals (error goes
down and aggregating data to compute statistics over larger intervals). The adaptive
threshold improves on this slightly.
6
Download