当前位置: 首页>>代码示例>>Python>>正文


Python pyeq2.dataConvertorService函数代码示例

本文整理汇总了Python中pyeq2.dataConvertorService函数的典型用法代码示例。如果您正苦于以下问题:Python dataConvertorService函数的具体用法?Python dataConvertorService怎么用?Python dataConvertorService使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dataConvertorService函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_SolveUsingSimplex_SSQREL_2D

 def test_SolveUsingSimplex_SSQREL_2D(self):
     coefficientsShouldBe = numpy.array([-6.74510573, 1.32459622])
     model = pyeq2.Models_2D.Polynomial.Linear("SSQREL")
     model.estimatedCoefficients = numpy.array([1.0, 1.0])  # starting values for the simplex solver
     pyeq2.dataConvertorService().ConvertAndSortColumnarASCII(DataForUnitTests.asciiDataInColumns_2D, model, False)
     coefficients = pyeq2.solverService().SolveUsingSimplex(model)
     self.assertTrue(numpy.allclose(coefficients, coefficientsShouldBe, rtol=1.0e-06, atol=1.0e-300))
开发者ID:JMoravec,项目名称:unkRadnet,代码行数:7,代码来源:Test_SolverService.py

示例2: test_GenerationOf_CPP

    def test_GenerationOf_CPP(self):
        generatedShouldBe = """// To the best of my knowledge this code is correct.
// If you find any errors or problems please contact
// me directly using [email protected]
//
//      James


#include <math.h>

// Fitting target: lowest sum of squared absolute error
// Fitting target value = 0.223837322455

double Linear_model(double x_in)
{
	double temp;
	temp = 0.0;

	// coefficients
	double a = -8.01913564075E+00;
	double b = 1.52644729419E+00;

	temp += a + b * x_in;
	return temp;
}
"""
        equation = pyeq2.Models_2D.Polynomial.Linear("SSQABS")
        pyeq2.dataConvertorService().ConvertAndSortColumnarASCII(
            DataForUnitTests.asciiDataInColumns_2D, equation, False
        )
        equation.Solve()
        generated = pyeq2.outputSourceCodeService().GetOutputSourceCodeCPP(equation, inDigitsOfPrecisionString="11")
        self.assertEqual(generated, generatedShouldBe)
开发者ID:JMoravec,项目名称:unkRadnet,代码行数:33,代码来源:Test_OutputSourceCodeService.py

示例3: test_SolveUsingLevenbergMarquardt_2D

 def test_SolveUsingLevenbergMarquardt_2D(self):
     coefficientsShouldBe = numpy.array([-8.01913565, 1.5264473])
     model = pyeq2.Models_2D.Polynomial.Linear("SSQABS")
     model.estimatedCoefficients = numpy.array([-4.0, 2.0])  # starting values for the simplex solver
     pyeq2.dataConvertorService().ConvertAndSortColumnarASCII(DataForUnitTests.asciiDataInColumns_2D, model, False)
     coefficients = pyeq2.solverService().SolveUsingLevenbergMarquardt(model)
     self.assertTrue(numpy.allclose(coefficients, coefficientsShouldBe, rtol=1.0e-06, atol=1.0e-300))
开发者ID:JMoravec,项目名称:unkRadnet,代码行数:7,代码来源:Test_SolverService.py

示例4: test_GenerationOf_VBA

    def test_GenerationOf_VBA(self):
        generatedShouldBe = """' To the best of my knowledge this code is correct.
' If you find any errors or problems please contact
' me directly using [email protected]
'
'      James

' Fitting target: lowest sum of squared absolute error
' Fitting target value = 0.223837322455

Public Function Linear_model(x_in)
\ttemp = 0.0

\t' coefficients
\tConst a = -8.01913564075E+00
\tConst b = 1.52644729419E+00

\ttemp = temp + a + b * x_in
\tLinear_model = temp
End Function
"""
        equation = pyeq2.Models_2D.Polynomial.Linear("SSQABS")
        pyeq2.dataConvertorService().ConvertAndSortColumnarASCII(
            DataForUnitTests.asciiDataInColumns_2D, equation, False
        )
        equation.Solve()
        generated = pyeq2.outputSourceCodeService().GetOutputSourceCodeVBA(equation, inDigitsOfPrecisionString="11")
        self.assertEqual(generated, generatedShouldBe)
开发者ID:JMoravec,项目名称:unkRadnet,代码行数:28,代码来源:Test_OutputSourceCodeService.py

示例5: test_SolveUsingODR_3D

 def test_SolveUsingODR_3D(self):
     coefficientsShouldBe = numpy.array([-0.04925, -0.90509, 1.28076])
     model = pyeq2.Models_3D.Polynomial.Linear("ODR")
     model.estimatedCoefficients = numpy.array([0.2, -1.0, 1.0])  # starting values for the ODR solver
     pyeq2.dataConvertorService().ConvertAndSortColumnarASCII(DataForUnitTests.asciiDataInColumns_3D, model, False)
     coefficients = pyeq2.solverService().SolveUsingODR(model)
     self.assertTrue(numpy.allclose(coefficients, coefficientsShouldBe, rtol=1.0e-03, atol=1.0e-300))
开发者ID:JMoravec,项目名称:unkRadnet,代码行数:7,代码来源:Test_SolverService.py

示例6: test_GenerationOf_CSHARP

    def test_GenerationOf_CSHARP(self):
        generatedShouldBe = '''// To the best of my knowledge this code is correct.
// If you find any errors or problems please contact
// me directly using [email protected]
//
//      James


using System;

// Fitting target: lowest sum of squared absolute error
// Fitting target value = 0.223837322455

class Polynomial_Linear
{
\tdouble Polynomial_Linear_model(double x_in)
\t{
\t\tdouble temp;
\t\ttemp = 0.0;

\t\t// coefficients
\t\tdouble a = -8.01913564075E+00;
\t\tdouble b = 1.52644729419E+00;

\t\ttemp += a + b * x_in;
\t\treturn temp;
\t}
}
'''
        equation = pyeq2.Models_2D.Polynomial.Linear('SSQABS')
        pyeq2.dataConvertorService().ConvertAndSortColumnarASCII(DataForUnitTests.asciiDataInColumns_2D, equation, False)
        equation.Solve()
        generated = pyeq2.outputSourceCodeService().GetOutputSourceCodeCSHARP(equation, inDigitsOfPrecisionString = '11')
        self.assertEqual(generated, generatedShouldBe)
开发者ID:HerobrinesArmy,项目名称:pyeq2,代码行数:34,代码来源:Test_OutputSourceCodeService.py

示例7: test_GenerationOf_MATLAB

    def test_GenerationOf_MATLAB(self):
        generatedShouldBe = '''% To the best of my knowledge this code is correct.
% If you find any errors or problems please contact
% me directly using [email protected]
%
%      James


% Fitting target: lowest sum of squared absolute error
% Fitting target value = 0.223837322455

function y = Polynomial_Linear_model(x_in)
\ttemp = 0.0;

\t% coefficients
\ta = -8.01913564075E+00;
\tb = 1.52644729419E+00;

\ttemp = temp + a + b .* x_in;

\ty = temp;
'''
        equation = pyeq2.Models_2D.Polynomial.Linear('SSQABS')
        pyeq2.dataConvertorService().ConvertAndSortColumnarASCII(DataForUnitTests.asciiDataInColumns_2D, equation, False)
        equation.Solve()
        generated = pyeq2.outputSourceCodeService().GetOutputSourceCodeMATLAB(equation, inDigitsOfPrecisionString = '11')
        self.assertEqual(generated, generatedShouldBe)
开发者ID:HerobrinesArmy,项目名称:pyeq2,代码行数:27,代码来源:Test_OutputSourceCodeService.py

示例8: test_SolveUsingDE_3D

 def test_SolveUsingDE_3D(self):
     coefficientsShouldBe = numpy.array([-2.05105972, -0.49194959,  1.77817475])
     model = pyeq2.Models_3D.UserDefinedFunction.UserDefinedFunction('SSQABS', 'Default', 'a + b*X + c*Y')
     pyeq2.dataConvertorService().ConvertAndSortColumnarASCII(DataForUnitTests.asciiDataInColumns_3D_small, model, False)
     coefficients = pyeq2.solverService().SolveUsingDE(model)
     fittingTarget = model.CalculateAllDataFittingTarget(coefficients)
     self.assertTrue(fittingTarget <= 0.1)
开发者ID:JMoravec,项目名称:RadNetWeb,代码行数:7,代码来源:Test_SolverService.py

示例9: test_GenerationOf_PYTHON

    def test_GenerationOf_PYTHON(self):
        generatedShouldBe = '''# To the best of my knowledge this code is correct.
# If you find any errors or problems please contact
# me directly using [email protected]
#
#      James


import math

# Fitting target: lowest sum of squared absolute error
# Fitting target value = 0.223837322455

def Polynomial_Linear_model(x_in):
    temp = 0.0

    # coefficients
    a = -8.01913564075E+00
    b = 1.52644729419E+00

    temp += a + b * x_in
    return temp
'''
        equation = pyeq2.Models_2D.Polynomial.Linear('SSQABS')
        pyeq2.dataConvertorService().ConvertAndSortColumnarASCII(DataForUnitTests.asciiDataInColumns_2D, equation, False)
        equation.Solve()
        generated = pyeq2.outputSourceCodeService().GetOutputSourceCodePYTHON(equation, inDigitsOfPrecisionString = '11')
        self.assertEqual(generated, generatedShouldBe)
开发者ID:HerobrinesArmy,项目名称:pyeq2,代码行数:28,代码来源:Test_OutputSourceCodeService.py

示例10: test_SolveUsingSpline_3D

    def test_SolveUsingSpline_3D(self):
        xKnotPointsShouldBe = numpy.array([0.607, 0.607, 0.607, 3.017, 3.017, 3.017])
        yKnotPointsShouldBe = numpy.array([1.984, 1.984, 1.984, 3.153, 3.153, 3.153])
        coefficientsShouldBe = numpy.array(
            [2.33418963, 1.80079612, 5.07902936, 0.54445029, 1.04110843, 2.14180324, 0.26992805, 0.39148852, 0.8177307]
        )
        testEvaluationShouldBe = numpy.array([0.76020577997])
        model = pyeq2.Models_3D.Spline.Spline(inSmoothingFactor=1.0, inXOrder=2, inYOrder=2)
        pyeq2.dataConvertorService().ConvertAndSortColumnarASCII(DataForUnitTests.asciiDataInColumns_3D, model, False)
        fittedParameters = pyeq2.solverService().SolveUsingSpline(model)

        # example of later using the saved spline knot points and coefficients
        unFittedSpline = scipy.interpolate.fitpack2.SmoothBivariateSpline(
            model.dataCache.allDataCacheDictionary["X"],
            model.dataCache.allDataCacheDictionary["Y"],
            model.dataCache.allDataCacheDictionary["DependentData"],
            s=model.smoothingFactor,
            kx=model.xOrder,
            ky=model.yOrder,
        )
        unFittedSpline.tck = fittedParameters
        testEvaluation = unFittedSpline.ev(2.5, 2.5)

        self.assertTrue(numpy.allclose(testEvaluation, testEvaluationShouldBe, rtol=1.0e-10, atol=1.0e-300))
        self.assertTrue(numpy.equal(fittedParameters[0], xKnotPointsShouldBe).all())
        self.assertTrue(numpy.equal(fittedParameters[1], yKnotPointsShouldBe).all())
        self.assertTrue(numpy.allclose(fittedParameters[2], coefficientsShouldBe, rtol=1.0e-06, atol=1.0e-300))
开发者ID:JMoravec,项目名称:unkRadnet,代码行数:27,代码来源:Test_SolverService.py

示例11: fp_fit

def fp_fit(x, y):
	"""Given a list of x and y values, function fits a four parameter logistic 
	distribution to the data. The distribution being fit has bounds set on several of
	the parameters to keep the distribution in the proper orientation. These are:
	
	a	-0.25	0.25
	b	-inf	-0.1
	c	0		inf
	d	0.75	1.25
	
	The function returns a tuple of the parameters and the covariance of the fit:
	
	((a, b, c, d), cov)
	
	"""
	equation = pyeq2.Models_2D.Sigmoidal.FourParameterLogistic()

	data = "\n".join("{} {}".format(x1, y1) for x1, y1 in zip(x, y))
	
	equation.upperCoefficientBounds = [0.25, -0.1, None, 1.25]
	equation.lowerCoefficientBounds = [-0.25, None, 0, 0.75]
	
	pyeq2.dataConvertorService().ConvertAndSortColumnarASCII(data, equation, False)
	equation.Solve()
	
	return equation.solvedCoefficients, equation.CalculateAllDataFittingTarget(equation.solvedCoefficients)
开发者ID:kenjsc,项目名称:CAMpping,代码行数:26,代码来源:biomap.py

示例12: SetParametersAndFit

def SetParametersAndFit(equationString, inFittingTargetString, inExtendedVersionString, inTextData):
    
    # individual cluster nodes must be able to import pyeq2
    import pyeq2

    exec('equation = ' + equationString +'("' + inFittingTargetString + '", "' + inExtendedVersionString + '")')
    pyeq2.dataConvertorService().ConvertAndSortColumnarASCII(inTextData, equation, False)
 
    try:
        # check for number of coefficients > number of data points to be fitted
        if len(equation.GetCoefficientDesignators()) > len(equation.dataCache.allDataCacheDictionary['DependentData']):
            return None

        # check for functions requiring non-zero nor non-negative data such as 1/x, etc.
        if equation.ShouldDataBeRejected(equation):
            return None

        equation.Solve()

        fittedTarget = equation.CalculateAllDataFittingTarget(equation.solvedCoefficients)
        if fittedTarget > 1.0E290: # error too large
            return None
    except:
        return None

    return [fittedTarget, equation.GetDisplayName(), equation.solvedCoefficients, equationString, inExtendedVersionString]
开发者ID:HerobrinesArmy,项目名称:pyeq2,代码行数:26,代码来源:FitAllEquations_2D.py

示例13: test_SolveUsingSimplex_3D

 def test_SolveUsingSimplex_3D(self):
     coefficientsShouldBe = numpy.array([0.28658383, -0.90215775, 1.15483864])
     model = pyeq2.Models_3D.Polynomial.Linear("SSQABS")
     model.estimatedCoefficients = numpy.array([1.0, 1.0, 1.0])  # starting values for the simplex solver
     pyeq2.dataConvertorService().ConvertAndSortColumnarASCII(DataForUnitTests.asciiDataInColumns_3D, model, False)
     coefficients = pyeq2.solverService().SolveUsingSimplex(model)
     self.assertTrue(numpy.allclose(coefficients, coefficientsShouldBe, rtol=1.0e-06, atol=1.0e-300))
开发者ID:JMoravec,项目名称:unkRadnet,代码行数:7,代码来源:Test_SolverService.py

示例14: test_SolveUsingDE_3D

 def test_SolveUsingDE_3D(self):
     coefficientsShouldBe = numpy.array([-0.206068766376, -0.644872592849, 1.13361007134])
     model = pyeq2.Models_3D.UserDefinedFunction.UserDefinedFunction("SSQABS", "Default", "a + b*X + c*Y")
     pyeq2.dataConvertorService().ConvertAndSortColumnarASCII(
         DataForUnitTests.asciiDataInColumns_3D_small, model, False
     )
     coefficients = pyeq2.solverService().SolveUsingDE(model)
     self.assertTrue(numpy.allclose(coefficients, coefficientsShouldBe, rtol=1.0e-06, atol=1.0e-300))
开发者ID:JMoravec,项目名称:unkRadnet,代码行数:8,代码来源:Test_SolverService.py

示例15: test_SolveUsingDE_2D

 def test_SolveUsingDE_2D(self):
     coefficientsShouldBe = numpy.array([-6.15515504031, 1.21618173729])
     model = pyeq2.Models_2D.UserDefinedFunction.UserDefinedFunction("SSQABS", "Default", "m*X + b")
     pyeq2.dataConvertorService().ConvertAndSortColumnarASCII(
         DataForUnitTests.asciiDataInColumns_2D_small, model, False
     )
     coefficients = pyeq2.solverService().SolveUsingDE(model)
     self.assertTrue(numpy.allclose(coefficients, coefficientsShouldBe, rtol=1.0e-06, atol=1.0e-300))
开发者ID:JMoravec,项目名称:unkRadnet,代码行数:8,代码来源:Test_SolverService.py


注:本文中的pyeq2.dataConvertorService函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。