openCARP
Doxygen code documentation for the open cardiac electrophysiology simulator openCARP
ap_analyzer.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // openCARP is an open cardiac electrophysiology simulator.
3 //
4 // Copyright (C) 2020 openCARP project
5 //
6 // This program is licensed under the openCARP Academic Public License (APL)
7 // v1.0: You can use and redistribute it and/or modify it in non-commercial
8 // academic environments under the terms of APL as published by the openCARP
9 // project v1.0, or (at your option) any later version. Commercial use requires
10 // a commercial license (info@opencarp.org).
11 //
12 // This program is distributed without any warranty; see the openCARP APL for
13 // more details.
14 //
15 // You should have received a copy of the openCARP APL along with this program
16 // and can find it online: http://www.opencarp.org/license
17 // ----------------------------------------------------------------------------
18 
19 #ifndef AP_ANALYZER_H
20 #define AP_ANALYZER_H
21 
22 #include <stdio.h>
23 
24 #include "timer_utils.h"
25 
26 namespace limpet {
27 
28 // define which beat to use for calibration
29 #define CALIBRATION_BEAT 3
30 
31 // assuming a resting potential of -76 mV and an AP amplitude of 100 mV
32 #define def_APD90_thresh -66.
33 #define def_APD30_thresh -2.
34 
36 
38  event_meth m;
39  char *name;
40  float threshold;
41  bool p_slope;
42 };
43 
44 struct event_mx_rate {
45  event_meth m;
46  char *name;
47  float threshold;
48  bool p_slope;
49 };
50 
51 struct event_mx_val {
52  event_meth m;
53  char *name;
54  bool p_slope;
55 };
56 
57 typedef union _event_class {
58  event_meth m;
62 } event_class;
63 
64 struct ap_event {
65  double s;
66  double t;
67  double *trace;
69  bool trg;
70 };
71 
72 struct ap_events {
75 };
76 
78  int num_APs;
79  int num_params;
80  int cnt;
81  float *c;
82  float *p;
83 };
84 
86 
87 #define VM_HIST_LEN 4
89  int beat;
90  int calBeat;
91  bool pmat;
95  float APD;
96  float DI;
97  float triang;
98  float DIp;
99  ap_states state;
100  double vm_trc [VM_HIST_LEN];
101  double dvm_trc[VM_HIST_LEN];
103  FILE *stats;
104  FILE *rstats;
105 };
106 
107 
108 // AP analyzer
110 bool check_events(double vm, action_potential *AP, opencarp::timer_manager *tm);
114 void print_AP_stats_header(action_potential *AP, FILE *outbuf);
115 
116 } // namespace limpet
117 
118 #endif
void calibrate_thresholds(action_potential *AP)
Definition: ap_analyzer.cc:227
int calBeat
beat number used to calibrate thresholds
Definition: ap_analyzer.h:90
bool check_steady_state(steady_state_ap *ss)
Definition: ap_analyzer.cc:398
bool pmat
indiacte premature AP
Definition: ap_analyzer.h:91
int cnt
count number of beats in steady state
Definition: ap_analyzer.h:80
ap_events ampls
amplitude events (mx or mn found in a signal)
Definition: ap_analyzer.h:94
int beat
beat counter
Definition: ap_analyzer.h:89
event_mx_rate mx_rate
Definition: ap_analyzer.h:60
float * p
array of parameters at previous AP
Definition: ap_analyzer.h:82
event_mx_val mx_val
Definition: ap_analyzer.h:61
FILE * rstats
output restitution statistics only
Definition: ap_analyzer.h:104
float triang
AP triangulation, APD90-APD30.
Definition: ap_analyzer.h:97
void print_AP_stats_header(action_potential *AP, FILE *outbuf)
Definition: ap_analyzer.cc:526
event_meth m
method is MX_VAL
Definition: ap_analyzer.h:52
bool check_events(double vm, action_potential *AP, timer_manager *tm)
Definition: ap_analyzer.cc:263
double t
time when event was observed
Definition: ap_analyzer.h:66
double * trace
short trace of signal to analyze
Definition: ap_analyzer.h:67
event_x_threshold x_thresh
Definition: ap_analyzer.h:59
double s
value of signal when event occurred
Definition: ap_analyzer.h:65
float * c
array of parameters at current AP
Definition: ap_analyzer.h:81
float APD
standard APD as measured by APD90
Definition: ap_analyzer.h:95
int initialize_AP_analysis(action_potential *AP)
Definition: ap_analyzer.cc:71
Timers and timer manager.
int num_APs
minimum number of APs for steady state
Definition: ap_analyzer.h:78
void cleanup_AP_analysis(action_potential *AP)
Definition: ap_analyzer.cc:169
ap_events repols
repolarization events
Definition: ap_analyzer.h:93
ap_events acts
activation events
Definition: ap_analyzer.h:92
FILE * stats
output statistics for each AP
Definition: ap_analyzer.h:103
ap_states state
current state of AP, ongoing AP or diastole
Definition: ap_analyzer.h:99
bool p_slope
toggle max min search
Definition: ap_analyzer.h:54
steady_state_ap ss
steady state detection
Definition: ap_analyzer.h:102
int num_params
number of parameters we use to decide steady state
Definition: ap_analyzer.h:79
ap_event * events
Definition: ap_analyzer.h:74
#define VM_HIST_LEN
Definition: ap_analyzer.h:87
float DIp
DI of the previous AP.
Definition: ap_analyzer.h:98
char * name
name of event
Definition: ap_analyzer.h:53
enum limpet::_event_meth event_meth
float DI
BCL-APD90.
Definition: ap_analyzer.h:96
union limpet::_event_class event_class
centralize time managment and output triggering
Definition: timer_utils.h:73
event_class c
Definition: ap_analyzer.h:68
enum limpet::_ap_states ap_states