• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python pyeq2.outputSourceCodeService函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: 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


示例2: 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


示例3: 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


示例4: 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


示例5: 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


示例6: test_GenerationOf_CPP_ForAllEquations

 def test_GenerationOf_CPP_ForAllEquations(self): # ensure no coding errors in source code generation for any equation
     for submodule in inspect.getmembers(pyeq2.Models_2D) + inspect.getmembers(pyeq2.Models_3D):
         if inspect.ismodule(submodule[1]):
             for equationClass in inspect.getmembers(submodule[1]):
                 if inspect.isclass(equationClass[1]):
                     try: # not all equation classes have a fixed number of coefficient designators
                         equation = equationClass[1]()
                         coeffCount = len(equation.GetCoefficientDesignators())
                         equation.solvedCoefficients = [1.0] * len(equation.GetCoefficientDesignators())
                     except:
                         continue
                     generated = pyeq2.outputSourceCodeService().GetOutputSourceCodeCPP(equation)
                     self.assertIs(type(generated), type('')) # must be a striong
                     self.assertTrue(len(generated) > 0) # must have a length > 0
开发者ID:HerobrinesArmy,项目名称:pyeq2,代码行数:14,代码来源:Test_OutputSourceCodeService.py


示例7: test_ConversionFromCppToVBA

    def test_ConversionFromCppToVBA(self):
        convertedShouldBe = '''
\t' comment
\tvar doubleVariable
\ttemp = a * Abs(1.1)
\ttemp = a / Abs(1.1)
\ttemp = temp + Application.WorksheetFunction.power(temp)
\ttemp = temp - Application.WorksheetFunction.ln(temp)
\ttemp = Application.WorksheetFunction.log(temp)
\ttemp = Exp(temp)
\ttemp = sin(temp)
\ttemp = cos(temp)
\ttemp = tan(temp)
\ttemp = Application.WorksheetFunction.tanh(temp)
\ttemp = Application.WorksheetFunction.cosh(temp)
'''
        converted = pyeq2.outputSourceCodeService().ConvertCppToVBA(self.cppStringForTestingLanguageConversions)
        self.assertEqual(converted, convertedShouldBe)
开发者ID:HerobrinesArmy,项目名称:pyeq2,代码行数:18,代码来源:Test_OutputSourceCodeService.py


示例8: test_ConversionFromCppToJAVA

    def test_ConversionFromCppToJAVA(self):
        convertedShouldBe = '''
\t\t// comment
\t\tdouble doubleVariable;
\t\ttemp = a * Math.abs(1.1);
\t\ttemp = a / Math.abs(1.1);
\t\ttemp += Math.pow(temp);
\t\ttemp -= Math.log(temp);
\t\ttemp = Math.log10(temp);
\t\ttemp = Math.exp(temp);
\t\ttemp = Math.sin(temp);
\t\ttemp = Math.cos(temp);
\t\ttemp = Math.tan(temp);
\t\ttemp = Math.tanh(temp);
\t\ttemp = Math.cosh(temp);
'''
        converted = pyeq2.outputSourceCodeService().ConvertCppToJAVA(self.cppStringForTestingLanguageConversions)
        self.assertEqual(converted, convertedShouldBe)
开发者ID:HerobrinesArmy,项目名称:pyeq2,代码行数:18,代码来源:Test_OutputSourceCodeService.py


示例9: test_ConversionFromCppToMATLAB

    def test_ConversionFromCppToMATLAB(self):
        convertedShouldBe = '''
\t% comment
\tdoubleVariable;
\ttemp = a .* abs(1.1);
\ttemp = a ./ abs(1.1);
\ttemp = temp + power(temp);
\ttemp = temp - log(temp);
\ttemp = log10(temp);
\ttemp = exp(temp);
\ttemp = sin(temp);
\ttemp = cos(temp);
\ttemp = tan(temp);
\ttemp = tanh(temp);
\ttemp = cosh(temp);
'''
        converted = pyeq2.outputSourceCodeService().ConvertCppToMATLAB(self.cppStringForTestingLanguageConversions)
        self.assertEqual(converted, convertedShouldBe)
开发者ID:HerobrinesArmy,项目名称:pyeq2,代码行数:18,代码来源:Test_OutputSourceCodeService.py


示例10: test_ConversionFromCppToPYTHON

    def test_ConversionFromCppToPYTHON(self):
        convertedShouldBe = '''
    # comment
    doubleVariable
    temp = a * math.fabs(1.1)
    temp = a / math.fabs(1.1)
    temp += math.pow(temp)
    temp -= math.log(temp)
    temp = math.log10(temp)
    temp = math.exp(temp)
    temp = math.sin(temp)
    temp = math.cos(temp)
    temp = math.tan(temp)
    temp = math.tanh(temp)
    temp = math.cosh(temp)
'''
        converted = pyeq2.outputSourceCodeService().ConvertCppToPYTHON(self.cppStringForTestingLanguageConversions)
        self.assertEqual(converted, convertedShouldBe)
开发者ID:HerobrinesArmy,项目名称:pyeq2,代码行数:18,代码来源:Test_OutputSourceCodeService.py


示例11: test_ConversionFromCppToCSHARP

    def test_ConversionFromCppToCSHARP(self):
        convertedShouldBe = """
\t\t// comment
\t\tdouble doubleVariable;
\t\ttemp = a * Math.Abs(1.1);
\t\ttemp = a / Math.Abs(1.1);
\t\ttemp += Math.Pow(temp);
\t\ttemp -= Math.Log(temp);
\t\ttemp = Math.Log10(temp);
\t\ttemp = Math.Exp(temp);
\t\ttemp = Math.Sin(temp);
\t\ttemp = Math.Cos(temp);
\t\ttemp = Math.Tan(temp);
\t\ttemp = Math.Tanh(temp);
\t\ttemp = Math.Cosh(temp);
"""
        converted = pyeq2.outputSourceCodeService().ConvertCppToCSHARP(self.cppStringForTestingLanguageConversions)
        self.assertEqual(converted, convertedShouldBe)
开发者ID:JMoravec,项目名称:unkRadnet,代码行数:18,代码来源:Test_OutputSourceCodeService.py


示例12: SaveSourceCode

def SaveSourceCode(in_sourceCodeFilePath,  in_equation):
    
    outputFile = open(in_sourceCodeFilePath, 'w')
        
    outputFile.write('<html><body>\n\n')
    
    try:
        outputFile.write('<b>C++</b><br><textarea rows="20" cols="85" wrap="OFF">')
        outputFile.write(pyeq2.outputSourceCodeService().GetOutputSourceCodeCPP(in_equation))
        outputFile.write('</textarea><br><br>\n\n')
    except:
        pass

    try:
        outputFile.write('<b>CSHARP</b><br><textarea rows="20" cols="85" wrap="OFF">')
        outputFile.write(pyeq2.outputSourceCodeService().GetOutputSourceCodeCSHARP(in_equation))
        outputFile.write('</textarea><br><br>\n\n')
    except:
        pass

    try:
        outputFile.write('<b>VBA</b><br><textarea rows="20" cols="85" wrap="OFF">')
        outputFile.write(pyeq2.outputSourceCodeService().GetOutputSourceCodeVBA(in_equation))
        outputFile.write('</textarea><br><br>\n\n')
    except:
        pass

    try:
        outputFile.write('<b>PYTHON</b><br><textarea rows="20" cols="85" wrap="OFF">')
        outputFile.write(pyeq2.outputSourceCodeService().GetOutputSourceCodePYTHON(in_equation))
        outputFile.write('</textarea><br><br>\n\n')
    except:
        pass

    try:
        outputFile.write('<b>JAVA</b><br><textarea rows="20" cols="85" wrap="OFF">')
        outputFile.write(pyeq2.outputSourceCodeService().GetOutputSourceCodeJAVA(in_equation))
        outputFile.write('</textarea><br><br>\n\n')
    except:
        pass

    try:
        outputFile.write('<b>JAVASCRIPT</b><br><textarea rows="20" cols="85" wrap="OFF">')
        outputFile.write(pyeq2.outputSourceCodeService().GetOutputSourceCodeJAVASCRIPT(in_equation))
        outputFile.write('</textarea><br><br>\n\n')
    except:
        pass

    try:
        outputFile.write('<b>JULIA</b><br><textarea rows="20" cols="85" wrap="OFF">')
        outputFile.write(pyeq2.outputSourceCodeService().GetOutputSourceCodeJULIA(in_equation))
        outputFile.write('</textarea><br><br>\n\n')
    except:
        pass

    try:
        outputFile.write('<b>FORTRAN90</b><br><textarea rows="20" cols="85" wrap="OFF">')
        outputFile.write(pyeq2.outputSourceCodeService().GetOutputSourceCodeFORTRAN90(in_equation))
        outputFile.write('</textarea><br><br>\n\n')
    except:
        pass

    try:
        outputFile.write('<b>SCILAB</b><br><textarea rows="20" cols="85" wrap="OFF">')
        outputFile.write(pyeq2.outputSourceCodeService().GetOutputSourceCodeSCILAB(in_equation))
        outputFile.write('</textarea><br><br>\n\n')
    except:
        pass

    try:
        outputFile.write('<b>MATLAB</b><br><textarea rows="20" cols="85" wrap="OFF">')
        outputFile.write(pyeq2.outputSourceCodeService().GetOutputSourceCodeMATLAB(in_equation))
        outputFile.write('</textarea><br><br>\n\n')
    except:
        pass

    outputFile.write('</body></html>\n')
    
    outputFile.close()
开发者ID:agulbronson,项目名称:pyeq2,代码行数:79,代码来源:TextUtils.py


示例13: print

equation.solvedCoefficients = solvedCoefficients
equation.dataCache.FindOrCreateAllDataCache(equation)
equation.CalculateModelErrors(equation.solvedCoefficients, equation.dataCache.allDataCacheDictionary)


print()
print('\"Best fit\" was', moduleName + "." + className)

print('Fitting target value', equation.fittingTarget + ":", equation.CalculateAllDataFittingTarget(equation.solvedCoefficients))

print()
print('Polyfunctional flags:', polyfunctional3DFlags)
print()
for i in range(len(equation.solvedCoefficients)):
    print("Coefficient " + equation.GetCoefficientDesignators()[i] + ": " + str(equation.solvedCoefficients[i]))
print()

##########################################################

print('Generated source code section commented out')
#print(pyeq2.outputSourceCodeService().GetOutputSourceCodeCPP(equation))
#print(pyeq2.outputSourceCodeService().GetOutputSourceCodeCSHARP(equation))
#print(pyeq2.outputSourceCodeService().GetOutputSourceCodeVBA(equation))
print(pyeq2.outputSourceCodeService().GetOutputSourceCodePYTHON(equation))
#print(pyeq2.outputSourceCodeService().GetOutputSourceCodeJAVA(equation))
#print(pyeq2.outputSourceCodeService().GetOutputSourceCodeJAVASCRIPT(equation))
#print(pyeq2.outputSourceCodeService().GetOutputSourceCodeSCILAB(equation))
#print(pyeq2.outputSourceCodeService().GetOutputSourceCodeMATLAB(equation))
#print(pyeq2.outputSourceCodeService().GetOutputSourceCodeJULIA(equation))
#print(pyeq2.outputSourceCodeService().GetOutputSourceCodeFORTRAN90(equation))
开发者ID:HerobrinesArmy,项目名称:pyeq2,代码行数:30,代码来源:Polyfunctional_3D.py


示例14: Exception

if -1 != sys.path[0].find('pyeq2-master'):raise Exception('Please rename git checkout directory from "pyeq2-master" to "pyeq2"')
importDir =  os.path.join(os.path.join(sys.path[0][:sys.path[0].rfind(os.sep)], '..'), '..')
if importDir not in sys.path:
    sys.path.append(importDir)
    
import pyeq2



# see IModel.fittingTargetDictionary
equation = pyeq2.Models_2D.Polynomial.Quadratic() # SSQABS by default

data = equation.exampleData
pyeq2.dataConvertorService().ConvertAndSortColumnarASCII(data, equation, False)
equation.Solve()


##########################################################


print(pyeq2.outputSourceCodeService().GetOutputSourceCodeCPP(equation))
print(pyeq2.outputSourceCodeService().GetOutputSourceCodeCSHARP(equation))
print(pyeq2.outputSourceCodeService().GetOutputSourceCodeVBA(equation))
print(pyeq2.outputSourceCodeService().GetOutputSourceCodePYTHON(equation))
print(pyeq2.outputSourceCodeService().GetOutputSourceCodeJAVA(equation))
print(pyeq2.outputSourceCodeService().GetOutputSourceCodeJAVASCRIPT(equation))
print(pyeq2.outputSourceCodeService().GetOutputSourceCodeSCILAB(equation))
print(pyeq2.outputSourceCodeService().GetOutputSourceCodeMATLAB(equation))
print(pyeq2.outputSourceCodeService().GetOutputSourceCodeJULIA(equation))
print(pyeq2.outputSourceCodeService().GetOutputSourceCodeFORTRAN90(equation))
开发者ID:HerobrinesArmy,项目名称:pyeq2,代码行数:30,代码来源:OutputAllSourceCode.py


示例15: str

import pyeq2


pythonFileName = sys.argv[0] # unused
equationInfoFromNodeJS = json.loads(sys.argv[1])
textDataFromNodeJS = json.loads(sys.argv[2])
fittingTargetFromNodeJS = json.loads(sys.argv[3])

moduleName = equationInfoFromNodeJS['pythonModuleName']
className = equationInfoFromNodeJS['pythonClassName']
extendedVersionString = equationInfoFromNodeJS['extendedVersionString']
dimensionality = equationInfoFromNodeJS['dimensionality']

eqStringToEvaluate = 'equation = pyeq2.Models_'
eqStringToEvaluate += str(dimensionality) + 'D.'
eqStringToEvaluate += moduleName + '.'
eqStringToEvaluate += className + '('
eqStringToEvaluate += '"' + fittingTargetFromNodeJS + '",'
eqStringToEvaluate += '"' + extendedVersionString + '")'

exec(eqStringToEvaluate)

pyeq2.dataConvertorService().ConvertAndSortColumnarASCII(textDataFromNodeJS, equation, False)

equation.Solve()

# output could include data statistics, error statistics, fit
# and coefficients statistics, etc. from the other Python examples
print json.dumps(equation.solvedCoefficients.tolist())
print(json.dumps(pyeq2.outputSourceCodeService().GetOutputSourceCodeJAVASCRIPT(equation)))
开发者ID:HerobrinesArmy,项目名称:pyeq2,代码行数:30,代码来源:interface.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pyeq3.dataConvertorService函数代码示例发布时间:2022-05-25
下一篇:
Python pyeq2.dataConvertorService函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap