예제 #1
0
파일: test_fss.py 프로젝트: ryanlevy/pyfssa
    def test_linear_quality_x_bounds(self):
        x = np.array([
            [0.0, 1.0, 2.0],
            [0.5, 1.5, 2.5],
            [-0.25, 0.25, 0.75],
        ])
        y = x.copy()
        dy = 0.05 * np.ones_like(y)

        ret = fssa.quality(x, y, dy, x_bounds=(0.3, 2.3))
        self.assertEqual(ret, 0.0)
예제 #2
0
파일: test_fss.py 프로젝트: andsor/pyfssa
    def test_linear_quality_x_bounds(self):
        x = np.array([
            [0.0, 1.0, 2.0],
            [0.5, 1.5, 2.5],
            [-0.25, 0.25, 0.75],
        ])
        y = x.copy()
        dy = 0.05 * np.ones_like(y)

        ret = fssa.quality(x, y, dy, x_bounds=(0.3, 2.3))
        self.assertEqual(ret, 0.0)
예제 #3
0
파일: test_fss.py 프로젝트: andsor/pyfssa
    def test_linear_quality_fail(self):
        x = np.array([
            [0.0, 1.0, 2.0],
            [0.5, 1.5, 2.5],
            [-0.25, 0.25, 0.75],
        ])
        y = x.copy()
        y[1, 1] = 1.0
        dy = 0.05 * np.ones_like(y)

        ret = fssa.quality(x, y, dy)
        self.assertGreater(ret, 0.0)
예제 #4
0
파일: test_fss.py 프로젝트: ryanlevy/pyfssa
    def test_linear_quality_fail(self):
        x = np.array([
            [0.0, 1.0, 2.0],
            [0.5, 1.5, 2.5],
            [-0.25, 0.25, 0.75],
        ])
        y = x.copy()
        y[1, 1] = 1.0
        dy = 0.05 * np.ones_like(y)

        ret = fssa.quality(x, y, dy)
        self.assertGreater(ret, 0.0)
예제 #5
0
파일: test_fss.py 프로젝트: andsor/pyfssa
    def test_zero_quality(self):
        """
        Test that function returns close to zero value if fed with the same x
        and y values
        """
        def master_curve(x):
            return 1. / (1. + np.exp(5 * (1. - x)))

        x = np.linspace(0, 2)
        x_array = np.row_stack([x for i in range(10)])
        y_array = master_curve(x_array)
        dy = 0.05
        dy_array = dy * np.ones_like(y_array)
        ret = fssa.quality(x_array, y_array, dy_array)
        self.assertGreaterEqual(ret, 0.)
        self.assertLess(ret, 0.1)
예제 #6
0
파일: test_fss.py 프로젝트: ryanlevy/pyfssa
    def test_zero_quality(self):
        """
        Test that function returns close to zero value if fed with the same x
        and y values
        """
        def master_curve(x):
            return 1. / (1. + np.exp(5 * (1. - x)))

        x = np.linspace(0, 2)
        x_array = np.row_stack([x for i in range(10)])
        y_array = master_curve(x_array)
        dy = 0.05
        dy_array = dy * np.ones_like(y_array)
        ret = fssa.quality(x_array, y_array, dy_array)
        self.assertGreaterEqual(ret, 0.)
        self.assertLess(ret, 0.1)
예제 #7
0
파일: test_fss.py 프로젝트: andsor/pyfssa
    def test_standard_quality(self):
        """
        Test that function returns close to one value if fed with the same x
        and y values with some standard error applied
        """
        def master_curve(x):
            return 1. / (1. + np.exp(5 * (1. - x)))

        x = np.linspace(0, 2)
        x_array = np.row_stack([x for i in range(10)])
        y_array = master_curve(x_array)
        dy = 0.05
        dy_array = dy * np.ones_like(y_array)
        y_array += dy * np.random.randn(*y_array.shape)
        ret = fssa.quality(x_array, y_array, dy_array)
        self.assertGreater(ret, np.power(10, -0.5))
        self.assertLess(ret, np.power(10, 0.5))
예제 #8
0
파일: test_fss.py 프로젝트: ryanlevy/pyfssa
    def test_standard_quality(self):
        """
        Test that function returns close to one value if fed with the same x
        and y values with some standard error applied
        """
        def master_curve(x):
            return 1. / (1. + np.exp(5 * (1. - x)))

        x = np.linspace(0, 2)
        x_array = np.row_stack([x for i in range(10)])
        y_array = master_curve(x_array)
        dy = 0.05
        dy_array = dy * np.ones_like(y_array)
        y_array += dy * np.random.randn(*y_array.shape)
        ret = fssa.quality(x_array, y_array, dy_array)
        self.assertGreater(ret, np.power(10, -0.5))
        self.assertLess(ret, np.power(10, 0.5))
d_L_C = np.zeros((len(L), len(C_5)))
for i in range(len(C_5)):
    d_L_C[0][i] = C_10_s[i]
    d_L_C[1][i] = C_15_s[i]
    d_L_C[2][i] = C_20_s[i]
    d_L_C[3][i] = C_25_s[i]

C_reg = 9999
f_reg = 9999

C_reg_array = np.linspace(0, 3, 10000)
for C_0 in C_reg_array:
    scaled_data = fssa.scaledata(L, T, L_C + C_0, d_L_C, 1 / 0.2216, 0.62997,
                                 0.11008)
    f = fssa.quality(scaled_data.x, scaled_data.y, scaled_data.dy)

    if f < f_reg:
        C_reg = C_0
        f_reg = f
        print(C_reg, f_reg)

ret = fssa.autoscale(L, T, L_C + C_reg, d_L_C, 1 / 0.2216, 0.62997, 0.11008)
print("C_reg:", C_reg)
print("rho:", ret.rho, ret.drho)
print("nu:", ret.nu, ret.dnu)
print("zeta:", ret.zeta, ret.dzeta)
print("f:", ret.fun)

data = fssa.scaledata(L, T, L_C + C_reg, d_L_C, ret.rho, ret.nu, ret.zeta)
#data = fssa.scaledata(L, T, L_C + C_reg, d_L_C, 4.51, 0.63, 0.11)