Skip to content

Commit

Permalink
added maximum deviation column as a way to diagnose short missed subl…
Browse files Browse the repository at this point in the history
…evels
  • Loading branch information
shadowk29 committed Oct 27, 2016
1 parent 5150132 commit 33ed8ee
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
16 changes: 16 additions & 0 deletions detector.c
Expand Up @@ -504,6 +504,22 @@ void event_baseline(event *current_event, double baseline_min, double baseline_m
}
current_event->baseline_before = baseline_before;
current_event->baseline_after = baseline_after;

int64_t i;
int64_t length = current_event->length + current_event->padding_before + current_event->padding_after;
double maxdeviation = 0;
double deviation;
double baseline = 0.5 * (baseline_before + baseline_after);
for (i=0; i<length; i++)
{
deviation = d_abs(current_event->signal[i] - baseline);
if (deviation > maxdeviation)
{
maxdeviation = deviation;
}
}
current_event->maxdeviation = maxdeviation;

}
}

Expand Down
5 changes: 4 additions & 1 deletion io.c
Expand Up @@ -200,6 +200,7 @@ n_levels,\
rc_const1_us,\
rc_const2_us,\
residual_pA,\
max_deviation_pA,\
level_current_pA,\
level_duration_us,\
blockages_pA,\
Expand Down Expand Up @@ -247,6 +248,7 @@ void print_event_line(FILE *events, FILE *rate, event *current, double timestep,
%d,\
%g,\
%g,\
%g,\
%g,",\
current->index, \
current->type, \
Expand All @@ -266,7 +268,8 @@ void print_event_line(FILE *events, FILE *rate, event *current, double timestep,
current->numlevels, \
current->rc1 * timestep * 1e6, \
current->rc2 * timestep * 1e6, \
current->residual);
current->residual, \
current->maxdeviation);
while (level)
{
fprintf(events,"%g",level->current);
Expand Down
1 change: 1 addition & 0 deletions utils.h
Expand Up @@ -99,6 +99,7 @@ struct Event
double rc1;
double rc2;
double residual;
double maxdeviation;
struct Edge *first_edge;
struct Cusumlevel *first_level;
};
Expand Down

0 comments on commit 33ed8ee

Please sign in to comment.