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


C# Series.WriteToConsole方法代码示例

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


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

示例1: AddTwoSeriesWithDifferentLengths

        private static Series AddTwoSeriesWithDifferentLengths(Series s1, Series s2, ref DateTime t)
        {
            for (int i = 0; i < 10; i++)
            {
                s1.Add(t, 1);

                if (i > 5 && i < 8)
                {
                    s2.Add(t, 2);
                }
                t = t.AddDays(1);
            }
            s1.WriteToConsole();
            s2.WriteToConsole();
            Series s3 = s1 + s2;
            return s3;
        }
开发者ID:usbr,项目名称:Pisces,代码行数:17,代码来源:TestAdd.cs

示例2: Merge

        public void Merge()
        {
            Series observed = new Series();
            observed.Name = "observed";
            observed.TimeInterval = TimeInterval.Daily;

            Series estimated = new Series();
            estimated.Name = "estimated";
            estimated.TimeInterval = TimeInterval.Daily;

            DateTime t = new DateTime(2000,1,1);
            for (int i = 1; i <= 10; i++)
            {
                estimated.Add(t, i, PointFlag.Estimated);

                if( i >=5 && i <=8 ) // create observed data time steps 5,6,7,8
                  observed.Add(t, 100,PointFlag.None);

                t = t.AddDays(1).Date;
            }

            observed.WriteToConsole(true);
            estimated.WriteToConsole(true);
            var m = Math.Merge(observed, estimated);
            m.WriteToConsole(true);
            for (int i = 0; i < m.Count; i++)
            {

                var pt = m[i];

                if (pt.Value > 90)
                    Assert.IsTrue(pt.Flag == PointFlag.None);
                else
                    Assert.IsTrue(pt.Flag == PointFlag.Estimated);

            }
        }
开发者ID:usbr,项目名称:Pisces,代码行数:37,代码来源:TestMerge.cs

示例3: SimpleAverageForDayOnly12Points

        public void SimpleAverageForDayOnly12Points()
        {
            Series input = new Series();

            DateTime t = DateTime.Now.Date.AddMinutes(15);
            for (int i = 0; i < 12; i++)
            {
            input.Add(t, i * 10);

            t = t.AddMinutes(2);
            }
            input.WriteToConsole();
            Series avg = Math.DailyAverage(input,96);
            avg.WriteToConsole();
            Assert.AreEqual(1, avg.Count);
            Assert.IsTrue(avg[0].IsMissing);
        }
开发者ID:usbr,项目名称:Pisces,代码行数:17,代码来源:AverageTest.cs

示例4: PolynomialRatingEquation

        public void PolynomialRatingEquation()
        {
            //simple equation to test ( y = 2*x )
              PolynomialEquation eq = new PolynomialEquation(
            new double[]{0, 2.0},10, 50,"test equation");
             Series s = new Series(null,"cfs",TimeInterval.Daily);
              s.Add(DateTime.Parse("2005-01-01"),10);
              s.Add(DateTime.Parse("2005-01-02"),20);
              s.Add(DateTime.Parse("2005-01-03"),50);
              s.Add(DateTime.Parse("2005-01-04"),60);
              s.Add(DateTime.Parse("2005-01-05"),2);

              Console.WriteLine("--- input series ----");
            s.WriteToConsole(true);
              Series sp = Math.Polynomial(s,eq,
            DateTime.Parse("2005-01-02"),
            DateTime.Parse("2006-01-01"));
              Console.WriteLine(eq.ToString());

              Console.WriteLine("--- polynomial computed series ----");
              sp.WriteToConsole(true);

              Assert.AreEqual(4,sp.Count); // should have 4 return values

              double v = sp.Lookup(DateTime.Parse("2005-01-02"));
              Assert.AreEqual(40,v,0.00001);

              v = sp.Lookup(DateTime.Parse("2005-01-03"));

              Assert.AreEqual(sp[sp.LookupIndex(DateTime.Parse("2005-01-03"))].Flag,PointFlag.Computed);

            Assert.AreEqual(100,v,0.00001);

              // should return missing (null) for  jan 4 and jan 6

              v = sp.Lookup(DateTime.Parse("2005-01-04"));
              Assert.AreEqual(Point.MissingValueFlag,v,0.00001);
              v = sp.Lookup(DateTime.Parse("2005-01-05"));
              Assert.AreEqual(Point.MissingValueFlag,v,0.00001);
        }
开发者ID:usbr,项目名称:Pisces,代码行数:40,代码来源:TestPolynomial.cs

示例5: PolynomialRatingEquationListTimeConstraints

        public void PolynomialRatingEquationListTimeConstraints()
        {
            //equation to test ( y = 2*x )
              PolynomialEquation eq1 = new PolynomialEquation(
            new double[]{0, 2.0},10, 50,"test equation");
              //equation to test ( y = 1*x )
              PolynomialEquation eq2 = new PolynomialEquation(
            new double[]{0, 1.0},10, 50,"test equation");
              Series s = new Series(null,"cfs",TimeInterval.Daily);
              s.Add(DateTime.Parse("2005-01-01"),10);
              s.Add(DateTime.Parse("2005-01-02"),20);
              s.Add(DateTime.Parse("2005-01-03"),50);
              s.Add(DateTime.Parse("2005-01-04"),60);
              s.Add(DateTime.Parse("2005-01-05"),2);

              Console.WriteLine("--- input series ----");
              s.WriteToConsole(true);
              DateTime[] t1 = { new DateTime(2005,1,1), new DateTime(2005,1,2)};
              DateTime[] t2 = { new DateTime(2005,1,1), new DateTime(2005,2,2)};

              Series sp = Math.Polynomial(s,new PolynomialEquation[] {eq1,eq2},
            t1,t2,
            DateTime.Parse("2005-01-01"),
            DateTime.Parse("2006-01-01"));
              Console.WriteLine(eq1.ToString());
              Console.WriteLine(eq2.ToString());

              Console.WriteLine("--- polynomial computed series ----");
              sp.WriteToConsole(true);

              Assert.AreEqual(5,sp.Count); // should have 4 return values

              double v = sp.Lookup(DateTime.Parse("2005-01-01"));
              Assert.AreEqual(20,v,0.00001);

              v = sp.Lookup(DateTime.Parse("2005-01-02"));
              Assert.AreEqual(20,v,0.00001);

              v = sp.Lookup(DateTime.Parse("2005-01-03"));

              Assert.AreEqual(sp[sp.LookupIndex(DateTime.Parse("2005-01-03"))].Flag,PointFlag.Computed);

              Assert.AreEqual(50,v,0.00001);

              // should return missing (null) for  jan 4 and jan 6

              v = sp.Lookup(DateTime.Parse("2005-01-04"));
              Assert.AreEqual(Point.MissingValueFlag,v,0.00001);
              v = sp.Lookup(DateTime.Parse("2005-01-05"));
              Assert.AreEqual(Point.MissingValueFlag,v,0.00001);
        }
开发者ID:usbr,项目名称:Pisces,代码行数:51,代码来源:TestPolynomial.cs


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