Esempio n. 1
0
        public void SimpleMoveTo()
        {
            Series ts = TestData.Simple2Day;
              Series original = TestData.Simple2Day;
              Selection sel = new Selection(ts[0].DateTime,ts[ts.Count-1].DateTime,0,50);
              Reclamation.TimeSeries.Math.MoveTo(ts,sel,123.456);

              Console.WriteLine("after move to");
              ts.WriteToConsole(true);
              Console.WriteLine("original");
              original.WriteToConsole(true);
              for(int i=0; i<ts.Count; i++)
              {
            if(original[i].Value >=0 && original[i].Value <=50)
            {
            Assert.AreEqual(123.456,ts[i].Value,0.0001);
              Assert.AreEqual("Edited",ts[i].Flag);
            }
            else
            {
             Assert.AreEqual("",ts[i].Flag);
             Assert.AreEqual(original[i].Value,ts[i].Value,0.0001);
            }
              }
        }
Esempio n. 2
0
File: Math.cs Progetto: usbr/Pisces
 /// <summary>
 /// Applies vertical offset to data in selection
 /// </summary>
 public static void Offset(Series s, Selection selected, double verticalOffset)
 {
     if (s.ReadOnly)
     {
         return;
     }
     for (int i = 0; i < s.Count; i++)
     {
         if (s[i].BoundedBy(selected))
         {
             Point pt = s[i];
             pt.Value = pt.Value + verticalOffset;
             pt.Flag = "Edited";
             s[i] = pt;
         }
     }
 }
Esempio n. 3
0
File: Point.cs Progetto: usbr/Pisces
 public bool BoundedBy(Selection select)
 {
     return BoundedBy(select.t1,select.t2,select.ymin,select.ymax);
 }
Esempio n. 4
0
File: Math.cs Progetto: usbr/Pisces
        /// <summary>
        /// moves all values in selection to specified value.
        /// can be useful in two part editing.
        /// first: move many outliers to a known datum (using MoveTo)
        /// second: manually move points one by one (using point move feature of Series Graph)
        /// </summary>
        public static void MoveTo(Series s, Selection selected, double newValue)
        {
            if (s.ReadOnly)
            {
                return;
            }
            for (int i = 0; i < s.Count; i++)
            {
                if (s[i].BoundedBy(selected))
                {
                    Console.WriteLine("moving ");

                    Point pt = s[i];
                    Console.WriteLine(pt);
                    pt.Value = newValue;
                    pt.Flag = "Edited";
                    Console.WriteLine("to ");
                    Console.WriteLine(pt);
                    s[i] = pt;
                }
            }
        }