-
Notifications
You must be signed in to change notification settings - Fork 1
/
exp.h
98 lines (65 loc) · 2.09 KB
/
exp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#ifndef CT_EXPERIMENT_H
#define CT_EXPERIMENT_H
#include <iris.h>
#include <rgb.h>
#include <dkl.h>
#include <fs.h>
#include <data.h>
#include <yaml-cpp/yaml.h>
#include "stimulus.h"
namespace colortilt {
struct response {
response(const colortilt::stimulus &s, double phi, double duration, double phi_start)
: stimulus(s), phi(phi), duration(duration), phi_start(phi_start) { }
colortilt::stimulus stimulus;
double phi;
double duration;
double phi_start;
};
struct session {
std::string stim;
std::string rnd;
static session from_string(const std::string &str);
std::string name() const {
return stim + "@" + rnd;
}
explicit operator bool() const {
return !stim.empty() && !rnd.empty();
}
};
struct trail {
std::string stim;
std::string rnd;
std::string name() const {
return stim + "@" + rnd;
}
static trail from_string(const std::string &str);
};
struct experiment {
double c_fg;
double c_bg;
double cursor_gain;
std::string data_path;
std::string stim_path;
std::string sess_path;
static experiment from_yaml(const fs::file &path);
static fs::file find_file(const::std::string &name, const std::string &additional_path);
fs::file data_dir() const;
fs::file stim_dir() const;
fs::file sess_dir() const;
fs::file resp_dir(const iris::data::subject &sub) const;
fs::file session_file(const iris::data::subject &s) const;
fs::file stim_file(const session &s) const;
fs::file rnd_file(const session &s) const;
fs::file resp_file(const session &ses, const iris::data::subject &sub, const std::string &prefix = "") const;
std::vector<std::string> subjects() const;
std::vector<session> load_sessions(const iris::data::subject &sub) const;
std::vector<trail> list_trails(const iris::data::subject &sub) const;
session next_session(const iris::data::subject &sub) const;
//utility
fs::file make_file(const std::string &path) const;
// runtime data
fs::file source_file;
};
} // colortilt::
#endif //CT_EXPERIMENT_H