-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScience.cpp
More file actions
60 lines (35 loc) · 1.05 KB
/
Science.cpp
File metadata and controls
60 lines (35 loc) · 1.05 KB
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
#include "Science.h"
float computeMeanOfFrame(float *Y, int width, int height) {
int i;
float m = 0.0;
for (i=0; i<height*width; i++) {
m += Y[i];
}
return m/(float)(height*width);
}
void computeFlux(float *sumY, float *sumXY, float *sumX, float *sumX2, uint8_t *pointsConsidered, int width, int height, float *fluxImage) {
int i;
int N;
for (i=0; i<height*width; i++) {
N = pointsConsidered[i];
if (N>1) {
fluxImage[i] = (sumXY[i]*(float)N - sumX[i]*sumY[i])/(sumX2[i]*(float)N - sumX[i]*sumX[i]);
} else {
fluxImage[i] = 0.0/0.0;
}
}
}
void sumProducts(float *sumXY, float *Y, float X, int maxADU, int width, int height) {
int i;
for (i=0; i<height*width; i++) {
if (Y[i]<maxADU)
sumXY[i] += Y[i]*X;
}
}
void sumProductsX(float *sumX, float X1, float X2, float *Y, int maxADU, int width, int height) {
int i;
for (i=0; i<height*width; i++) {
if (Y[i]<maxADU)
sumX[i] += X1*X2;
}
}