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
2763f0ab
Commit
2763f0ab
authored
4 years ago
by
Javier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Automatic truncation (comp_t0) + truncate_data! added
parent
6e94e6a0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
102 additions
and
6 deletions
+102
-6
src/juobs.jl
src/juobs.jl
+1
-1
src/juobs_obs.jl
src/juobs_obs.jl
+44
-5
src/juobs_reader.jl
src/juobs_reader.jl
+57
-0
No files found.
src/juobs.jl
View file @
2763f0ab
...
@@ -8,7 +8,7 @@ include("juobs_reader.jl")
...
@@ -8,7 +8,7 @@ include("juobs_reader.jl")
include
(
"juobs_tools.jl"
)
include
(
"juobs_tools.jl"
)
include
(
"juobs_obs.jl"
)
include
(
"juobs_obs.jl"
)
export
read_mesons
,
read_ms1
,
read_ms
,
read_md
export
read_mesons
,
read_ms1
,
read_ms
,
read_md
,
truncate_data!
export
get_matrix
,
uwgevp_tot
,
energies
,
uwdot
export
get_matrix
,
uwgevp_tot
,
energies
,
uwdot
export
corr_obs
,
md_sea
,
plat_av
,
lin_fit
,
x_lin_fit
,
y_lin_fit
,
fit_routine
export
corr_obs
,
md_sea
,
plat_av
,
lin_fit
,
x_lin_fit
,
y_lin_fit
,
fit_routine
export
meff
,
dec_const_pcvc
,
comp_t0
export
meff
,
dec_const_pcvc
,
comp_t0
...
...
This diff is collapsed.
Click to expand it.
src/juobs_obs.jl
View file @
2763f0ab
...
@@ -138,10 +138,30 @@ t0_r = comp_t0(Y, [38, 58], L=32, rw=[rw1, rw2], pl=true)
...
@@ -138,10 +138,30 @@ t0_r = comp_t0(Y, [38, 58], L=32, rw=[rw1, rw2], pl=true)
```
```
"""
"""
function
comp_t0
(
Y
::
YData
,
plat
::
Vector
{
Int64
};
L
::
Int64
,
pl
::
Bool
=
false
,
rw
::
Union
{
Matrix
{
Float64
},
Nothing
}
=
nothing
,
npol
::
Int64
=
2
)
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
)
Ysl
=
Y
.
Ysl
Ysl
=
Y
.
Ysl
t
=
Y
.
t
t
=
Y
.
t
id
=
Y
.
id
id
=
Y
.
id
replica
=
size
.
([
Ysl
],
1
)
#Truncation
n_ws
=
findfirst
(
x
->
x
==
id
,
ws
.
map_nob
)
if
!
isnothing
(
n_ws
)
ivrep_ws
=
ws
.
fluc
[
n_ws
]
.
ivrep
if
length
(
ivrep_ws
)
!=
1
error
(
"Different number of replicas"
)
end
if
replica
[
1
]
>
ivrep_ws
[
1
]
println
(
"Automatic truncation in Ysl "
,
ivrep_ws
[
1
],
" / "
,
replica
[
1
],
". R = 1"
)
Ysl
=
Ysl
[
1
:
ivrep_ws
[
1
],
:
,
:
]
elseif
replica
[
1
]
<
ivrep_ws
[
1
]
error
(
"Automatic truncation failed. R = 1
\n
Try using truncate_data!"
)
end
end
Ysl
=
isnothing
(
rw
)
?
Ysl
:
apply_rw
(
Ysl
,
rw
)
Ysl
=
isnothing
(
rw
)
?
Ysl
:
apply_rw
(
Ysl
,
rw
)
xmax
=
size
(
Ysl
,
2
)
xmax
=
size
(
Ysl
,
2
)
...
@@ -190,18 +210,37 @@ function comp_t0(Y::YData, plat::Vector{Int64}; L::Int64, pl::Bool=false, rw::Un
...
@@ -190,18 +210,37 @@ function comp_t0(Y::YData, plat::Vector{Int64}; L::Int64, pl::Bool=false, rw::Un
return
t0
return
t0
end
end
function
comp_t0
(
Y
::
Vector
{
YData
},
plat
::
Vector
{
Int64
};
L
::
Int64
,
pl
::
Bool
=
false
,
rw
::
Union
{
Vector
{
Matrix
{
Float64
}},
Nothing
}
=
nothing
,
npol
::
Int64
=
2
)
function
comp_t0
(
Y
::
Vector
{
YData
},
plat
::
Vector
{
Int64
};
L
::
Int64
,
pl
::
Bool
=
false
,
rw
::
Union
{
Vector
{
Matrix
{
Float64
}},
Nothing
}
=
nothing
,
npol
::
Int64
=
2
,
ws
::
ADerrors
.
wspace
=
ADerrors
.
wsg
)
nr
=
length
(
Y
)
nr
=
length
(
Y
)
Ysl
=
getfield
.
(
Y
,
:
Ysl
)
Ysl
=
getfield
.
(
Y
,
:
Ysl
)
t
=
getfield
.
(
Y
,
:
t
)
t
=
getfield
.
(
Y
,
:
t
)
t
=
t
[
1
]
t
=
t
[
1
]
id
=
getfield
.
(
Y
,
:
id
)
id
=
getfield
.
(
Y
,
:
id
)
vtr
=
getfield
.
(
Y
,
:
vtr
)
replica
=
size
.
(
Ysl
,
1
)
replica
=
length
.
(
vtr
)
if
!
all
(
id
.==
id
[
1
])
if
!
all
(
id
.==
id
[
1
])
error
(
"IDs are not equal"
)
error
(
"IDs are not equal"
)
end
end
#Truncation
n_ws
=
findfirst
(
x
->
x
==
id
[
1
],
ws
.
map_nob
)
if
!
isnothing
(
n_ws
)
ivrep_ws
=
ws
.
fluc
[
n_ws
]
.
ivrep
if
length
(
replica
)
!=
length
(
ivrep_ws
)
error
(
"Different number of replicas"
)
end
for
k
=
1
:
length
(
replica
)
if
replica
[
k
]
>
ivrep_ws
[
k
]
println
(
"Automatic truncation in Ysl "
,
ivrep_ws
[
k
],
" / "
,
replica
[
k
],
". R = "
,
k
)
Ysl
[
k
]
=
Ysl
[
k
][
1
:
ivrep_ws
[
k
],
:
,
:
]
elseif
replica
[
k
]
<
ivrep_ws
[
k
]
error
(
"Automatic truncation failed. R = "
,
replica
[
k
],
"
\n
Try using truncate_data!"
)
end
end
end
Ysl
=
isnothing
(
rw
)
?
Ysl
:
apply_rw
(
Ysl
,
rw
)
Ysl
=
isnothing
(
rw
)
?
Ysl
:
apply_rw
(
Ysl
,
rw
)
tmp
=
Ysl
[
1
]
tmp
=
Ysl
[
1
]
...
...
This diff is collapsed.
Click to expand it.
src/juobs_reader.jl
View file @
2763f0ab
...
@@ -329,3 +329,60 @@ function read_ms(path::String; id::Union{Int64, Nothing}=nothing, dtr::Int64=1)
...
@@ -329,3 +329,60 @@ function read_ms(path::String; id::Union{Int64, Nothing}=nothing, dtr::Int64=1)
t
=
Float64
.
(
0
:
nn
)
.*
dn
.*
eps
t
=
Float64
.
(
0
:
nn
)
.*
dn
.*
eps
return
YData
(
vntr
,
t
,
Ysl
,
id
)
return
YData
(
vntr
,
t
,
Ysl
,
id
)
end
end
@doc
raw
"""
truncate_data!(data::YData, nc::Int64)
truncate_data!(data::Vector{YData}, nc::Vector{Int64})
truncate_data!(data::Vector{CData}, nc::Int64)
truncate_data!(data::Vector{Vector{CData}}, nc::Vector{Int64})
Truncates the output of read_mesons and read_ms taking the first nc configurations.
Examples:
```@example
#Single replica
dat = read_mesons(path, "
G5
", "
G5
")
Y = read_ms(path)
truncate_data!(dat, nc)
truncate_data!(Y, nc)
#Two replicas
dat = read_mesons([path1, path2], "
G5
", "
G5
")
Y = read_ms.([path1_ms, path2_ms])
truncate_data!(dat, [nc1, nc2])
truncate_data!(Y, [nc1, nc2])
```
"""
function
truncate_data
!
(
data
::
YData
,
nc
::
Int64
)
data
.
vtr
=
data
.
vtr
[
1
:
nc
]
data
.
Ysl
=
data
.
Ysl
[
1
:
nc
,
:
,
:
]
return
nothing
end
function
truncate_data
!
(
data
::
Vector
{
YData
},
nc
::
Vector
{
Int64
})
truncate_data!
.
(
data
,
nc
)
return
nothing
end
function
truncate_data
!
(
data
::
Vector
{
CData
},
nc
::
Int64
)
N
=
length
(
data
)
for
k
=
1
:
N
data
[
k
]
.
vcfg
=
data
[
k
]
.
vcfg
[
1
:
nc
]
data
[
k
]
.
re_data
=
data
[
k
]
.
re_data
[
1
:
nc
,
:
]
data
[
k
]
.
im_data
=
data
[
k
]
.
im_data
[
1
:
nc
,
:
]
end
return
nothing
end
function
truncate_data
!
(
data
::
Vector
{
Vector
{
CData
}},
nc
::
Vector
{
Int64
})
N
=
length
(
data
)
R
=
length
(
data
[
1
])
for
k
=
1
:
N
for
r
=
1
:
R
data
[
k
][
r
]
.
vcfg
=
data
[
k
][
r
]
.
vcfg
[
1
:
nc
[
r
]]
data
[
k
][
r
]
.
re_data
=
data
[
k
][
r
]
.
re_data
[
1
:
nc
[
r
],
:
]
data
[
k
][
r
]
.
im_data
=
data
[
k
][
r
]
.
im_data
[
1
:
nc
[
r
],
:
]
end
end
return
nothing
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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