Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F11222361
compare-integrals.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
compare-integrals.py
View Options
import
re
,
sys
from
math
import
sqrt
re_num
=
re
.
compile
(
"\w+\(\w+\) = (\d*\.\d+E.*)"
)
re_nums
=
re
.
compile
(
"\w+ *(\d+\.\d+E*\S*) *(\d*\.\d+E*\S*)"
)
number
=
lambda
line
:
float
(
re_num
.
search
(
line
)
.
group
(
1
))
numbers
=
lambda
line
:
(
float
(
re_nums
.
search
(
line
)
.
group
(
1
)),
float
(
re_nums
.
search
(
line
)
.
group
(
2
)))
process
=
sys
.
argv
[
1
]
filename
=
process
+
'.log'
reference_file
=
sys
.
argv
[
2
]
with
open
(
filename
,
'r'
)
as
infile
:
for
line
in
infile
:
if
'integral('
in
line
:
integral
=
number
(
line
)
if
'error('
in
line
:
error
=
number
(
line
)
with
open
(
reference_file
,
'r'
)
as
infile
:
for
line
in
infile
:
if
process
+
' '
in
line
:
ref_integral
,
ref_error
=
numbers
(
line
)
print
'Reference:'
,
ref_integral
,
'+-'
,
ref_error
try
:
print
process
,
integral
,
'+-'
,
error
error_sum
=
sqrt
(
error
**
2
+
ref_error
**
2
)
pull
=
abs
(
integral
-
ref_integral
)
/
error_sum
print
'pull:'
,
pull
valid
=
pull
<
3
except
NameError
:
print
'Number not found. Run failed.'
valid
=
False
returncode
=
0
if
valid
else
1
sys
.
exit
(
returncode
)
File Metadata
Details
Attached
Mime Type
text/x-python
Expires
Wed, May 14, 11:48 AM (3 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4973818
Default Alt Text
compare-integrals.py (1 KB)
Attached To
rWHIZARDSVN whizardsvn
Event Timeline
Log In to Comment