Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92998420
bayesError.pl
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
Mon, Nov 25, 11:48
Size
824 B
Mime Type
text/x-perl
Expires
Wed, Nov 27, 11:48 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22550066
Attached To
R1448 Lenstool-HPC
bayesError.pl
View Options
#!/usr/bin/perl
#
Compute
the
sum
of
the
relative
errors
of
all
or
part
of
the
parameters
#
in
function
of
the
number
of
samples
#
#
Syntax
:
bayesError
.
pl
[
-
r
<
i
-
j>
]
#
#
use
Getopt
::
Std
;
getopt
(
'r'
);
@cols
=
split
(
'-'
,
$
opt_r
)
if
(
$
opt_r
);
open
(
IN
,
"bayes.dat"
);
open
(
OUT
,
">bayesError.dat"
);
$
samp
=
0
;
LINE
:
while
(
<
IN
>
)
{
next
LINE
if
(
/^#/
);
print
"Process sample $samp\r"
;
@fld
=
split
(
' '
);
@cols
=
(
3
,
$
#fld
+
1
)
if
(
!
@cols
);
$
samp++
;
$
sum
=
0
.;
#
for
all
the
parameters
on
this
line
for
(
$
i
=
$
cols
[
0
]
-
1
;
$
i
<
$
cols
[
1
];
$
i++
)
{
$
avg
[
$
i
]
+=
$
fld
[
$
i
];
$
err
[
$
i
]
+=
$
fld
[
$
i
]
*
$
fld
[
$
i
];
#
mean
and
stddev
for
the
$
i
parameter
$
mean=
$
avg
[
$
i
]
/
$
samp
;
$
var=
$
err
[
$
i
]
/
$
samp
-
$
mean*
$
mean
;
#
$
stddev
=
sqrt
(
$
var
);
#printf
OUT
"%f "
,
$
stddev/
$
mean
;
$
sum+=
$
var/
$
mean/
$
mean
;
}
printf
OUT
"%f\n"
,
sqrt
(
$
sum
);
}
Event Timeline
Log In to Comment