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


C# InputData.NodeConfigurationWithName方法代码示例

本文整理汇总了C#中InputData.NodeConfigurationWithName方法的典型用法代码示例。如果您正苦于以下问题:C# InputData.NodeConfigurationWithName方法的具体用法?C# InputData.NodeConfigurationWithName怎么用?C# InputData.NodeConfigurationWithName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InputData的用法示例。


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

示例1: PushesDataToEpoch

        public void PushesDataToEpoch()
        {
            const string UNUSED_NAME = "UNUSED";

            var c = new SingleEpochController();
            var dev = new UnitConvertingExternalDevice(UNUSED_NAME, UNUSED_DEVICE_MANUFACTURER, UNUSED_BACKGROUND);
            c.AddDevice(dev);

            var srate = new Measurement(100, "Hz");
            var samples = Enumerable.Range(0, 100).Select(i => new Measurement(1, "V")).ToList();

            var e = new Epoch("PushesDataToEpoch");
            e.Responses[dev] = new Response();

            e.Stimuli[dev] = new RenderedStimulus((string) "ID1", (IDictionary<string, object>) new Dictionary<string, object>(), (IOutputData) new OutputData(samples, srate, false));

            c.SetCurrentEpoch(e);

            var streamFake = new DAQInputStream("StreamFake");

            var data = new InputData(samples, srate, DateTimeOffset.Now)
                .DataWithStreamConfiguration(streamFake, new Dictionary<string, object>());

            c.PushInputData(dev, data);

            Assert.That(e.Responses[dev].Data, Is.EqualTo(data.Data));
            Assert.That(e.Responses[dev].InputTime, Is.EqualTo(data.InputTime));
            Assert.That(e.Responses[dev].DataConfigurationSpans.First().Nodes.First(),
                Is.EqualTo(data.NodeConfigurationWithName(streamFake.Name)));
        }
开发者ID:physion,项目名称:symphony-core,代码行数:30,代码来源:ControllerTests.cs

示例2: InputData_SetsExternalDeviceConfig

        public void InputData_SetsExternalDeviceConfig()
        {
            var config = new Dictionary<string, object>();
            config["key"] = "value";

            IInputData data = new InputData(Data, UNUSED_SRATE, DateTimeOffset.Now);

            data = data.DataWithExternalDeviceConfiguration(devFake, config);

            Assert.That(data.NodeConfigurationWithName(devFake.Name).Configuration, Is.EqualTo(config));
        }
开发者ID:Symphony-DAS,项目名称:symphony-core,代码行数:11,代码来源:IODataTests.cs

示例3: InputDataConversion

        public void InputDataConversion()
        {
            IDictionary<string, object> config = new Dictionary<string, object>(2);
            config["param1"] = 10;
            config["param2"] = 1;

            IMeasurement srate = new Measurement(1000, "Hz");

            IInputData data = new InputData(this.Data,
                srate,
                DateTimeOffset.Now,
                new PipelineNodeConfiguration(IOData.STREAM_CONFIGURATION_NAME, new Dictionary<string, object>()))
                .DataWithExternalDeviceConfiguration(devFake, new Dictionary<string, object>());

            Converters.Clear();
            ConvertProc fooConversion = (m) => new Measurement(m.QuantityInBaseUnits * 10, 1, "foo");
            Converters.Register("V", "foo", fooConversion);

            IInputData expected = new InputData(data,
                data.Data.Select(m => new Measurement(m.QuantityInBaseUnits * 10, 1, "foo")).ToList());

            Assert.NotNull(expected.NodeConfigurationWithName(IOData.STREAM_CONFIGURATION_NAME));
            IInputData actual = data.DataWithUnits("foo");

            Assert.AreEqual(expected.Data, actual.Data);
            Assert.That(actual.NodeConfigurationWithName(IOData.EXTERNAL_DEVICE_CONFIGURATION_NAME),
                Is.EqualTo(expected.NodeConfigurationWithName(IOData.EXTERNAL_DEVICE_CONFIGURATION_NAME)));
            Assert.That(actual.NodeConfigurationWithName(IOData.STREAM_CONFIGURATION_NAME),
                Is.EqualTo(expected.NodeConfigurationWithName(IOData.STREAM_CONFIGURATION_NAME)));
            Assert.AreEqual(expected.InputTime, actual.InputTime);
        }
开发者ID:Symphony-DAS,项目名称:symphony-core,代码行数:31,代码来源:IODataTests.cs

示例4: InputDataCreation

        public void InputDataCreation()
        {
            IDictionary<string, object> config = new Dictionary<string, object>(2);
            config["param1"] = 10;
            config["param2"] = 1;

            IMeasurement srate = new Measurement(1000, "Hz");

            DateTimeOffset expectedTime = DateTimeOffset.UtcNow;

            var nodeName = "test-node";

            IInputData inData = new InputData(this.Data,
                new Measurement(1000, "Hz"),
                expectedTime,
                new PipelineNodeConfiguration(nodeName, config));

            Assert.IsNotNull(inData);
            Assert.AreEqual(this.Data, inData.Data);
            Assert.IsNull(inData.NodeConfigurationWithName(nodeName+"x"));
            Assert.That(inData.NodeConfigurationWithName(nodeName).Configuration, Is.EqualTo(config));
            Assert.AreEqual(srate, inData.SampleRate);
            Assert.AreEqual(expectedTime, inData.InputTime);
        }
开发者ID:Symphony-DAS,项目名称:symphony-core,代码行数:24,代码来源:IODataTests.cs

示例5: PushesDataToEpoch

        public void PushesDataToEpoch()
        {
            const string UNUSED_NAME = "UNUSED";

            var daq = new SimpleDAQController();
            var c = new NonValidatingController { DAQController = daq };
            var dev = new UnitConvertingExternalDevice(UNUSED_NAME, UNUSED_DEVICE_MANUFACTURER, c, UNUSED_BACKGROUND);
            var outStream = new DAQOutputStream("out");
            var inStream = new DAQInputStream("in");

            dev.BindStream(outStream).BindStream(inStream);

            var srate = new Measurement(100, "Hz");
            var samples = Enumerable.Range(0, 100).Select(i => new Measurement(1, "V")).ToList();

            var e = new Epoch("PushesDataToEpoch");
            e.Responses[dev] = new Response();

            e.Stimuli[dev] = new RenderedStimulus((string) "ID1", (IDictionary<string, object>) new Dictionary<string, object>(), (IOutputData) new OutputData(samples, srate, false));

            var data = new InputData(samples, srate, DateTimeOffset.Now).DataWithStreamConfiguration(inStream, new Dictionary<string, object>());
            bool pushed = false;

            daq.Started += (evt, args) =>
                {
                    c.PushInputData(dev, data);
                    pushed = true;

                    c.RequestStop();
                };

            c.EnqueueEpoch(e);
            c.StartAsync(null);

            while (!pushed)
            {
                Thread.Sleep(1);
            }

            Assert.That(e.Responses[dev].Data, Is.EqualTo(data.Data));
            Assert.That(e.Responses[dev].InputTime, Is.EqualTo(data.InputTime));
            Assert.That(e.Responses[dev].DataConfigurationSpans.First().Nodes.First(),
                Is.EqualTo(data.NodeConfigurationWithName(inStream.Name)));
        }
开发者ID:Symphony-DAS,项目名称:symphony-core,代码行数:44,代码来源:ControllerTests.cs


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