# Path: mjhmc/search/objective.py
# def fit(t_data, y_data):
#     """ Fit a complex exponential to y_data
# 
#     :param t_data: array of values for t-axis (x-axis)
#     :param y_data: array of values for y-axis. of the same shape as t-data
#     :returns: fitted parameters: (exp_coef, cos_coef)
#     :rtype: tuple
#     """
#     # very fast way to check for nan
#     if not np.isnan(np.sum(y_data)):
#         # p_0 = estimate_params(t_data, y_data)
#         p_0 = None
#         opt_params = curve_fit(curve_fn, t_data, y_data, p0=p_0, maxfev=1000)[0]
#         return opt_params
#     else:
#         return 1E3, 0


import unittest
import numpy as np
from mjhmc.search.objective import fit
            fit(t, x_1)[0] > fit(t, x_2)[0],
            msg="Monotonicity failure"
        )
        self.assertTrue(
            fit(t, x_2)[0] > fit(t, x_3)[0],
            msg="Monotonicity failure"
        )
        self.assertTrue(
            fit(t, x_1)[0] > fit(t, x_3)[0],
            msg="Monotonicity failure"
        )

    def TestNoise(self):
        """
        Monotonicity plus varying amount of noise
        """
        perc_noise = 0.01
        t = np.arange(self.t_max) / float(self.t_max)
        x_1 = np.exp(-t) + np.random.randn(self.t_max) * perc_noise
        x_2 = np.exp(-2 * t) + np.random.randn(self.t_max) * perc_noise
        x_3 = np.exp(-3 * t) + np.random.randn(self.t_max) * perc_noise
        self.assertTrue(
            fit(t, x_1)[0] > fit(t, x_2)[0],
            msg="Monotonicity failure"
        )
        self.assertTrue(
            fit(t, x_2)[0] > fit(t, x_3)[0],
            msg="Monotonicity failure"
        )
        self.assertTrue(

# Path: mjhmc/search/objective.py
# def fit(t_data, y_data):
#     """ Fit a complex exponential to y_data
# 
#     :param t_data: array of values for t-axis (x-axis)
#     :param y_data: array of values for y-axis. of the same shape as t-data
#     :returns: fitted parameters: (exp_coef, cos_coef)
#     :rtype: tuple
#     """
#     # very fast way to check for nan
#     if not np.isnan(np.sum(y_data)):
#         # p_0 = estimate_params(t_data, y_data)
#         p_0 = None
#         opt_params = curve_fit(curve_fn, t_data, y_data, p0=p_0, maxfev=1000)[0]
#         return opt_params
#     else:
#         return 1E3, 0


# Path: mjhmc/tests/test_search_objective.py
import unittest
import numpy as np
from mjhmc.search.objective import fit

            fit(t, x_1)[0] > fit(t, x_2)[0],
            msg="Monotonicity failure"
        )
        self.assertTrue(
            fit(t, x_2)[0] > fit(t, x_3)[0],
            msg="Monotonicity failure"
        )
        self.assertTrue(
            fit(t, x_1)[0] > fit(t, x_3)[0],
            msg="Monotonicity failure"
        )

    def TestNoise(self):
        """
        Monotonicity plus varying amount of noise
        """
        perc_noise = 0.01
        t = np.arange(self.t_max) / float(self.t_max)
        x_1 = np.exp(-t) + np.random.randn(self.t_max) * perc_noise
        x_2 = np.exp(-2 * t) + np.random.randn(self.t_max) * perc_noise
        x_3 = np.exp(-3 * t) + np.random.randn(self.t_max) * perc_noise
        self.assertTrue(
            fit(t, x_1)[0] > fit(t, x_2)[0],
            msg="Monotonicity failure"
        )
        self.assertTrue(
            fit(t, x_2)[0] > fit(t, x_3)[0],
            msg="Monotonicity failure"
        )
        self.assertTrue(

            fit(t, x_1)[0] > fit(t, x_3)[0],