Commit 88a5a34f authored by Javier's avatar Javier

read_ms also reads Qsl and Wsl

parent e1b4dd72
......@@ -216,7 +216,7 @@ function comp_t0(Y::YData, plat::Vector{Int64}; L::Int64, pl::Bool=false,
rw::Union{Matrix{Float64}, Nothing}=nothing, npol::Int64=2, ws::ADerrors.wspace=ADerrors.wsg,
wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}}, Nothing}=nothing)
Ysl = Y.Ysl
Ysl = Y.obs
t = Y.t
id = Y.id
replica = size.([Ysl], 1)
......@@ -296,7 +296,7 @@ function comp_t0(Y::Vector{YData}, plat::Vector{Int64}; L::Int64, pl::Bool=false
wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}}, Nothing}=nothing)
nr = length(Y)
Ysl = getfield.(Y, :Ysl)
Ysl = getfield.(Y, :obs)
t = getfield.(Y, :t)
t = t[1]
id = getfield.(Y, :id)
......
......@@ -275,13 +275,13 @@ function read_md(path::String)
end
@doc raw"""
read_ms(path::String; id::Union{String, Nothing}=nothing, dtr::Int64=1)
read_ms(path::String; id::Union{String, Nothing}=nothing, dtr::Int64=1, obs::String="Y")
Reads openQCD ms dat files at a given path. This method return YData:
- `t(t)`: flow time values
- `Ysl(icfg, x0, t)`: the time-slice sums of the densities of the Yang-Mills action
- `obs(icfg, x0, t)`: the time-slice sums of the densities of the observable (Wsl, Ysl or Qsl)
- `vtr`: vector that contains trajectory number
......@@ -295,7 +295,7 @@ Examples:
Y = read_ms(path)
```
"""
function read_ms(path::String; id::Union{String, Nothing}=nothing, dtr::Int64=1)
function read_ms(path::String; id::Union{String, Nothing}=nothing, dtr::Int64=1 , obs::String="Y")
if isnothing(id)
bname = basename(path)
m = findfirst(r"[A-Z][0-9]{3}r[0-9]{3}", bname)
......@@ -351,7 +351,17 @@ function read_ms(path::String; id::Union{String, Nothing}=nothing, dtr::Int64=1)
end
close(data)
t = Float64.(0:nn) .* dn .* eps
if obs == "W"
return YData(vntr, t, Wsl, id)
elseif obs == "Y"
return YData(vntr, t, Ysl, id)
elseif obs == "Q"
return YData(vntr, t, Qsl, id)
else
println("obs = ", obs," is not valid")
return nothing
end
end
@doc raw"""
......@@ -382,7 +392,7 @@ truncate_data!(Y, [nc1, nc2])
"""
function truncate_data!(data::YData, nc::Int64)
data.vtr = data.vtr[1:nc]
data.Ysl = data.Ysl[1:nc, :, :]
data.obs = data.obs[1:nc, :, :]
return nothing
end
function truncate_data!(data::Vector{YData}, nc::Vector{Int64})
......
......@@ -172,7 +172,7 @@ end
mutable struct YData
vtr::Vector{Int32}
t::Vector{Float64}
Ysl::Array{Float64, 3}
obs::Array{Float64, 3}
id::String
YData(a, b, c, d) = new(a, b, c, d)
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment