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

Python InputPort.InputPort类代码示例

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

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



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

示例1: DataControl

class DataControl(PythonTask):

    def __init_ports__(self):
        self.in_ = InputPort(name="in", data_type=Control)
        self.out = OutputPort(name="out", data_type=Control)

    def execute(self, grp):
        self.in_.get_data(Control);
        self.out.put_data(Control());
开发者ID:systemincloud,项目名称:sic-examples,代码行数:9,代码来源:DataControl.py


示例2: Default

class Default(PythonTask):

    def __init_ports__(self):
        self.in1 = InputPort(name="in1", data_type=Text)
        self.in2 = InputPort(name="in2", data_type=Text, hold=True)
        self.out = OutputPort(name="out", data_type=Text)

    def execute(self, grp):
        self.out.put_data(Text(self.in1.get_data(Text).values[0] + self.in2.get_data(Text).values[0]));
开发者ID:systemincloud,项目名称:sic-examples,代码行数:9,代码来源:Default.py


示例3: Constant2Add

class Constant2Add(PythonTask):

    def __init_ports__(self):
        self.in_1 = InputPort(name="In 1", data_type=Int32)
        self.in_2 = InputPort(name="In 2", data_type=Int32)
        self.out = OutputPort(name="Out", data_type=Int32)

    def execute(self, grp):
        suma = Int32(self.in_1.get_data(Int32).value + self.in_2.get_data(Int32).value)
        self.out.put_data(suma)
开发者ID:systemincloud,项目名称:sic-examples,代码行数:10,代码来源:Constant2Add.py


示例4: DataFloat32

class DataFloat32(PythonTask):

    def __init_ports__(self):
        self.in1 = InputPort(name="in1", data_type=Float32)
        self.in2 = InputPort(name="in2", data_type=Float32)
        self.out = OutputPort(name="out", data_type=Float32)

    def execute(self, grp):
        in1Data = self.in1.get_data(Float32)
        in2Data = self.in2.get_data(Float32)
        self.out.put_data(Float32(in1Data.value + in2Data.value))
开发者ID:systemincloud,项目名称:sic-examples,代码行数:11,代码来源:DataFloat32.py


示例5: DataBool

class DataBool(PythonTask):

    def __init_ports__(self):
        self.in1 = InputPort(name="in1", data_type=Bool)
        self.in2 = InputPort(name="in2", data_type=Bool)
        self.out = OutputPort(name="out", data_type=Bool)

    def execute(self, grp):
        in1Bool = self.in1.get_data(Bool)
        in2Bool = self.in2.get_data(Bool)
        self.out.put_data(Bool(in1Bool.values[0] and in2Bool.values[0]))
开发者ID:systemincloud,项目名称:sic-examples,代码行数:11,代码来源:DataBool.py


示例6: DataInt64Dims

class DataInt64Dims(PythonTask):

    def __init_ports__(self):
        self.in1 = InputPort(name="in1", data_type=Int64)
        self.in2 = InputPort(name="in2", data_type=Int64)
        self.out = OutputPort(name="out", data_type=Int64)

    def execute(self, grp):
        in1Data = self.in1.get_data(Int64)
        in2Data = self.in2.get_data(Int64)
        ret = list(map(add, in1Data.values, in2Data.values))
        self.out.put_data(Int64(ret, in1Data.dims))
开发者ID:systemincloud,项目名称:sic-examples,代码行数:12,代码来源:DataInt64Dims.py


示例7: DataBoolDims

class DataBoolDims(PythonTask):

    def __init_ports__(self):
        self.in1 = InputPort(name="in1", data_type=Bool)
        self.in2 = InputPort(name="in2", data_type=Bool)
        self.out = OutputPort(name="out", data_type=Bool)

    def execute(self, grp):
        in1Bool = self.in1.get_data(Bool)
        in2Bool = self.in2.get_data(Bool)
        ret = list(map(and_, in1Bool.values, in2Bool.values))
        self.out.put_data(Bool(ret, in1Bool.dims))
开发者ID:systemincloud,项目名称:sic-examples,代码行数:12,代码来源:DataBoolDims.py


示例8: Lib

class Lib(PythonTask):

    def __init_ports__(self):
        self.x = InputPort(name="x", data_type=Int32)
        self.fun = InputPort(name="fun", data_type=Text)
        self.out = OutputPort(name="out", data_type=Int32)

    def execute(self, grp):
        x = symbols('x')
        x_val = self.x.get_data(Int32).values[0]
        fun = self.fun.get_data(Text).values[0]
        expr = parse_expr(fun)
        res = expr.subs(x, x_val)
        self.out.put_data(Int32(int(res)))
开发者ID:systemincloud,项目名称:sic-examples,代码行数:14,代码来源:Lib.py


示例9: Atomic2SIn2AIn1Out

class Atomic2SIn2AIn1Out(PythonTask):

    def __init_ports__(self):
        self.in1 = InputPort(name="in1", data_type=Text)
        self.in2 = InputPort(name="in2", data_type=Text)
        self.in3 = InputPort(name="in3", data_type=Text, asynchronous=True)
        self.in4 = InputPort(name="in4", data_type=Text, asynchronous=True)
        self.out = OutputPort(name="out", data_type=Text)

    def execute_async(self, async_in):
        asynchInText = async_in.get_data(Text)
        self.out.put_data(Text("From port " + async_in.name + ": " + asynchInText.values[0]))

    def execute(self, grp):
        in1Text = self.in1.get_data(Text)
        in2Text = self.in2.get_data(Text)
        self.out.put_data(Text(in1Text.values[0] + " " + in2Text.values[0]))
开发者ID:systemincloud,项目名称:sic-examples,代码行数:17,代码来源:Atomic2SIn2AIn1Out.py


示例10: DataTextCastedBool

class DataTextCastedBool(PythonTask):

    def __init_ports__(self):
        self.in_ = InputPort(name="in", data_type=Bool)
        self.out = OutputPort(name="out", data_type=Text)

    def execute(self, grp):
        inData = self.in_.get_data(Text)
        self.out.put_data(Text(inData.value.upper()))
开发者ID:systemincloud,项目名称:sic-examples,代码行数:9,代码来源:DataTextCastedBool.py


示例11: Break

class Break(PythonTask):

    def __init_ports__(self):
        self.in_1 = InputPort(name="In", data_type=Int32)

    def execute(self, grp):
        i = self.in_1.get_data(Int32).values[0]
        if i == 3:
            self.exit_runner()
开发者ID:systemincloud,项目名称:sic-examples,代码行数:9,代码来源:Break.py


示例12: DataRawDims

class DataRawDims(PythonTask):

    def __init_ports__(self):
        self.in_ = InputPort(name="in", data_type=Raw)
        self.out = OutputPort(name="out", data_type=Raw)

    def execute(self, grp):
        inData = self.in_.get_data(Raw)
        inRaw = inData.values
        self.out.put_data(Raw(inRaw, inData.dims))
开发者ID:systemincloud,项目名称:sic-examples,代码行数:10,代码来源:DataRawDims.py


示例13: DataDecimal

class DataDecimal(PythonTask):

    def __init_ports__(self):
        self.in_ = InputPort(name="in", data_type=Decimal)
        self.out = OutputPort(name="out", data_type=Decimal)

    def execute(self, grp):
        in1Data = self.in_.get_data(Decimal)
        dec = in1Data.values[0] * D(10)
        self.out.put_data(Decimal(dec))
开发者ID:systemincloud,项目名称:sic-examples,代码行数:10,代码来源:DataDecimal.py


示例14: DataTextDims

class DataTextDims(PythonTask):

    def __init_ports__(self):
        self.in_ = InputPort(name="in", data_type=Text)
        self.out = OutputPort(name="out", data_type=Text)

    def execute(self, grp):
        inData = self.in_.get_data(Text)
        inText = inData.values
        self.out.put_data(Text(inText, inData.dims))
开发者ID:systemincloud,项目名称:sic-examples,代码行数:10,代码来源:DataTextDims.py


示例15: Parameters

class Parameters(PythonTask):

    def __init_ports__(self):
        self.in_ = InputPort(name="in", data_type=Int32)
        self.out = OutputPort(name="out", data_type=Int32)

    def runner_start(self):
        self.n = int(self.get_parameter('N'))
        self.m = int(self.get_parameter('M'))

    def execute(self, grp):
        self.out.put_data(Int32(self.in_.get_data(Int32).values[0]*self.n + self.m))
开发者ID:systemincloud,项目名称:sic-examples,代码行数:12,代码来源:Parameters.py


示例16: ExtSrcAtomicWith1SIn

class ExtSrcAtomicWith1SIn(PythonTask):

    def __init_ports__(self):
        self.in_ = InputPort(name="in", data_type=Int32)
        self.out = OutputPort(name="out", data_type=[Text, Int32])

    def runner_start(self):
        self.notify()

    def notify(self):
        self.external_data()
        threading.Timer(1, self.notify).start()

    def execute_ext_src(self):
        self.out.put_data(Text('External: ' + str(random.getrandbits(100))))

    def execute(self, grp):
        inData = self.in_.get_data(Int32)
        self.out.put_data(Int32(10*inData.values[0]))
开发者ID:systemincloud,项目名称:sic-examples,代码行数:19,代码来源:ExtSrcAtomicWith1SIn.py


示例17: ShowHistogram

class ShowHistogram(PythonTask):

    def __init_ports__(self):
        self.in_ = InputPort(name="in", data_type=Float32)

    def __init__(self):
        plt.ion()
        self.fig = plt.figure()
        v = np.random.normal(10, 5, 10000)
        n, self.bins, self.patches = plt.hist(v, 100, normed=True, facecolor='green', alpha=0.75)
        
    def execute(self, grp):
        with warnings.catch_warnings():
            warnings.simplefilter("ignore")
            vs = self.in_.get_data(Float32).values
            v = np.array(vs)
            n, self.bins = np.histogram(v, self.bins, normed=True)
            for rect,h in zip(self.patches,n):
                rect.set_height(h)
            self.fig.canvas.draw()
            plt.pause(0.0001)
开发者ID:systemincloud,项目名称:sic-examples,代码行数:21,代码来源:ShowHistogram.py


示例18: ExtSrcAtomicWith2SIn1AIn

class ExtSrcAtomicWith2SIn1AIn(PythonTask):

    def __init_ports__(self):
        self.in1 = InputPort(name="in1", data_type=Int32, asynchronous=True)
        self.in2 = InputPort(name="in2", data_type=Int32)
        self.in3 = InputPort(name="in3", data_type=Int32)
        self.out = OutputPort(name="out", data_type=Text)

    def runner_start(self):
        self.notify()

    def notify(self):
        self.external_data()
        threading.Timer(1, self.notify).start()

    def execute_async(self, async_in):
        self.out.put_data(Text("From " + async_in.name + ": " + str(async_in.get_data(Int32).values[0])));


    def execute_ext_src(self):
        self.out.put_data(Text("External: " + str(random.getrandbits(100))))

    def execute(self, grp):
        self.out.put_data(Text("From In2: " + str(self.in2.get_data(Int32).values[0])));
开发者ID:systemincloud,项目名称:sic-examples,代码行数:24,代码来源:ExtSrcAtomicWith2SIn1AIn.py


示例19: __init_ports__

 def __init_ports__(self):
     self.in_ = InputPort(name="in", data_type=Text)
     self.out = OutputPort(name="out", data_type=Text)
开发者ID:systemincloud,项目名称:sic-examples,代码行数:3,代码来源:DataTextDims.py


示例20: __init_ports__

 def __init_ports__(self):
     self.in_ = InputPort(name="in", data_type=Float32)
开发者ID:systemincloud,项目名称:sic-examples,代码行数:2,代码来源:ShowHistogram.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python OutputPort.OutputPort类代码示例发布时间:2022-05-27
下一篇:
Python kernel.TimeStepping类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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