-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update smoothing with edge smoothing (#55) * Add NodalGPU to dev (#56) * Update Nodal stuff * Fix CorrData filtering typo * Fix wrong id when file starts before midnight * Typo in RawData fix * Fix shorten bug with newlag/sampling rate mismatch * Allow whiten! to work with ComplexF64 * Remove Plots and DataFrames dependencies!
- Loading branch information
Showing
14 changed files
with
291 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,33 @@ | ||
export corrplot | ||
@recipe function f(C::CorrData) | ||
# set up the subplots | ||
grid := false | ||
layout := (2,1) | ||
|
||
""" | ||
corrplot(C) | ||
Plot a CorrData matrix. | ||
""" | ||
function corrplot(C::CorrData) | ||
lags = -C.maxlag:1/C.fs:C.maxlag | ||
times = Dates.format.(Dates.unix2datetime.(C.t),"yyyy/m/d HH:MM") | ||
Cstack = stack(C,allstack=true) | ||
plot( | ||
heatmap(lags,times,C.corr',c=:balance,legend=:none), | ||
plot(lags,Cstack.corr,c=:black,linewidth=1.5,legend=:none,xlabel="Lag [s]"), | ||
layout = grid(2,1,heights=[0.75,0.25]), link=:x,dpi=1000) | ||
end | ||
|
||
# main heatmap | ||
@series begin | ||
legend := false | ||
seriestype := :heatmap | ||
ytickfontsize --> 10 | ||
xtickfontsize --> 8 | ||
subplot := 1 | ||
seriescolor --> :balance | ||
lags,times,C.corr' | ||
end | ||
|
||
# bottom stack | ||
@series begin | ||
subplot := 2 | ||
label := false | ||
title --> C.name | ||
xguide --> "Lag [s]" | ||
titlefontsize --> 6 | ||
ytickfontsize --> 10 | ||
xtickfontsize --> 8 | ||
seriescolor --> :black | ||
xlims --> (lags[1],lags[end]) | ||
lags,stack(C,allstack=true).corr | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
export gpu,cpu, NodalCorr | ||
|
||
mutable struct NodalCorr <: NoiseData | ||
n::Int64 | ||
id::Array{String,1} # id | ||
name::Array{String,1} # name | ||
loc::Array{<:InstrumentPosition,1} # loc | ||
fs::Float64 # fs | ||
src::String # src | ||
t::Array{Array{Int64,2},1} # time | ||
corr::AbstractArray{Float32, 2} # actual data | ||
|
||
function NodalCorr( | ||
n ::Int64, | ||
id ::Array{String,1}, | ||
name ::Array{String,1}, | ||
loc ::Array{<:InstrumentPosition,1}, | ||
fs ::Float64, | ||
src ::String, | ||
t ::Array{Array{Int64,2},1} , | ||
corr ::AbstractArray{<:AbstractFloat,2}, | ||
) | ||
|
||
return new(n, id, name, loc, fs, src, t, corr) | ||
end | ||
end | ||
|
||
NodalCorr(; | ||
n ::Int64 = 0, | ||
id ::Array{String,1} = Array{String}(undef,0), | ||
name ::Array{String,1} = Array{String}(undef,0), | ||
loc ::Array{InstrumentPosition,1} = Array{InstrumentPosition}(undef,0), | ||
fs ::Float64 = zero(Float64), | ||
src ::String = "", | ||
t ::Array{Array{Int64,2},1} = Array{Array{Int64,2},1}(undef,0), | ||
corr ::AbstractArray{<:AbstractFloat,2} = Array{Float32,2}(undef, 0, 2), | ||
) = CorrData(n, id, name, loc, fs, src, t, corr) | ||
|
||
|
||
# functions for adapting NodalData to GPU | ||
cpu(m::NodalData) = adapt(Array,m) | ||
gpu(x::NodalData) = use_cuda[] ? cu(x) : x | ||
|
||
# function for adapting NodalCorr to GPU | ||
cpu(m::NodalCorr) = adapt(Array,m) | ||
gpu(x::NodalCorr) = use_cuda[] ? cu(x) : x | ||
|
||
Adapt.adapt_structure(to, N::NodalData) = NodalData( | ||
N.n, | ||
N.ox, | ||
N.oy, | ||
N.oz, | ||
N.info, | ||
N.id, | ||
N.name, | ||
N.loc, | ||
N.fs, | ||
N.gain, | ||
N.resp, | ||
N.units, | ||
N.src, | ||
N.misc, | ||
N.notes, | ||
N.t, | ||
adapt(to,N.data), | ||
) | ||
|
||
Adapt.adapt_structure(to, N::NodalCorr) = NodalCorr( | ||
N.n, | ||
N.id, | ||
N.name, | ||
N.loc, | ||
N.fs, | ||
N.gain, | ||
N.resp, | ||
N.units, | ||
N.src, | ||
N.t, | ||
adapt(to,N.corr), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.