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 compute_jacobian #170

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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