Commit fd2b4f49 authored by Javier's avatar Javier

ensemble id: Int64 -> String

parent 08e2b69f
......@@ -156,7 +156,7 @@ function comp_t0(Y::YData, plat::Vector{Int64}; L::Int64, pl::Bool=false,
replica = size.([Ysl], 1)
#Truncation
n_ws = findfirst(x-> x == id, ws.map_nob)
n_ws = findfirst(x-> x == ws.str2id[id], ws.map_nob)
if !isnothing(n_ws)
ivrep_ws = ws.fluc[n_ws].ivrep
......@@ -240,7 +240,7 @@ function comp_t0(Y::Vector{YData}, plat::Vector{Int64}; L::Int64, pl::Bool=false
error("IDs are not equal")
end
#Truncation
n_ws = findfirst(x-> x == id[1], ws.map_nob)
n_ws = findfirst(x-> x == ws.str2id[id[1]], ws.map_nob)
if !isnothing(n_ws)
ivrep_ws = ws.fluc[n_ws].ivrep
......
......@@ -81,13 +81,13 @@ function read_CHeader(path::String; legacy::Bool=false)
end
@doc raw"""
read_mesons(path::String, g1::Union{String, Nothing}=nothing, g2::Union{String, Nothing}=nothing; id::Union{Int64, Nothing}=nothing, legacy::Bool=false)
read_mesons(path::String, g1::Union{String, Nothing}=nothing, g2::Union{String, Nothing}=nothing; id::Union{String, Nothing}=nothing, legacy::Bool=false)
read_mesons(path::Vector{String}, g1::Union{String, Nothing}=nothing, g2::Union{String, Nothing}=nothing; id::Union{Int64, Nothing}=nothing, legacy::Bool=false)
read_mesons(path::Vector{String}, g1::Union{String, Nothing}=nothing, g2::Union{String, Nothing}=nothing; id::Union{String, Nothing}=nothing, legacy::Bool=false)
This function read a mesons dat file at a given path and returns a vector of `CData` structures for different masses and Dirac structures.
Dirac structures `g1` and/or `g2` can be passed as string arguments in order to filter correaltors.
ADerrors id can be specified as argument. If is not specified, the `id` is fixed according to the ensemble name (example: "H400"-> id = 400)
ADerrors id can be specified as argument. If is not specified, the `id` is fixed according to the ensemble name (example: "H400"-> id = "H400")
*For the old version (without smearing, distance preconditioning and theta) set legacy=true.
......@@ -97,17 +97,18 @@ read_mesons(path)
read_mesons(path, "G5")
read_mesons(path, nothing, "G5")
read_mesons(path, "G5", "G5")
read_mesons(path, "G5", "G5", id=1)
read_mesons(path, "G5", "G5", id="H100")
read_mesons(path, "G5_d2", "G5_d2", legacy=true)
```
"""
function read_mesons(path::String, g1::Union{String, Nothing}=nothing, g2::Union{String, Nothing}=nothing; id::Union{Int64, Nothing}=nothing, legacy::Bool=false)
function read_mesons(path::String, g1::Union{String, Nothing}=nothing, g2::Union{String, Nothing}=nothing; id::Union{String, Nothing}=nothing, legacy::Bool=false)
t1 = isnothing(g1) ? nothing : findfirst(x-> x==g1, gamma_name) - 1
t2 = isnothing(g2) ? nothing : findfirst(x-> x==g2, gamma_name) - 1
if isnothing(id)
bname = basename(path)
m = findfirst(r"[A-Z][0-9]{3}r[0-9]{3}", bname)
id = parse(Int64, bname[m[2:4]])
id = bname[m[1:4]]
#id = parse(Int64, bname[m[2:4]])
end
data = open(path, "r")
......@@ -171,7 +172,7 @@ function read_mesons(path::String, g1::Union{String, Nothing}=nothing, g2::Union
return res
end
function read_mesons(path::Vector{String}, g1::Union{String, Nothing}=nothing, g2::Union{String, Nothing}=nothing; id::Union{Int64, Nothing}=nothing, legacy::Bool=false)
function read_mesons(path::Vector{String}, g1::Union{String, Nothing}=nothing, g2::Union{String, Nothing}=nothing; id::Union{String, Nothing}=nothing, legacy::Bool=false)
res = read_mesons.(path, g1, g2, id=id, legacy=legacy)
nrep = length(res)
ncorr = length(res[1])
......@@ -274,7 +275,7 @@ function read_md(path::String)
end
@doc raw"""
read_ms(path::String; id::Union{Int64, Nothing}=nothing, dtr::Int64=1)
read_ms(path::String; id::Union{String, Nothing}=nothing, dtr::Int64=1)
Reads openQCD ms dat files at a given path. This method return YData:
......@@ -286,16 +287,20 @@ Reads openQCD ms dat files at a given path. This method return YData:
- `id`: ensmble id
`dtr` = `dtr_cnfg` / `dtr_ms`, where `dtr_cnfg` is the number of trajectories computed before saving the configuration. `dtr_ms`
is the same but applied to the ms.dat file.
Examples:
```@example
Y = read_ms(path)
```
"""
function read_ms(path::String; id::Union{Int64, Nothing}=nothing, dtr::Int64=1)
function read_ms(path::String; id::Union{String, Nothing}=nothing, dtr::Int64=1)
if isnothing(id)
bname = basename(path)
m = findfirst(r"[A-Z][0-9]{3}r[0-9]{3}", bname)
id = parse(Int64, bname[m[2:4]])
id = bname[m[1:4]]
#id = parse(Int64, bname[m[2:4]])
end
data = open(path, "r")
......
......@@ -133,7 +133,7 @@ mutable struct CData
vcfg::Array{Int32}
re_data::Array{Float64}
im_data::Array{Float64}
id::Int64
id::String
CData(a, b, c, d, e) = new(a, b, c, d, e)
end
......@@ -173,7 +173,7 @@ mutable struct YData
vtr::Vector{Int32}
t::Vector{Float64}
Ysl::Array{Float64, 3}
id::Int64
id::String
YData(a, b, c, d) = new(a, b, c, d)
end
......@@ -214,4 +214,14 @@ end
function Base.show(io::IO, a::CData)
print(io, a.header)
end
function Base.show(io::IO, a::Corr)
fnames = fieldnames(Corr)
for k in fnames
f = getfield(a, k)
if k != :obs
print(io, "$k = $f\t")
end
end
end
\ No newline at end of file
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