本文整理汇总了Python中SUAVE.Structure.Data.magic方法的典型用法代码示例。如果您正苦于以下问题:Python Data.magic方法的具体用法?Python Data.magic怎么用?Python Data.magic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SUAVE.Structure.Data
的用法示例。
在下文中一共展示了Data.magic方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_this
# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import magic [as 别名]
def do_this(input1,input2=None):
""" SUAVE.Attributes.Attribute.do_this(input1,input2=None)
conditions data for some useful purpose
Inputs:
input1 - description [units]
input2 - description [units]
Outpus:
output1 - description
output2 - description
>> try to minimize outputs
>> pack up outputs into Data() if needed
Assumptions:
if needed
"""
# unpack inputs
var1 = input1.var1
var2 = inputs.var2
# setup
var3 = var1 * var2
# process
magic = np.log(var3)
# packup outputs
output = Data()
output.magic = magic
output.var3 = var3
return output
示例2: simple_method
# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import magic [as 别名]
def simple_method(input1,input2=None):
""" SUAVE.Methods.SimpleMethod(input1,input2=None)
does something useful
Inputs:
input1 - description [units]
input2 - description [units]
Outputs:
output1 - description
output2 - description
>> try to minimize outputs
>> pack up outputs into Data() if needed
Assumptions:
if needed
"""
# unpack inputs
var1 = input1.var1
var2 = inputs.var2
# setup
var3 = var1 * var2
# process
magic = np.log(var3)
# packup outputs
output = Data()
output.magic = magic
output.var3 = var3
return output
示例3: __call__
# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import magic [as 别名]
def __call__(self,input1,input2=None):
# the method used with the class is called like a function
# document at class level
# unpack inputs
var1 = input1.var1
var2 = inputs.var2
# setup
var3 = var1 * var2
# process
magic = np.log(var3)
# packup outputs
output = Data()
output.magic = magic
output.var3 = var3
return output