cbherbert / stochrare

This Python package aims at providing tools to study stochastic processes: integrate SDEs, solve Fokker-Planck equations, sample rare events,...
GNU General Public License v3.0
8 stars 5 forks source link

merge DiffusionProcess1D into DiffusionProcess #20

Open tlestang opened 4 years ago

tlestang commented 4 years ago

Edit 01/07/2020 This PR grew larger than just extending DiffusionProcess.update. It ports all methods from the specialised 1d class DiffusionProcess1D to the general class DiffusionProcess, using the @method1d decorator to restrict some of them to process in 1D


At the moment it is assumed that if DiffusionProcess.update is called from a process with dimension=1, then the state vector is an array of size 1. This adds a conditial in DiffusionProcess.update to make update return a float for `1d processes.

I chose not the check the dimesion with something like

if len(xn) != self.dimension:
  raise ValueError("State vector xn has dimension {}, expected {}".format(len(xn), self.dimension))

Reasons:

codecov-commenter commented 4 years ago

Codecov Report

Merging #20 into dev will decrease coverage by 0.27%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev      #20      +/-   ##
==========================================
- Coverage   77.84%   77.56%   -0.28%     
==========================================
  Files          14       14              
  Lines        1124     1110      -14     
==========================================
- Hits          875      861      -14     
  Misses        249      249              
Impacted Files Coverage Δ
stochrare/dynamics/diffusion.py 85.40% <100.00%> (-0.39%) :arrow_down:
stochrare/utils.py 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 67e97d9...244af0f. Read the comment docs.