diff --git a/Project.toml b/Project.toml index 78cb442..839f381 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SynthDiag" uuid = "c6e34158-aa22-49e4-bb12-15cbcb518ce6" authors = ["Anchal Gupta "] -version = "1.0.2" +version = "1.0.3" [deps] ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63" diff --git a/src/noise.jl b/src/noise.jl index 84b46a2..f8053c3 100644 --- a/src/noise.jl +++ b/src/noise.jl @@ -64,8 +64,8 @@ Create a noise model from a power spectral density data given as a vector along frequency values. The power spectral density is stored as a `DSP.Periodograms.Periodogram` calculated from the input data. """ -function Noise(power_spectrum::Vector{Float64}, freq::AbstractRange)::Noise - pgram = DSP.Periodograms.Periodogram(power_spectrum, freq) +function Noise(power_spectral_density::Vector{Float64}, freq::AbstractRange)::Noise + pgram = DSP.Periodograms.Periodogram(power_spectral_density, freq) return Noise(pgram) end @@ -79,7 +79,8 @@ spectral density. """ function generate_noise(n::Noise, t::Vector{Float64})::Vector{Float64} signal = zeros(Float64, length(t)) - amp_spec = sqrt.(n.pgram.power * 2) + bw = n.pgram.freq[2] - n.pgram.freq[1] + amp_spec = sqrt.(n.pgram.power * 2 * bw) for (ii, ff) ∈ enumerate(n.pgram.freq) signal .+= amp_spec[ii] .* cos.(2π .* (ff .* t .+ randn())) end