Skip to content

Commit 1e85536

Browse files
authored
Merge pull request #26 from brendanjohnharris/main
Consistency updates for v0.3.1 features
2 parents 81abb8d + 01f4de7 commit 1e85536

File tree

11 files changed

+168
-64
lines changed

11 files changed

+168
-64
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
*.m~
55
*.mexmaci64
66
.DS_Store
7+
*.vscode
8+
*.code-workspace
9+
*/run_features

.vscode/settings.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

C/.DS_Store

-10 KB
Binary file not shown.

C/CO_AutoCorr.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,11 @@ double CO_f1ecac(const double y[], const int size)
195195
double thresh = 1.0/exp(1);
196196

197197
double out = (double)size;
198-
for(int i = 1; i < size-1; i++){
198+
for(int i = 0; i < size-2; i++){
199199
// printf("i=%d autocorrs_i=%1.3f\n", i, autocorrs[i]);
200-
if ( autocorrs[i] < thresh ){
201-
double m = autocorrs[i] - autocorrs[i-1];
202-
double dy = thresh - autocorrs[i-1];
200+
if ( autocorrs[i+1] < thresh ){
201+
double m = autocorrs[i+1] - autocorrs[i];
202+
double dy = thresh - autocorrs[i];
203203
double dx = dy/m;
204204
out = ((double)i) + dx;
205205
// printf("thresh=%1.3f AC(i)=%1.3f AC(i-1)=%1.3f m=%1.3f dy=%1.3f dx=%1.3f out=%1.3f\n", thresh, autocorrs[i], autocorrs[i-1], m, dy, dx, out);

C/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424

2525
#include "stats.h"
2626

27-
// check if data qualifies to be cought22
27+
// check if data qualifies to be caught22
2828
int quality_check(const double y[], const int size)
2929
{
30-
int minSize = 40;
30+
int minSize = 10;
3131

3232
if(size < minSize)
3333
{

C/runAllTS.sh

Lines changed: 66 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,71 @@
1-
mkdir -p "featureOutputs"
1+
#!/bin/bash
22

3-
for entry in ./timeSeries/*
3+
help()
4+
{
5+
echo ""
6+
echo "Usage: $0 -i indir -o outdir -a append_string -s"
7+
echo -e "\t-h Show this help message"
8+
echo -e "\t-i Path to a directory containing input time-series files (.txt with one time series value per line). Default: './timeSeries'"
9+
echo -e "\t-o Path to a directory in which to save output feature values. Default: './featureOutput'"
10+
echo -e "\t-a A string (minus extension) appended to the input file names to create the output file names. Default: 'output'"
11+
echo -e "\t-s A switch to evaluate catch22 (0) or catch24 (1). Default: 0"
12+
exit 1
13+
}
14+
15+
while getopts "i:o:a:s:h" opt
16+
do
17+
case "$opt" in
18+
i) indir="$OPTARG" ;;
19+
o) outdir="$OPTARG" ;;
20+
a) append="$OPTARG" ;;
21+
s) catch24="$OPTARG" ;;
22+
h) help ;;
23+
esac
24+
done
25+
26+
srcdir=$(dirname "$0}")
27+
28+
if [ -z "$indir" ]
29+
then
30+
indir="./timeSeries"
31+
fi
32+
33+
if [ -z "$outdir" ]
34+
then
35+
outdir="./featureOutput"
36+
fi
37+
38+
if [ -z "$append" ]
39+
then
40+
append="output"
41+
fi
42+
43+
if [ -z "$catch24" ]
44+
then
45+
catch24=0
46+
fi
47+
48+
indir="$(dirname $indir)/$(basename $indir)"
49+
outdir="$(dirname $outdir)/$(basename $outdir)"
50+
mkdir -p $outdir
51+
52+
# Loop through each file in indir and save the feature outputs
53+
for entry in "${indir}"/*.txt
454
do
5-
echo "$entry"
6-
7-
filename=$(basename "$entry")
8-
extension="${filename##*.}"
9-
filename="${filename%.*}"
55+
filename=$(basename "$entry")
56+
extension="${filename##*.}"
57+
filename="${filename%.*}"
58+
fullfile="${outdir}/${filename}${append}.${extension}"
59+
if [ "${filename: -${#append}}" != "${append}" ]
60+
then
61+
yes $catch24 | "${srcdir}/run_features" $entry $fullfile > /dev/null
1062

11-
./run_features $entry "./featureOutputs/"$filename"output.txt"
63+
if [ -s $fullfile ] # Remove file if catch22 errors
64+
then
65+
echo "Output written to ${fullfile}"
66+
else
67+
rm $fullfile
68+
fi
1269

70+
fi
1371
done

testData/runtests.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
"$(dirname -- $0)/../C/runAllTS.sh" -i "$(dirname -- $0)" -o "$(dirname -- $0)" -a "_output" -s 1 -i "$(dirname -- $0)" -o "$(dirname -- $0)" -a "_output" -s 1

testData/test2_output.txt

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
-0.61479911484527, DN_HistogramMode_5, 0.014000
2-
-0.78225446555221, DN_HistogramMode_10, 0.004000
3-
7.13507860878856, CO_Embed2_Dist_tau_d_expfit_meandiff, 0.372000
4-
33.00000000000000, CO_f1ecac, 0.278000
5-
77.00000000000000, CO_FirstMin_ac, 0.279000
6-
1.00638907799376, CO_HistogramAMI_even_2_5, 0.028000
7-
0.00001782472612, CO_trev_1_num, 0.011000
8-
0.40740740740741, DN_OutlierInclude_p_001_mdrmd, 0.538000
9-
-0.23703703703704, DN_OutlierInclude_n_001_mdrmd, 0.289000
10-
0.84782608695652, FC_LocalSimple_mean1_tauresrat, 0.556000
11-
0.08029384289851, FC_LocalSimple_mean3_stderr, 0.012000
12-
40.00000000000000, IN_AutoMutualInfoStats_40_gaussian_fmmi, 0.133000
13-
0.31970260223048, MD_hrv_classic_pnn40, 0.007000
14-
83.00000000000000, SB_BinaryStats_diff_longstretch0, 0.006000
15-
88.00000000000000, SB_BinaryStats_mean_longstretch1, 0.004000
16-
1.21058781724385, SB_MotifThree_quantile_hh, 0.091000
17-
0.29545454545455, SC_FluctAnal_2_rsrangefit_50_1_logi_prop_r1, 0.260000
18-
0.75000000000000, SC_FluctAnal_2_dfa_50_1_2_logi_prop_r1, 0.111000
19-
0.99313877887424, SP_Summaries_welch_rect_area_5_1, 0.131000
20-
0.03681553890926, SP_Summaries_welch_rect_centroid, 0.106000
21-
0.08000000000000, SB_TransitionMatrix_3ac_sumdiagcov, 0.296000
22-
0.00000000000000, PD_PeriodicityWang_th0_01, 0.152000
1+
-0.23703703703704, DN_OutlierInclude_n_001_mdrmd, 0.248000
2+
0.40740740740741, DN_OutlierInclude_p_001_mdrmd, 0.342000
3+
-0.61479911484527, DN_HistogramMode_5, 0.005000
4+
-0.78225446555221, DN_HistogramMode_10, 0.003000
5+
7.13507860878856, CO_Embed2_Dist_tau_d_expfit_meandiff, 0.283000
6+
32.50260547693646, CO_f1ecac, 0.197000
7+
77.00000000000000, CO_FirstMin_ac, 0.315000
8+
1.00638907799376, CO_HistogramAMI_even_2_5, 0.017000
9+
0.00001782472612, CO_trev_1_num, 0.008000
10+
0.84782608695652, FC_LocalSimple_mean1_tauresrat, 0.522000
11+
0.08029384289851, FC_LocalSimple_mean3_stderr, 0.010000
12+
40.00000000000000, IN_AutoMutualInfoStats_40_gaussian_fmmi, 0.114000
13+
0.31970260223048, MD_hrv_classic_pnn40, 0.002000
14+
83.00000000000000, SB_BinaryStats_diff_longstretch0, 0.003000
15+
88.00000000000000, SB_BinaryStats_mean_longstretch1, 0.003000
16+
1.21058781724385, SB_MotifThree_quantile_hh, 0.047000
17+
0.29545454545455, SC_FluctAnal_2_rsrangefit_50_1_logi_prop_r1, 0.193000
18+
0.75000000000000, SC_FluctAnal_2_dfa_50_1_2_logi_prop_r1, 0.075000
19+
0.99313877887425, SP_Summaries_welch_rect_area_5_1, 0.077000
20+
0.03681553890926, SP_Summaries_welch_rect_centroid, 0.074000
21+
0.08000000000000, SB_TransitionMatrix_3ac_sumdiagcov, 0.309000
22+
0.00000000000000, PD_PeriodicityWang_th0_01, 0.135000
2323

testData/testShort_output.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
-0.58333333333333, DN_OutlierInclude_n_001_mdrmd, 0.019000
2+
0.75000000000000, DN_OutlierInclude_p_001_mdrmd, 0.017000
3+
0.02269949495805, DN_HistogramMode_5, 0.001000
4+
0.02269949495805, DN_HistogramMode_10, 0.001000
5+
0.51152503131790, CO_Embed2_Dist_tau_d_expfit_meandiff, 0.012000
6+
2.67524184613158, CO_f1ecac, 0.004000
7+
8.00000000000000, CO_FirstMin_ac, 0.004000
8+
1.36615884756920, CO_HistogramAMI_even_2_5, 0.003000
9+
0.01964378196445, CO_trev_1_num, 0.001000
10+
0.60000000000000, FC_LocalSimple_mean1_tauresrat, 0.008000
11+
0.05070841167817, FC_LocalSimple_mean3_stderr, 0.000000
12+
6.00000000000000, IN_AutoMutualInfoStats_40_gaussian_fmmi, 0.002000
13+
1.00000000000000, MD_hrv_classic_pnn40, 0.000000
14+
1.00000000000000, SB_BinaryStats_diff_longstretch0, 0.001000
15+
5.00000000000000, SB_BinaryStats_mean_longstretch1, 0.000000
16+
1.49903067297901, SB_MotifThree_quantile_hh, 0.004000
17+
0.00000000000000, SC_FluctAnal_2_rsrangefit_50_1_logi_prop_r1, 0.007000
18+
0.00000000000000, SC_FluctAnal_2_dfa_50_1_2_logi_prop_r1, 0.006000
19+
0.00000000000000, SP_Summaries_welch_rect_area_5_1, 0.004000
20+
0.39269908169875, SP_Summaries_welch_rect_centroid, 0.003000
21+
0.16666666666667, SB_TransitionMatrix_3ac_sumdiagcov, 0.006000
22+
0.00000000000000, PD_PeriodicityWang_th0_01, 0.013000
23+

testData/testSinusoid_output.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
0.13687262547490, DN_OutlierInclude_n_001_mdrmd, 8.703000
2+
-0.13777244551090, DN_OutlierInclude_p_001_mdrmd, 6.593000
3+
1.27292807660985, DN_HistogramMode_5, 0.041000
4+
-1.12758575737747, DN_HistogramMode_10, 0.039000
5+
1.64629633438112, CO_Embed2_Dist_tau_d_expfit_meandiff, 8.099000
6+
119.74079600337870, CO_f1ecac, 6.009000
7+
2.00000000000000, CO_FirstMin_ac, 4.579000
8+
1.07949995567938, CO_HistogramAMI_even_2_5, 0.320000
9+
-0.00017509308632, CO_trev_1_num, 0.110000
10+
0.00625000000000, FC_LocalSimple_mean1_tauresrat, 13.819000
11+
0.14051134209844, FC_LocalSimple_mean3_stderr, 0.190000
12+
1.00000000000000, IN_AutoMutualInfoStats_40_gaussian_fmmi, 1.845000
13+
0.82200000000000, MD_hrv_classic_pnn40, 0.041000
14+
6.00000000000000, SB_BinaryStats_diff_longstretch0, 0.051000
15+
301.00000000000000, SB_BinaryStats_mean_longstretch1, 0.046000
16+
1.38225822030023, SB_MotifThree_quantile_hh, 1.417000
17+
0.77551020408163, SC_FluctAnal_2_rsrangefit_50_1_logi_prop_r1, 3.221000
18+
0.69387755102041, SC_FluctAnal_2_dfa_50_1_2_logi_prop_r1, 1.645000
19+
0.98817221358274, SP_Summaries_welch_rect_area_5_1, 2.410000
20+
0.00997087512126, SP_Summaries_welch_rect_centroid, 2.218000
21+
0.01005896635449, SB_TransitionMatrix_3ac_sumdiagcov, 6.992000
22+
628.00000000000000, PD_PeriodicityWang_th0_01, 17.879000
23+

0 commit comments

Comments
 (0)