Commit 642b1656 authored by ale's avatar ale

bug apply_rw

parent 923832a2
...@@ -4,20 +4,22 @@ function apply_rw(data::Array{Float64}, W::Matrix{Float64}, vcfg::Union{Nothing, ...@@ -4,20 +4,22 @@ function apply_rw(data::Array{Float64}, W::Matrix{Float64}, vcfg::Union{Nothing,
vcfg = collect(1:nc) vcfg = collect(1:nc)
end end
rw1 = W[1, 1:nc]
rw2 = W[2, 1:nc]
if fs == false if fs == false
if id == "A653" if id == "A653"
rw1 = W[1, 1:nc]
rw = rw1 rw = rw1
data_r = data .* rw[vcfg] data_r = data .* rw[vcfg]
return (data_r, rw) return (data_r, rw)
else else
rw1 = W[1, 1:nc]
rw2 = W[2, 1:nc]
rw = rw1 .* rw2 rw = rw1 .* rw2
data_r = data .* rw[vcfg] data_r = data .* rw[vcfg]
return (data_r, rw) return (data_r, rw)
end end
else else
rw1 = W[1, 1:nc]
rw2 = W[2, 1:nc]
rw_s = [1.0 for i in 1:nc] rw_s = [1.0 for i in 1:nc]
rw_s[flag_s[id]] .= -1.0 rw_s[flag_s[id]] .= -1.0
rw = rw1 .* rw2 .* rw_s rw = rw1 .* rw2 .* rw_s
...@@ -32,20 +34,22 @@ function apply_rw(data::Vector{<:Array{Float64}}, W::Vector{Matrix{Float64}}, vc ...@@ -32,20 +34,22 @@ function apply_rw(data::Vector{<:Array{Float64}}, W::Vector{Matrix{Float64}}, vc
vcfg = [collect(1:nc[k]) for k=1:length(nc)] vcfg = [collect(1:nc[k]) for k=1:length(nc)]
end end
rw1 = [W[k][1, 1:nc[k]] for k=1:length(W)]
rw2 = [W[k][2, 1:nc[k]] for k=1:length(W)]
if fs == false if fs == false
if id == "A653" if id == "A653"
rw1 = [W[k][1, 1:nc[k]] for k=1:length(W)]
rw = [rw1[k] for k =1:length(W)] rw = [rw1[k] for k =1:length(W)]
data_r = [data[k] .* rw[k][vcfg[k]] for k=1:length(data)] data_r = [data[k] .* rw[k][vcfg[k]] for k=1:length(data)]
return (data_r, rw) return (data_r, rw)
else else
rw1 = [W[k][1, 1:nc[k]] for k=1:length(W)]
rw2 = [W[k][2, 1:nc[k]] for k=1:length(W)]
rw = [rw1[k] .* rw2[k] for k =1:length(W)] rw = [rw1[k] .* rw2[k] for k =1:length(W)]
data_r = [data[k] .* rw[k][vcfg[k]] for k=1:length(data)] data_r = [data[k] .* rw[k][vcfg[k]] for k=1:length(data)]
return (data_r, rw) return (data_r, rw)
end end
else else
rw1 = [W[k][1, 1:nc[k]] for k=1:length(W)]
rw2 = [W[k][2, 1:nc[k]] for k=1:length(W)]
rw_s = [[1.0 for i in 1:nc[k]] for k=1:length(W)] rw_s = [[1.0 for i in 1:nc[k]] for k=1:length(W)]
if id == "H105" if id == "H105"
rw_s[1][flag_s["H105r001"]] .= -1.0 rw_s[1][flag_s["H105r001"]] .= -1.0
......
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