# Path: pyLIMA/microlcaustics.py
# def find_2_lenses_caustics_and_critical_curves(separation, mass_ratio, resolution=1000):
# def sort_2lenses_resonant_caustic(caustic_points, critical_curves_points):
# def sort_2lenses_close_caustics(caustic_points, critical_curves_points):
# def sort_2lenses_wide_caustics(caustic_points, critical_curves_points):
# def compute_2_lenses_caustics_points(separation, mass_ratio, resolution=1000):
# def find_area_of_interest_around_caustics(caustics, secure_factor=0.1):
# def find_2_lenses_caustic_regime(separation, mass_ratio):
# def change_source_trajectory_center_to_central_caustics_center(separation, mass_ratio):
# def change_source_trajectory_center_to_planetary_caustics_center(separation, mass_ratio):
# def dx(function, x, args):
# def newtons_method(function, jaco, x0, args=None, e=10 ** -10):
# def foo(x, pp1, pp2, pp3, pp4, pp5):
# def foo2(X, pp1, pp2, pp3, pp4, pp5):
# def jaco(x, pp1, pp2, pp3, pp4, pp5):
# def hessian(x, pp1, pp2, pp3, pp4, pp5):
# def Jacobian(zi, mtot, deltam, z1):
# def find_slices(slice_1, slice_2, points):


import numpy as np
import unittest.mock
import pytest
from pyLIMA import microlcaustics
    caustics, critical_curves = microlcaustics.compute_2_lenses_caustics_points(separation, mass_ratio,
                                                                                resolution=1000)

    central_caustic, wide_caustic, central_cc, wide_cc = microlcaustics.sort_2lenses_wide_caustics(caustics,
                                                                                                   critical_curves)

    assert len(central_caustic) == 2000
    assert len(central_cc) == 2000
    assert len(wide_caustic) == 2000
    assert len(wide_cc) == 2000


def test_sort_2lenses_close_caustics():
    separation = 0.8
    mass_ratio = 10 ** -7

    caustics, critical_curves = microlcaustics.compute_2_lenses_caustics_points(separation, mass_ratio,
                                                                                resolution=1000)

    central_caustic, close_top_caustic, close_bottom_caustic, central_cc, close_top_cc, close_bottom_cc = \
        microlcaustics.sort_2lenses_close_caustics(caustics, critical_curves)

    assert len(central_caustic) == 2000
    assert len(central_cc) == 2000
    assert len(close_top_caustic) == 1000
    assert len(close_top_cc) == 1000
    assert len(close_bottom_caustic) == 1000
    assert len(close_bottom_cc) == 1000



# Path: pyLIMA/microlcaustics.py
# def find_2_lenses_caustics_and_critical_curves(separation, mass_ratio, resolution=1000):
# def sort_2lenses_resonant_caustic(caustic_points, critical_curves_points):
# def sort_2lenses_close_caustics(caustic_points, critical_curves_points):
# def sort_2lenses_wide_caustics(caustic_points, critical_curves_points):
# def compute_2_lenses_caustics_points(separation, mass_ratio, resolution=1000):
# def find_area_of_interest_around_caustics(caustics, secure_factor=0.1):
# def find_2_lenses_caustic_regime(separation, mass_ratio):
# def change_source_trajectory_center_to_central_caustics_center(separation, mass_ratio):
# def change_source_trajectory_center_to_planetary_caustics_center(separation, mass_ratio):
# def dx(function, x, args):
# def newtons_method(function, jaco, x0, args=None, e=10 ** -10):
# def foo(x, pp1, pp2, pp3, pp4, pp5):
# def foo2(X, pp1, pp2, pp3, pp4, pp5):
# def jaco(x, pp1, pp2, pp3, pp4, pp5):
# def hessian(x, pp1, pp2, pp3, pp4, pp5):
# def Jacobian(zi, mtot, deltam, z1):
# def find_slices(slice_1, slice_2, points):


# Path: pyLIMA/test/test_microlcaustics.py
import numpy as np
import unittest.mock
import pytest
from pyLIMA import microlcaustics

    caustics, critical_curves = microlcaustics.compute_2_lenses_caustics_points(separation, mass_ratio,
                                                                                resolution=1000)

    central_caustic, wide_caustic, central_cc, wide_cc = microlcaustics.sort_2lenses_wide_caustics(caustics,
                                                                                                   critical_curves)

    assert len(central_caustic) == 2000
    assert len(central_cc) == 2000
    assert len(wide_caustic) == 2000
    assert len(wide_cc) == 2000


def test_sort_2lenses_close_caustics():
    separation = 0.8
    mass_ratio = 10 ** -7

    caustics, critical_curves = microlcaustics.compute_2_lenses_caustics_points(separation, mass_ratio,
                                                                                resolution=1000)

    central_caustic, close_top_caustic, close_bottom_caustic, central_cc, close_top_cc, close_bottom_cc = \
        microlcaustics.sort_2lenses_close_caustics(caustics, critical_curves)

    assert len(central_caustic) == 2000
    assert len(central_cc) == 2000
    assert len(close_top_caustic) == 1000
    assert len(close_top_cc) == 1000
    assert len(close_bottom_caustic) == 1000
    assert len(close_bottom_cc) == 1000



def test_compute_2_lenses_caustics_points():