Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
juobs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Javier Ugarrio
juobs
Commits
a616f450
Commit
a616f450
authored
Oct 29, 2023
by
Alessandro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added reading routine for reweighting factors produced with openQCD 2.#
parent
72e794ef
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
116 additions
and
6 deletions
+116
-6
src/juobs_obs.jl
src/juobs_obs.jl
+2
-1
src/juobs_reader.jl
src/juobs_reader.jl
+110
-1
src/juobs_tools.jl
src/juobs_tools.jl
+4
-4
No files found.
src/juobs_obs.jl
View file @
a616f450
...
...
@@ -34,7 +34,7 @@ function meff(corr::Vector{uwreal}, plat::Vector{Int64}; pl::Bool=true, data::Bo
ylabel
(
L"
$
m_\mathrm{eff}
$
"
)
xlabel
(
L"
$
x_0
$
"
)
_
,
max_idx
=
findmax
(
value
.
(
corr
))
ylim
(
v
-
20
*
e
,
v
+
2
0
*
e
)
ylim
(
v
-
80
*
e
,
v
+
8
0
*
e
)
xlim
(
left
=
max_idx
)
# ylim(v-30*e, v+30*e)
# ylim(0.15, 0.18)
...
...
@@ -47,6 +47,7 @@ function meff(corr::Vector{uwreal}, plat::Vector{Int64}; pl::Bool=true, data::Bo
title
(
string
(
L"
$
\mu_1 =
$
"
,
mu
[
1
],
L"
$
\mu_2 =
$
"
,
mu
[
2
]))
end
display
(
gcf
())
close
(
"all"
)
end
if
!
data
return
mass
...
...
src/juobs_reader.jl
View file @
a616f450
...
...
@@ -325,21 +325,130 @@ function read_rw(path::String; v::String="1.2")
return
r_data
end
@doc
raw
"""
read_rw_openQCD2(path::String; print_info::Bool=false)
This function reads the reweighting factors generated with openQCD version 2.#.
The flag print_info if set to true print additional information for debugging
"""
function
read_rw_openQCD2
(
path
::
String
;
print_info
::
Bool
=
false
)
data
=
open
(
path
,
"r"
)
nrw
=
read
(
data
,
Int32
)
nrw
=
Int32
(
nrw
/
2
)
nfct
=
Array
{
Int32
}(
undef
,
nrw
)
read!
(
data
,
nfct
)
nsrc
=
Array
{
Int32
}(
undef
,
nrw
)
read!
(
data
,
nsrc
)
null
=
read
(
data
,
Int32
)
if
null
!==
Int32
(
0
)
error
(
"In openQCD 2.0 this Int32 should be a zero."
)
end
data_array
=
Array
{
Array
{
Float64
}}(
undef
,
nrw
)
[
data_array
[
k
]
=
Array
{
Float64
}(
undef
,
0
)
for
k
in
1
:
nrw
]
vcfg
=
Vector
{
Int32
}(
undef
,
0
)
while
!
eof
(
data
)
push!
(
vcfg
,
read
(
data
,
Int32
))
if
print_info
println
(
"
\n
######## cnfg: "
,
vcfg
[
end
])
end
for
k
in
1
:
nrw
read_array_rwf_dat_openQCD2
(
data
)
tmp_rw
,
n
=
read_array_rwf_dat_openQCD2
(
data
)
tmp_nfct
=
1.0
for
j
in
1
:
n
[
1
]
tmp_nfct
*=
mean
((
exp
.
(
.-
tmp_rw
[
j
])))
end
push!
(
data_array
[
k
],
tmp_nfct
)
end
end
return
permutedims
(
hcat
(
data_array
...
),
(
2
,
1
))
end
function
read_array_rwf_dat_openQCD2
(
data
::
IOStream
;
print_info
::
Bool
=
false
)
d
=
read
(
data
,
Int32
)
n
=
Array
{
Int32
}(
undef
,
d
)
read!
(
data
,
n
)
size
=
read
(
data
,
Int32
)
m
=
prod
(
n
)
if
print_info
println
(
"d: "
,
d
)
println
(
"n: "
,
n
)
println
(
"size: "
,
size
)
println
(
"m: "
,
m
)
end
if
size
==
4
types
=
Int32
elseif
size
==
8
types
=
Float64
elseif
size
==
16
types
=
Float64x2
else
error
(
"No type with size=
$(size)
supported"
)
end
tmp_data
=
Array
{
types
}(
undef
,
m
)
read!
(
data
,
tmp_data
)
res
=
parse_array_openQCD2
(
d
,
n
,
tmp_data
,
quadprec
=
true
)
return
res
,
n
end
function
parse_array_openQCD2
(
d
,
n
,
dat
;
quadprec
=
true
)
if
d
!=
2
error
(
"dat must be a two-dimensional array"
)
end
res
=
Vector
{
Vector
{
Float64
}}(
undef
,
0
)
for
k
in
range
(
1
,
n
[
1
])
tmp
=
dat
[(
k
-
1
)
*
n
[
2
]
+
1
:
k
*
n
[
2
]]
if
quadprec
tmp2
=
Vector
{
Float64
}(
undef
,
0
)
for
j
in
range
(
start
=
1
,
step
=
2
,
stop
=
length
(
tmp
))
push!
(
tmp2
,
tmp
[
j
])
end
push!
(
res
,
tmp2
)
else
push!
(
res
,
tmp
)
end
end
return
res
end
@doc
raw
"""
read_ms1(path::String; v::String="
1.2
")
Reads openQCD ms1 dat files at a given path. This method returns a matrix `W[irw, icfg]` that contains the reweighting factors, where
`irw` is the `rwf` index and icfg the configuration number.
The function is compatible with the output files of openQCD v=1.2, 1.4
and 1.6
. Version can be specified as argument.
The function is compatible with the output files of openQCD v=1.2, 1.4
, 1.6 and 2.0
. Version can be specified as argument.
Examples:
```@example
read_ms1(path)
read_ms1(path, v="
1.4
")
read_ms1(path, v="
1.6
")
read_ms1(path, v="
2.0
")
```
"""
function
read_ms1
(
path
::
String
;
v
::
String
=
"1.2"
)
if
v
==
"2.0"
return
read_rw_openQCD2
(
path
)
end
r_data
=
read_rw
(
path
,
v
=
v
)
nrw
=
length
(
r_data
)
ncnfg
=
size
(
r_data
[
1
])[
3
]
...
...
src/juobs_tools.jl
View file @
a616f450
...
...
@@ -725,7 +725,7 @@ function bayesian_av(fun::Function, y::Array{uwreal}, tmin_array::Array{Int64},
subplots_adjust
(
hspace
=
0.1
)
subplot
(
411
)
if
!
isnothing
(
plt_title
)
title
(
plt_title
)
#
title(plt_title)
end
ax1
=
gca
()
x
=
1
:
length
(
p1
)
...
...
@@ -751,7 +751,7 @@ function bayesian_av(fun::Function, y::Array{uwreal}, tmin_array::Array{Int64},
setp
(
ax3
.
get_xticklabels
(),
visible
=
false
)
# Disable x tick labels
bar
(
x
,
Pval
,
alpha
=
0.4
,
color
=
"forestgreen"
,
edgecolor
=
"darkgreen"
,
linewidth
=
1.5
)
ylabel
(
L"
$
p
\
value
$
"
)
ylabel
(
L"
$
p
-
value
$
"
)
subplot
(
414
)
...
...
@@ -759,8 +759,8 @@ function bayesian_av(fun::Function, y::Array{uwreal}, tmin_array::Array{Int64},
# ylabel(L"$\chi^2/\chi^2_{\mathrm{exp}}$")
ylabel
(
L"
$
\chi^2/\mathrm{d.o.f.}
$
"
)
xticks
(
x
,
mods
,
rotation
=
45
)
xlabel
(
L"
$
Models
$
"
)
xlabel
(
L"
$
\mathrm{Models} \ [t_{\mathrm{min}}/a,t_{\mathrm{max}}/a]
$
"
)
tight_layout
()
display
(
fig
)
if
!
isnothing
(
path_plt
)
#tt = plt_title *".pdf"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment