openCARP
Doxygen code documentation for the open cardiac electrophysiology simulator openCARP
ap_analyzer.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) NumeriCor GmbH
2 // SPDX-License-Identifier: LicenseRef-APL-1.1
3 
4 #ifndef AP_ANALYZER_H
5 #define AP_ANALYZER_H
6 
7 #include <stdio.h>
8 
9 #include "timer_utils.h"
10 
11 namespace limpet {
12 
13 // define which beat to use for calibration
14 #define CALIBRATION_BEAT 3
15 
16 // assuming a resting potential of -76 mV and an AP amplitude of 100 mV
17 #define def_APD90_thresh -66.
18 #define def_APD30_thresh -2.
19 
21 
24  char *name;
25  float threshold;
26  bool p_slope;
27 };
28 
29 struct event_mx_rate {
31  char *name;
32  float threshold;
33  bool p_slope;
34 };
35 
36 struct event_mx_val {
38  char *name;
39  bool p_slope;
40 };
41 
42 typedef union _event_class {
48 
49 struct ap_event {
50  double s;
51  double t;
52  double *trace;
54  bool trg;
55 };
56 
57 struct ap_events {
60 };
61 
63  int num_APs;
64  int num_params;
65  int cnt;
66  float *c;
67  float *p;
68 };
69 
71 
72 #define VM_HIST_LEN 4
74  int beat;
75  int calBeat;
76  bool pmat;
80  float APD;
81  float DI;
82  float triang;
83  float DIp;
85  double vm_trc [VM_HIST_LEN];
88  FILE *stats;
89  FILE *rstats;
90 };
91 
92 
93 // AP analyzer
99 void print_AP_stats_header(action_potential *AP, FILE *outbuf);
100 
101 } // namespace limpet
102 
103 #endif
#define VM_HIST_LEN
Definition: ap_analyzer.h:72
centralize time managment and output triggering
Definition: timer_utils.h:58
enum limpet::_event_meth event_meth
bool check_steady_state(steady_state_ap *ss)
Definition: ap_analyzer.cc:383
enum limpet::_ap_states ap_states
@ DI_STATE
Definition: ap_analyzer.h:70
@ AP_STATE
Definition: ap_analyzer.h:70
int initialize_AP_analysis(action_potential *AP)
Definition: ap_analyzer.cc:56
union limpet::_event_class event_class
void print_AP_stats_header(action_potential *AP, FILE *outbuf)
Definition: ap_analyzer.cc:511
void cleanup_AP_analysis(action_potential *AP)
Definition: ap_analyzer.cc:154
void calibrate_thresholds(action_potential *AP)
Definition: ap_analyzer.cc:212
@ MX_RATE
Definition: ap_analyzer.h:20
@ X_THRESHOLD
Definition: ap_analyzer.h:20
@ MX_VAL
Definition: ap_analyzer.h:20
bool check_events(double vm, action_potential *AP, timer_manager *tm)
Definition: ap_analyzer.cc:248
ap_events ampls
amplitude events (mx or mn found in a signal)
Definition: ap_analyzer.h:79
int calBeat
beat number used to calibrate thresholds
Definition: ap_analyzer.h:75
steady_state_ap ss
steady state detection
Definition: ap_analyzer.h:87
float APD
standard APD as measured by APD90
Definition: ap_analyzer.h:80
float DI
BCL-APD90.
Definition: ap_analyzer.h:81
bool pmat
indiacte premature AP
Definition: ap_analyzer.h:76
int beat
beat counter
Definition: ap_analyzer.h:74
FILE * rstats
output restitution statistics only
Definition: ap_analyzer.h:89
ap_events repols
repolarization events
Definition: ap_analyzer.h:78
FILE * stats
output statistics for each AP
Definition: ap_analyzer.h:88
double dvm_trc[VM_HIST_LEN]
Definition: ap_analyzer.h:86
float triang
AP triangulation, APD90-APD30.
Definition: ap_analyzer.h:82
float DIp
DI of the previous AP.
Definition: ap_analyzer.h:83
double vm_trc[VM_HIST_LEN]
Definition: ap_analyzer.h:85
ap_events acts
activation events
Definition: ap_analyzer.h:77
ap_states state
current state of AP, ongoing AP or diastole
Definition: ap_analyzer.h:84
double s
value of signal when event occurred
Definition: ap_analyzer.h:50
event_class c
Definition: ap_analyzer.h:53
double t
time when event was observed
Definition: ap_analyzer.h:51
double * trace
short trace of signal to analyze
Definition: ap_analyzer.h:52
ap_event * events
Definition: ap_analyzer.h:59
char * name
name of event
Definition: ap_analyzer.h:38
bool p_slope
toggle max min search
Definition: ap_analyzer.h:39
event_meth m
method is MX_VAL
Definition: ap_analyzer.h:37
float * p
array of parameters at previous AP
Definition: ap_analyzer.h:67
int cnt
count number of beats in steady state
Definition: ap_analyzer.h:65
int num_params
number of parameters we use to decide steady state
Definition: ap_analyzer.h:64
float * c
array of parameters at current AP
Definition: ap_analyzer.h:66
int num_APs
minimum number of APs for steady state
Definition: ap_analyzer.h:63
Timers and timer manager.
event_x_threshold x_thresh
Definition: ap_analyzer.h:44
event_mx_val mx_val
Definition: ap_analyzer.h:46
event_mx_rate mx_rate
Definition: ap_analyzer.h:45