Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97129790
im_stat.c
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Jan 2, 18:45
Size
1 KB
Mime Type
text/x-c
Expires
Sat, Jan 4, 18:45 (2 d)
Engine
blob
Format
Raw Data
Handle
23333630
Attached To
R1448 Lenstool-HPC
im_stat.c
View Options
#include<stdio.h>
#include<math.h>
#include "fonction.h"
#include "constant.h"
#include"dimension.h"
#include "structure.h"
void im_stat(double **im, int nx, int ny, double *mean, double *disp)
{
register int i, j, k;
double s, s2, moy, sig;
s = s2 = 0.;
for (i = 0; i < nx; i++)
for (j = 0; j < ny; j++)
{
s += im[i][j];
s2 += im[i][j] * im[i][j];
};
moy = s / nx / ny;
sig = sqrt(s2 / nx / ny - moy * moy);
k = 0;
s = s2 = 0.;
for (i = 0; i < nx; i++)
for (j = 0; j < ny; j++)
if (fabs(im[i][j] - moy) < 3.*sig)
{
s += im[i][j];
s2 += im[i][j] * im[i][j];
k++;
};
moy = s / nx / ny;
sig = sqrt(s2 / nx / ny - moy * moy);
k = 0;
s = s2 = 0.;
for (i = 0; i < nx; i++)
for (j = 0; j < ny; j++)
if (fabs(im[i][j] - moy) < 3.*sig)
{
s += im[i][j];
s2 += im[i][j] * im[i][j];
k++;
};
*mean = s / k;
*disp = sqrt(s2 / k - (*mean) * (*mean));
}
Event Timeline
Log In to Comment