Skip to content

Commit

Permalink
Add compute_jacobian
Browse files Browse the repository at this point in the history
  • Loading branch information
aragilar committed Jul 20, 2023
1 parent 17bf7f4 commit ffb2693
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/disc_solver/analyse/compute_jacobian.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from ..float_handling import float_type
from ..solve.solution import ode_system
from ..utils import get_solutions
from .utils import (
single_solution_plotter, common_plotting_options, analyse_main_wrapper,
get_common_plot_args, analysis_func_wrapper, plot_output_wrapper,
Expand Down Expand Up @@ -336,3 +337,12 @@ def plot_jacobian_eigenvectors(
)
ax.legend()
return fig


@analysis_func_wrapper
def compute_jacobian_from_file(
soln_file, *, soln_range=None, eps, θ_scale=float_type(1), **kwargs
):

soln = get_solutions(soln_file, soln_range)
return compute_jacobian_from_solution(soln, eps=eps, θ_scale=θ_scale)
4 changes: 4 additions & 0 deletions tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from disc_solver.analyse.component_plot import plot as component_plot
from disc_solver.analyse.compute_jacobian import (
jacobian_eigenvalues_plot, jacobian_eigenvectors_plot,
compute_jacobian_from_file,
)
from disc_solver.analyse.conserve_plot import conserve_main
from disc_solver.analyse.derivs_plot import derivs_plot
Expand Down Expand Up @@ -536,6 +537,9 @@ def test_jacobian_eigenvectors_file(self, solution_not_approx, plot_file):
solution_not_approx, plot_filename=plot_file, eps=1e-10
)

def test_compute_jacobian_from_solution(self, solution):
compute_jacobian_from_file(solution, eps=1e-10)


def test_taylor_space(mpl_interactive):
taylor_space_main()
Expand Down

0 comments on commit ffb2693

Please sign in to comment.