FACT++
1.0
Main Page
Related Pages
Namespaces
Classes
Files
Examples
pair<vector<float>, vector<float> > StateMachineFeedback::AverageCurrents
(
const int16_t *
ptr
,
int
n
)
inline
private
Definition at line
174
of file
feedback.cc
.
References
i
, and
BIAS::kNumChannels
.
175
{
176
if
(
fCursorCur
++>=0)
177
{
178
for
(
int
i
=0;
i
<
BIAS::kNumChannels
;
i
++)
179
{
180
fCurrentsAvg
[
i
] += ptr[
i
];
181
fCurrentsRms
[
i
] += ptr[
i
]*ptr[
i
];
182
}
183
}
184
185
if
(
fCursorCur
<n)
186
return
make_pair(vector<float>(), vector<float>());
187
188
const
double
conv = 5e-3/4096;
189
190
vector<float> rms(
BIAS::kNumChannels
);
191
vector<float> avg(
BIAS::kNumChannels
);
192
for
(
int
i
=0;
i
<
BIAS::kNumChannels
;
i
++)
193
{
194
avg[
i
] = double(
fCurrentsAvg
[
i
])/
fCursorCur
* conv;
195
rms[
i
] = double(
fCurrentsRms
[
i
])/
fCursorCur
* conv * conv;
196
rms[
i
] -= avg[
i
]*avg[
i
];
197
rms[
i
] = rms[
i
]<0 ? 0 : sqrt(rms[
i
]);
198
}
199
200
return
make_pair(avg, rms);
201
}
StateMachineFeedback::fCursorCur
int64_t fCursorCur
Definition:
feedback.cc:61
i
int i
Definition:
db_dim_client.c:21
StateMachineFeedback::fCurrentsAvg
vector< int64_t > fCurrentsAvg
Definition:
feedback.cc:49
BIAS::kNumChannels
Definition:
HeadersBIAS.h:10
StateMachineFeedback::fCurrentsRms
vector< int64_t > fCurrentsRms
Definition:
feedback.cc:50
StateMachineFeedback
Generated on Sun Sep 18 2016 20:51:00 for FACT++ by
1.8.11