Dive 1 User Manual
10 August 2005
1. INTRODUCTION This document describes the operation of a program (DIVE) for analysing seal dive data. The program runs on IBM/PC computers under MS/DOS. It was written by Stewart Greenhill in ANSI-C for Mark Hindell's seal data. It generates statistics for individual dives and groups of dives. It also allows interactive graphical display of dives and statistics. The graphical part is written for Borland BGI, but the remainder of the program should be portable to any system with a C compiler (eg. unix, macintosh, etc). 1.1 WHAT'S NEW ? The current version is 2.2. Several changes have been incorporated since the last version of this program. Between 1.0 and 2.0: (1) A new algorithm for surface detection deals better with shifts in the sensors. (2) The system identifies flat-bottomed dives. (3) Two types of "spikes" are detected: "starts" and "stops". The system maintains separate statistics for each, and counts the number of stops following starts, etc. (4) Depth-only data can be handled. Without velocity information, spike detection and sleep-detection is omitted. (5) A histogram is calculated, showing the amount of time spent at different depths during the dive. The number of depth classes can be specified at the start. The depth histogram can optionally be output with .CSV data. (6) A new menu system allows the user to operate the program interactively using keyboard or mouse. The program settings can be easily adjusted and are automatically loaded and saved each time the program is run. Between 2.0 and 2.1: (1) Dive type is now output to .CSV files. Between 2.1 and 2.2: (1) Fixed a problem that caused large indexes (>64K) to be read incorrectly. 2. MODEL OF DATA Dive data consists of an ordered series of numbers separated by commas: day, hour, depth, speed Where day is the Julian day that the sample occurred hour is the hour of the day (0..24) depth is the depth in metres speed is the velocity in m/s The data is characterised by repeated dives of 20 to 30 minutes, separated by periods of 2 to 3 minutes at the surface. However, most dives are not uniform, consisting of several distinct phases. These are outlined below: descent Depth increases rapidly. Speed is high. active Depth remains more or less constant with periodic variations that are relatively small in amplitude. Speed is lower, but highly variable. Perhaps this indicates that the seal is foraging. ascent Depth decreases rapidly. Speed is high. Occasionally, a different dive profile is evident. During the descent, the speed drops to zero for several minutes (usually between 5 and 10 minutes). Perhaps the seal is sleeping or resting during this time. These dives usually show no active phase, although some dives show active ascents. Thus, we identify the additional phase: sleep Depth increases slowly. Speed is zero. The phases outlined above are statistically distinct. Computing a single statistic for the entire dive would not give a realistic picture of what is happening. The program attempts to divide the dive into phases and collects separate statistics for each phase. These statistics are: vmean The mean velocity (based on swimming speed). vsd The standard deviation of the velocity. vmax The maximum velocity. vmin The minimum velocity. vvert The mean vertical velocity. This is vdist (see below) divided by the total time. dmin The minimum depth. dmax The maximum depth. hdist The horizontal distance travelled. This is an integration of the swimming velocity over time. vdist The vertical distance travelled. This is an integration of depth changes over time. time The time taken during the phase. Further analysis is performed on the active phase of the dive: (1) Characterising "wiggles" in the depth profile. (2) Identifying "spikes". These are rapid changes in velocity, often (but not always) accompanied by changes in depth. During the active phase, depth increases and decreases periodically. Each cycle (between local maxima in depth) is termed a "wiggle". A wiggle consists of two phases. The "upslope" (or ascending) phase is the time between a local maximum and the next local minimum in depth. The "downslope" (or descending) phase is the time between a local minimum and the next local maximum in depth. Every wiggle has an "upslope" followed by a "downslope" phase. The program counts the number of wiggles during the active phase, and collects more detailed statistics showing the differences between the upslope and downslope phases of the wiggles. The following additional phases correspond to wiggles: upslope A phase consisting of all ascending phases of wiggles in the active phase of the dive. downslope A phase consisting of all descending phases of wiggles in the active phase of the dive. The same statistics outlined above are collected over the upslope and downslope phases. Sometimes velocity increases rapidly and remains high for a period of time; these events are termed "starts". Sometimes velocity decreases rapidly and remains low for a period of time; these events are termed "stops". Collectively, "starts" and "stops" are termed "spikes". Every spike in the active phase of the dive is analysed as a phase. The program counts the number of spikes and maintains the following statistics for each dive: allstarts, allstops Phases consisting of all starts/stops during the active phase of the dive. bigstart, bigstop Phases consisting of the start/stop with the largest maximum velocity (vmax). deepstart, deepstop Phases consisting of the start/stop with the largest vertical distance travelled (vdist). longstart, longstop Phases consisting of the start/stop with the longest duration (time). In addition to the above statistics, the program maintains the number of times one type of spike follows another. It may be possible (for example) that a start followed by a stop corresponds to the pursuit and capture of prey. Some data-sets consist only of depth measurements, with no velocity data. Without velocity spike analysis cannot be performed, and sleep dives cannot be detected. Other phases are still analysed (with no velocity statistics). 3. ANALYSIS Dive analysis consists of several steps: Step 1 Partitioning the data into distinct dives. Step 2 Partitioning each dive into distinct phases. Step 2a Identifying flat-bottomed dives. Step 3 Analysis of the active phase (if present) Step 3a Analysis of wiggles Step 3b Analysis of spikes Step 4 Generation of dive histogram Step 5 Reporting results The following section outlines the procedures used in these steps. It also identifies a number of important parameters that are used in the analysis. These parameters can be modified by the user if necessary. Step 1 involves breaking the dive into surface and sub-surface periods. The parameter "mindive" is the depth below which a dive is said to begin. Ideally, mindive=0 should be sufficient. However, it appears that there is some hysteresis and random drift in the depth sensors. The program attempts to maintain an idea of the depth reading that corresponds to the surface (since this appears to change with time). The initial depth of the surface is given by the parameter "initsurf". When the depth increases above surface+mindive, and a local estimate of the slope of the profile depth(t)- depth(t-2) is greater than "slopethresh", a dive is said to begin. The slope criterion helps reduce the number of false starts due to noisy depth measurements. When the depth decreases below surface+mindive, the dive is said to end. In the period between the end of a dive and the start of the next, the minimum depth is computed and used as the estimate of the surface depth for the next dive. The surface depth is subtracted from all dive data prior to processing. In this way, shifts in the zero readings are removed from the data. Dive partitioning does not rely on velocity information, and so will work identically with depth-only data. Step 2 divides the dive into phases. This is done by looking at local maxima and minima in the depth profile as outlined here. Starting from the beginning of the dive, every local maximum in depth potentially identifies the end of the descent phase. However, only sufficiently deep maxima are accepted. This is controlled by a parameter "activeregion". The first depth maximum such that activeregion*100 percent of the total time is spent at or below that depth is taken as the end of the descent phase. This heuristic seems to result in sensible partitions for activeregion=0.15. A similar procedure identifies the beginning of the ascent phase (working backwards from the end of the dive). In some dives, the same local maximum in depth corresponds to the end of the descent phase and the beginning of the ascent phase. These dives have no active phase (usually there is a sleep phase). Thus there are two possible phase patterns: descent, active, ascent descent, ascent Sleep phases are identified by considering the length of time that the swimming velocity is zero while depth is decreasing. If this is more than sleepthreshold*100 percent of the total dive time, a sleep phase is identified. The phase consists of the time between the first and last points where the speed is zero. Usually this is during the descent phase. Some data contains erroneous velocity information: velocity appears zero for all (or most) of a dive. To avoid declaring a sleep dive on such dives, an additional parameter is used. The length of time that the swimming velocity is zero is calculated. If this is greater than nosleepthreshold*100 percent of the total dive time, the sensor is assumed to be faulty and no sleep phase is identified. Step 2a looks for flat-bottomed dives. These are dives in which the depth profile is flat at the maximum depth. Such profiles are produced by: (1) Depth readings being "clipped" by a limited sensor repsponse. (2) The seal foraging on the ocean floor. The program identifies such dives as "flat" dives, and computes the amount of time spent at the bottom of the profile. The program defines a "bottom zone" just above the maximum dive depth. The width of this zone is "flatdepthprop" times the maximum depth. Optionally, a limit value "flatdepthabs" may be specified for the width of the "bottom zone". The program computes the amount of time spent in the bottom zone. If this is greater than "flattimeprop" times the dive length (or optionally, just "flattimeabs" minutes) a "flat dive" is identified. The end of descent (and start of ascent) phases are adjusted to the first (and last) times that the depth is within the bottom zone. Note that this is the only situation where the phase transitions can not correspond to local depth maximum. Step 3a characterises wiggles in the active phase. In most dives, the active phase begins and ends at a local maximum in depth. Thus the active phase always contains a whole number of wiggles (maximum-minimum-maximum cycles). Separate statistics are collected for upslopes (maximum-minimum) and downslopes (minimum-maximum). The upslope and downslope phases cover the whole of the active phase. For flat dives, wiggle statistics are computed from their normal locations (ie. starting and ending at depth maxima), despite the fact that the bounds of the active region may be different. Step 3b identifies spikes in velocity. This process is complicated by the fact that the speed measurements are already highly variable. It is controlled by two parameters, "spikeon" and "spikeoff". These define thresholds above which a spike begins, and below which a spike ends. A "start" is identified when the velocity during the active phase exceeds vmean+vsd*spikeon. The spike covers the time between the next and previous points where the velocity drops below vmean+vsd*spikeoff. Similaraly, a "stop" is begins when the velocity drops below vmean-vsd*spikeon and ends when it exceeds vmean-vsd*spikeoff. Each spike is analysed statistically as a phase. The program keeps statistics on a range of possibly interesting spikes, as outlined in section 2. The default values are spikeon=2.0 and spikeoff=0.5. Step 4 generates a histogram of the time spent at different depths. The user may specify a number of bins "nbins". For each dive, the depth profile is divided into "nbins" bins of equal depth. The time between any two samples is divided amongst bins on the basis of the proportion of the total depth range lying within each bin. The depth histogram for each dive may be plotted on the screen (during browsing) or output to a file. Step 5 reports the results of the analysis. In the case of a single dive, this includes some general statistics as well as detailed statistics for each phase identified (up to 15 phases may be present). The general statistics are: dive the number of the dive type the type of dive: "normal", "flat" or "sleep" day the hour that the dive started hour the hour that the dive started duration the duration of the dive presurf the time at surface before the dive postsurf the time at surface after the dive alseep the length of the sleep phase (if present). 0 otherwise. bottom the length of time spent at the bottom of a flat dive (if present). 0 otherwise. descent the mean rate of descent. NOTE: this is not the same as vvert from the descent phase. Since vvert is based on total vertical distance travelled it includes both up and down motion. ascent the mean rate of ascent wiggles the number of wiggles during the active phase starts the number of starts during the active phase stops the number of stops during the active phase start-stop the number of times a "stop" followed a "start". Similarly for "stop-stop", "stop-start" and "start- start". Statistics on the following phases are always reported: total descent ascent The following phases may be reported if present: active asleep upslope, downslope allstarts, bigstart, deepstart, longstart allstops, bigstop, deepstop, longstop The dive statistics may be reported in two ways: tabular (for humans to read) or as comma-separated-values (CSV) (for import into spreadsheets). Output file names consist of the input name with a suffix appended. Tabular output always goes into filenames suffixed with ".out". CSV output always goes into filenames suffixed with ".csv". By convention, lengths are always in m, velocities in m/s and time in minutes. Dives are numbered starting from 0. So, for example, a dive log with 10 dives will have dive numbered from 0 to 9. The order of the values for CSV output is precisely that outlined above. Each phase consists of 10 statistics. Where a phase is absent, there will be no values between the commas. Headings will be present at the start of the CSV output. For depth-only data, spike statistics will be omitted. The system allows dives to be processed together in batches. Three parameters control the generation of output files during batch processing. When the "printout" parameter is true, a tabular output file (.out) is generated. When the "printcsv" parameter is true, a comma-separated-value file (.csv) is generated. When the "writebins" parameter is true, the depth histogram is appended to each line of the .csv file for each dive. During batch processing further statistics are maintained about the variation of parameters between dives. This information is stored in a summary file, suffixed with ".sum". The statistics for each parameter include: mean the mean value of a parameter sd the standard deviation of a parameter min,dive the minimum value of a parameter and the dive during which it occurred max,dive the maximum value of a parameter and the dive during which it occurred dives the total number of dives considered for the parameter statistics The parameters considered are: Total dive time The total phase time statistic Surface time The postsurf statistic Active time The active phase time statistic, if present Ascent rate The ascent statistic Descent rate The descent statistic Vertical distance The total phase vdist statistic Horizontal distance The total phase hdist statistic Vertical speed The total phase mean vertical speed Horizontal speed The total phase mean horizonal speed Wiggles The number of wiggles during the active phase Maximum Speed The total phase vmax Time Asleep The time asleep, when present Maximum Depth The total phase dmax Starts The number of starts during the active phase Start max velocity The bigstart phase vmax, when present Start max depth The deepstart phase vvert, when present Stops The number of stops during the active phase Stop-Starts The number of times a start followed a stop Start-Stop The number of times a stop followed a start Bottom time The length of time in the bottom zone of a flat dive Here is a sample summary output. It shows, for example that the longest of 1658 dives was dive number 1232 (39 minutes) and the dive with the shortest sleep time (where a sleep phase was evident) was dive number 58 (1.97 minutes). Processed dives 0 to 1659 Statistic Mean SD Min Dive Max Dive Dives Total dive time 22.20 4.59 0.22 1183 38.83 1232 1660 Surface time 2.41 2.35 0.16 187 75.83 391 1659 Active time 14.81 4.14 0.13 1184 27.37 708 1588 Ascent Rate 1.36 0.33 0.00 1183 2.12 556 1660 Descent Rate 1.27 0.46 0.20 199 2.32 1490 1660 Vertical Distance 982.14 378.83 15.00 1183 2409.00 1374 1660 Horizontal Distance 2006.22 642.13 12.10 1183 3555.07 1379 1660 Vertical Speed 0.73 0.22 0.23 201 1.57 1515 1660 Horizontal Speed 1.49 0.38 0.34 67 2.18 1176 1660 Wiggles 10.41 4.57 0.00 0 27.00 734 1660 Maximum Speed 2.57 0.44 0.70 1183 4.10 817 1660 Time Asleep 11.32 3.82 1.97 58 21.37 452 118 Maximum Depth 327.26 175.61 12.00 1183 699.00 1439 1660 Starts 1.44 1.25 0.00 0 9.00 1140 1660 Start Max Speed 2.46 0.57 0.80 139 4.10 818 1245 Start Max Vertdist 53.66 38.97 0.00 783 255.00 906 1245 Stops 1.56 1.51 0.00 0 7.00 538 1660 Stop-Starts 1.03 0.17 1.00 11 2.00 752 95 Start-Stops 1.14 0.37 1.00 12 3.00 896 356 Bottom Time 10.15 4.26 0.13 1184 18.38 940 46 Here is a sample of the tabluar output: Dive: 8 of 1659 Start: Day 307, Hour 2.930600 Duration: 23.66 minutes Surface: Before dive 2.33 minutes, After dive 2.50 minutes Asleep: 0 minutes Descent: 0.39 m/s Ascent: 0.97 m/s Phase Speed(m/s) Depth(m) Distance(m) Time Mean SD Min Max Vert Min Max Horiz Vert descent 1.07 0.29 0.5 1.8 0.41 3 93 244 93 3.81 active 0.99 0.30 0.3 1.7 0.42 84 267 1093 459 18.37 ascent 1.26 0.16 0.9 1.5 1.04 3 90 112 93 1.49 total 1.02 0.30 0.3 1.8 0.45 3 267 1450 645 23.66 Active phase 9 wiggle(s) up slope 1.11 0.28 0.5 1.5 0.68 84 264 376 228 5.63 down slope 0.94 0.29 0.3 1.7 0.30 87 267 717 231 12.74 3 spike(s) all spikes 1.29 0.26 0.0 1.7 0.52 0 267 217 87 2.81 big spike 1.26 0.30 0.9 1.7 0.54 141 162 63 27 0.83 deep spike 1.30 0.23 1.0 1.6 0.52 237 267 90 36 1.16 long spike 1.30 0.23 1.0 1.6 0.52 237 267 90 36 1.16 4. USING THE PROGRAM The DIVE program is written in ANSI-C, and has been compiled for MS/DOS using Borland Turbo C (Version 1.0) compiler. It will run on any standard IBM/PC with 512K RAM (less will probably work). It will run significantly faster with a numeric co-processor. The graphical options require a VGA screen, although normal batch operations will work on any display. The input data is stored in ASCII form in a large file (perhaps 5-10 megabytes in size). This file may have an 8-letter name (MS/DOS restrictions), but should not contain a '.' suffix. A preprocessing stage generates an index file (.idx), which is used thereafter to locate a particular dive when required. This preprocessing uses the "initsurf", "mindive" and "slopethresh" parameters to separate the dives. Preprocessing can be a lengthy process. Pressing the ESC key during indexing will terminate the process (leaving a truncated index). Six basic operations are available: (1) Browse through the data. A graphical display of each dive is presented on the screen, showing the dive profile and important statistics. The user may browse forward and backward through the file, or jump to a particular dive. (2) Process a range of dives, generating output statistics. (3) Extract raw data for a range of dives. (4) Show an overview of the data. Continuous strips of depth data are displayed, indicating the positions where dives begin and end. This is useful for checking that the dive-partitioning is working correctly. (5) Dump the contents of a dive index to a file. The dive index contains the parameters used to perform the dive-partitioning. For each dive it contains start- and end-positions in the original text file, the number of lines and surface depth. This data may be useful to show the trend in sensor offset over time. (6) Force the regeneration of a dive index. This may be used if values of "initsurf", "mindive" or "slopethresh" need to be adjusted for a particular data-set. The program options can be controlled via the command line. The command DIVE presents a menu on the screen, allowing the user to control the operation of the program using the keyboard or mouse. Otherwise, Commands are of the form: DIVE [@<settings>] <input> <command> where an optional @<settings> specifies <settings> as the file containing the program settings. This is the file from which parameters are loaded (and saved when the program exits). input is a file containing input data command is one of the following browse to graphically browse through the data extract <range> <output> to extract <range> of dives to <output> process <range> to process <range> dives dump <output> to dump index to file <output> index to regenerate the index range is one of the following all to indicate all dives <lo>-<hi> to indicate a range of dives Examples: Suppose "veltdr1" is an input file. To start interactively to use the menu system: dive To display a help message for the command-line options: dive help To browse through the file: dive veltdr1 browse To process dives 0 to 9: dive veltdr1 process 0-9 To process all dives: dive veltdr1 process all To extract raw data from dives 50 to 60 into file "test.dat" dive veltdr1 extract 50-60 test.dat To process dives 40-90 using alternative settings in file "dive.set" dive @dive.set process 40-90 The browse command displays a dive profile on the screen. For example, to browse through file "veltdr1" use the command: dive veltdr1 browse or select Browse from the main menu. The graphical display shows a number of traces. The upper box shows the velocity profile (if velocity data is present). Labelled lines show the division between phases of the dive. Dashed lines on the velocity profile show the mean velocity (lower line) and one standard deviation above the mean velocity (upper line). If starts are present, they will be highlighted in green; stops will be highlighted in red. The lower box shows the depth profile. Small circles on the depth profile indicate the location of local maxima and minima in depth. To the right of the depth box is a histogram showing the relative length of time spent at each depth. The following commands are available: n move to the next dive (also left mouse button) p move to the previous dive g go to a selected dive. The program will prompt for a dive number d change display to alternative format. Two formats are available: graphical and tabular. This command swaps between the two. ESC the escape key terminates the browse function (also right mouse button). The overview command displays strips of depth data across the screen. Each labelled green line indicates the start of a dive record. Each red line indicates the end of a dive record. The following options are available: n move to the next screen full of data (also left mouse button) g display data starting at the selected dive. The program will prompt for a dive number. ESC the escape key terminates the overview function (also right mouse button). The process command generates statistics for a range of dives. If "file" is the input file, several output files are generated: file.idx the index file (first run through file only) file.out the tabular output file file.csv the CSV output file file.sum the summary output file The tabular output files may be viewed using a text editor or word processor, or using the DOS command MORE < file.out The CSV output files may be imported into spreadsheets (such as MS EXCEL). Most spreadsheet programs have a function allowing delimited text files to be imported. Ensure that commas are used as the delimiter. For example, using Microsoft EXCEL 4.0 (Macintosh), Select Open from the File menu Click the Text button Select Comma as the column delimiter, and "DOS" as the file origin. Then Click OK Select file.csv using the file browser. Then click OK. The extract command copies data verbatim from the input file to the specified output file. The dump command extracts values from the dive index in .CSV form to the specified output file. The index command regenerates the dive index using the current values of "initsurf", "mindive", and "slopethresh". Negative values of spikeon and spikeoff specify an absolute velocity (rather than relative to sd) above the mean for the spike thresholds. Example: spikeon=-1 specifies 1 m/s above vmean. If the divethreshold parameter is changed, the user should erase the old index file. This forces the program to generate a new index file using the new threshold. If "file" is the name of the data, the MS/DOS command del file.idx will accomplish this. 5. THE MENU SYSTEM Invoking the program with the command line DIVE causes the program to use a menu-system to interact with the user. The keyboard or mouse may be used to control the menus. Generally, pressing return or the left mouse button selects the highlighted item; pressing ESC or the right mouse button aborts, or cancels a selection. This section outlines the functions available through the menus. Some menus contain parameters that can be edited by the user. The left and right arrow keys will generally enable the user to edit the text for the parameter, or will step through a range of valid values. These parameters will be saved to a settings file (dive.par by default) when the program exits, and will be reloaded next time the program is run. The names in square brackets indicates the name of the parameter appearing in the settings file. However, the user is advised not to edit this file directly, but to use the menus to adjust the settings. 5.1 Main Menu Settings - Enters the Settings Menu, allowing the user to edit important program settings. Input Name [InputName] - This is the name of the file containing dive data. The user may edit this field using the cursor keys. Type of Input Data [filetype] - Indicates the format of the input data. velocity Input data contains depth and velocity depth only Input data contains only depth information Note that this parameter is only important if the dive record is to be indexed. The file type will be stored in the file index and subsequently does not need to be specified. Select File - This displays a requestor, allowing the user to select from a list of available files. Initially, only files without extensions in the current directory will be displayed. Using the arrow keys or mouse, the user may select a file. Pressing return (or the left mouse- button) selects the highlighted file. Selecting a directory changes the display to files in that directory. Pressing ESCAPE (or the right mouse button) cancels the operation, returning the original selection. Pressing TAB, allows the directory, file mask, or file table to be selected. Browse - Browse data and statistics, one dive at a time. Overview - Show depth data, indicating start and end of dives. Process - Go to the Process Menu. This allows the user to select a range of dives to process, and to change the output options. To abort the operation, select "Cancel". Selecting "Range" processes only the dive between "Low" and "High". Selecting "All" processes all dives. The dive record will be indexed, if it has not previously been indexed. Extract - Go to the Extract Menu. This allow the user to select a range of dives to extract, and to specify a file in which to store the extracted data. To abort the operation, select "Cancel". Dump - Go to the Dump Menu. This allows the user to specify a file to which the dive index will be output. Index - Go to the Index Menu. If the user elects to rebuild the index, the current values of "initsurf", "mindive" and "slopethresh" will be used. 5.2 Settings Menu Surface Detection - Go to the Surface Detection Sub-menu (detailed in 5.2.1 below). Spike Detection - Go to the Spike Detection Sub-menu (detailed in 5.2.2 below) Flat-Bottom Dive Detection - Go to the Flat-Region Detection Sub-menu (detailed in 5.2.3 below) Depth Bins [nbins] - Defines the number of depth classes to compute. Each depth bin is allocated a proportion of the total dive time. nbins should be between 10 and 100. Active Region [activeregion] - Used for ascent/descent detection. See Section 3, step 2). Sleep Threshold [sleepthreshold] - The system identifies a sleep dive when the time(descending with zero velocity)/time(total for dive) is greater than sleepthreshold. Sleep Reject [nosleepthreshold] - The system rejects a sleep dive when the time(with zero velocity)/time(total for dive) is greater than nosleepthreshold. Overview Depth [viewdepth] - This is the width of a data strip (in metres) during the overview display. Dive data is not clipped within a strip. Output .CSV file [printcsv] - Generates .CSV output (for import into spreadsheets) during processing. Output .OUT file [printout] - Generates .OUT output (for humans to read) during processing. Output Bins [writeout] - Appends depth bin data to each line of .CSV output. Ouput data is the time (in minutes) spent within each depth class. 5.2.1 Surface Detection Sub-menu Minimum Dive [mindive] - Specifies the minimum depth below the surface that is considered to start a dive Dive Slope Threshold [slopethresh] - Specifies the minimum slope for a dive to start Initial Surfacce [initsurf] - Specifies the initial depth of the surface (normally 0). 5.2.2 Spike Detection Sub-menu Spike On [spikeon] - Specifies the velocity above (for starts) or below (for stops) the mean for a spike to begin. If spikeon is positive it indicates the number of SDs. If spikeoff is negative it indicates a magnitude in m/s. Spike Off [spikeoff] - Specifies the velocity above/below the mean for a spike to end. Follow Time [followtime] - Indicates the time (in seconds) between the end of a spike and the start of the next for the second to be said to follow the first. 5.2.3 Flat Region Detection Sub-menu Depth Prop [flatdepthprop] - Indicates the width of the "bottom zone" as a proportion of the maximum depth. Depth Limit [flatdepthabs] - Indicates a maximum value (in metres) for the depth of the bottom zone. Depth Criterion [flatdepthtype] - Indicates the criterion used to limit the width of the bottom zone: proportional the width is proportional to the maximum depth limit the proportional width is limited by flatdepthabs Time Absolute [flattimeabs] - Indicates the length of time (in minutes) required in the bottom zone for a flat dive. Time Prop [flattimeprop] - Indicates the length of time (as a proportion of the total dive time) required in the bottom zone for a flat dive. Time Criterion [flattimetype] - Indicates the time criterion used to determine a flat dive: absolute use flattimeabs as the threshold time proportional use flattimeprop*total as the threshold time 6. KNOWN BUGS / LIMITATIONS The program does not check the validity of the data. Simple tests may be useful in identifying bogus values (where the readings appear change faster than is physically possible) or missing data. Dive partitioning is better, but still far from perfect. The overview option allows the user a quick check over whether it has worked properly. Very shallow dives (of the order mindive) are not handled well. Identification of dive phases is naive, but generally effective. Better specifications may be possible. Dives must be no longer than 400 samples. This is set during compilation, but may be changed. The indexing procedure reports if a dive is longer than the maximum allowable length. Ideally, storage should be allocated dynamically which would remove any restriction. Output files are always generated with the same base name as the input data. It may be useful to have an option to output to a different name. Surface periods are not reported prior to the first dive or after the last dive, even though this information is all in the file. CSV output files contain very long lines. These may confuse some spreadsheets (eg. old versions of Lotus 1-2-3 limit lines to 240 characters). Modern spreadsheets (such as Microsoft Excel) should have no problems. The user should be able to select which statistics are to be output. Presently ALL statistics are output. The "cut" utility on unix systems can be used to extract selected columns from the CSV file. The analysis is a little slow, taking 2-3 seconds per dive on a 386SX-25. Some efficiency gains may be possible. However, it should run much faster on machines with numeric co-processors. Stewart Greenhill 5 October 1995 (2.0) 27 May 1996 (2.1)