Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Gaussian Noise Process submodule #62

Closed
wants to merge 19 commits into from
Closed

Conversation

kdbarajas
Copy link
Collaborator

@kdbarajas kdbarajas commented Apr 13, 2022

TODO::

  • - Add unit test
  • - Change CARMAProcess --> GaussianNoiseProcess
  • - Add assertions/error codes for incorrect inputs or failures
  • - Docstrings
  • - Add examples
  • - update docs to say import numpy and scipy in your python

@marwahaha
Copy link
Member

more on submodules here: https://docs.julialang.org/en/v1/manual/modules/

@codecov
Copy link

codecov bot commented Apr 14, 2022

Codecov Report

Merging #62 (08a2b3a) into master (e62be49) will decrease coverage by 12.8%.
The diff coverage is 50.7%.

@@            Coverage Diff            @@
##           master     #62      +/-   ##
=========================================
- Coverage    92.3%   79.5%   -12.8%     
=========================================
  Files          15      23       +8     
  Lines        1165    1679     +514     
=========================================
+ Hits         1075    1334     +259     
- Misses         90     345     +255     
Impacted Files Coverage Δ
src/noise/ARMA_NoiseProcess.jl 0.0% <0.0%> (ø)
src/noise/noisevector.jl 0.0% <0.0%> (ø)
src/noise/todo_noise_example_test.jl 0.0% <0.0%> (ø)
src/noise/Gaussian_types.jl 46.5% <46.5%> (ø)
src/noise/CARMA_NoiseProcess.jl 48.1% <48.1%> (ø)
src/lasers.jl 93.1% <80.0%> (-4.7%) ⬇️
src/noise/Gaussian_interface.jl 85.7% <85.7%> (ø)
src/noise/ARMA_Structure.jl 88.0% <88.0%> (ø)
src/noise/CARMA_Structure.jl 93.5% <93.5%> (ø)
src/IonSim.jl 100.0% <100.0%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

src/IonSim.jl Outdated
@@ -28,6 +28,17 @@ include("hamiltonians.jl")
include("time_evolution.jl")
include("species/include_species.jl")

module GaussianNoiseProcess
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend calling the module "noise" so you can use it like "IonSim.noise"


@inline wiener_randn(rng::AbstractRNG,::Type{T}) where T = randn(rng,T)

# == Generators of Discrete AR/MA time series == #
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These could be docstrings, correct?


# AR(p) Processes Step
n = length(W.u)
test = X.p >= n
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is test supposed to mean here?

return new_val - W.u[end]
end

@inline function (X::MA_Process)(dW,W,dt,u,p,t,rng)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this function do that the previous one doesn't do?

@inline function sinc_bridge(X,dW,W,W0,Wh,q,h,u,p,t,rng)

# Brownian bridge correction term (added during interpolation)
# iscontinuous(W) = true <- should fix to false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this mean?

using PyCall
so = pyimport("scipy.optimize")

@inline wiener_randn(rng::AbstractRNG,::Type{T}) where T = randn(rng,T)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have to define this function every time?


@inline wiener_randn(rng::AbstractRNG,::Type{T}) where T = randn(rng,T)

# == ARMAProcess: Generates ARMA Coefficients and Sinc-interpolated NoiseProcess == #
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there wikipedia or research paper links for how these noise processes are generated? Could we link to them in the code?

# end

function ReImCoeffSolver(x, α, κ, σ)
t = x[1:length(x)÷2]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this doing?

acf::Vector
end

struct CARMAProcess
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is CARMA only in one file but ARMA in three files?


# acf_iir = discrete.arma.sigma^2 .* [dot(discrete.arma.psi[1:end-i], discrete.arma.psi[1+i:end]) for i in 0:(length(discrete.arma.psi)-1)]
# ys = discrete.arma.ma_acf[ts .+ 1]
carma_α, _ = so.curve_fit((x,d...)->ReImCoeffSolver(x,collect(d),carma_κ, discrete.arma.sigma), [ts;ts], [ys;zeros(length(ys))],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this doing?

@marwahaha
Copy link
Member

Goal after today: Make non-adaptive time-stepping the default

@marwahaha
Copy link
Member

Two things from Joe:

@jbroz11 jbroz11 closed this Mar 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants