Ejemplo n.º 1
0
        public bool AppendMagicDataToOrders(IList <string> OrderIDs)
        {
            var data = new DataBlock();

            foreach (var ID in OrderIDs)
            {
                var row = new Row();

                row.Add(new Field("TYPE", FieldType.StringScalar, "AppendEventData"));
                row.Add(new Field("REFERS_TO_ID", FieldType.StringScalar, ID));
                // populate the FIX_MSG field just to demonstrate the concept

                string sRandomValue;

                int r = _rand.Next(100);
                sRandomValue = r.ToString() + "%";
                row.Add(new Field("FIX_MSG", FieldType.StringScalar, sRandomValue));
                const int UPDATE_OVERWRITE_EXISTING = 2;
                row.Add(new Field("UPDATE_TYPE", FieldType.IntScalar, UPDATE_OVERWRITE_EXISTING));
                data.Add(row);
            }

            _query.Poke("ORDERS;*;", data.ConvertToBinary());

            return(true);
        }
Ejemplo n.º 2
0
        //In this case the ship tries to add the container to the lightest side which is the already full right side
        //which means the container cannot be added
        public void ChooseSideTestFalse()
        {
            Ship ship = new Ship(1, 1, 1, 1000000);

            ship.Rows.Clear();
            Row       row        = new Row(false);
            Stack     stack1     = new Stack(1);
            Stack     stack2     = new Stack(1);
            Stack     stack3     = new Stack(1);
            Stack     stack4     = new Stack(1);
            Container container1 = new Container(500, Normal);
            Container container2 = new Container(100, Normal);
            Container container3 = new Container(100, Normal);
            Container container4 = new Container(100, Normal);

            stack1.Add(container1);
            stack3.Add(container2);
            stack4.Add(container3);
            row.Add(stack1);
            row.Add(stack2);
            row.Add(stack3);
            row.Add(stack4);
            ship.Rows.Add(row);
            ship.UpdateWeight();
            Assert.AreEqual(0, ship.Rows[0][1].Count);
            Assert.AreEqual(1, ship.Rows[0][2].Count);
            Assert.IsFalse(ship.AddContainer(container3));
            Assert.AreEqual(0, ship.Rows[0][1].Count);
            Assert.AreEqual(1, ship.Rows[0][2].Count);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Converts a single result row
        /// </summary>
        /// <param name="o"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public Row ConvertResult(object o, Context model)
        {
            var row      = new Row();
            var trueType = NHibernateProxyHelper.GetClassWithoutInitializingProxy(o);
            var mapping  = Cfg.GetClassMapping(trueType);

            row.Add(KV("Type", BuildTypeLink(trueType)));
            if (mapping == null)
            {
                // not a mapped type
                if (o is object[])
                {
                    row.AddRange(ConvertObjectArray((object[])o, model));
                }
                else
                {
                    row.Add(KV("Value", HttpUtility.HtmlEncode(Convert.ToString(o))));
                }
            }
            else
            {
                var idProp = mapping.IdentifierProperty;
                var id     = idProp.GetGetter(trueType).Get(o);
                row.Add(KV(idProp.Name, Convert.ToString(id)));
                row.AddRange(mapping.PropertyClosureIterator
                             .SelectMany(p => ConvertProperty(o, trueType, p, model)));
            }
            return(row);
        }
Ejemplo n.º 4
0
        public List <Row> getListarTipoTabla()
        {
            List <Row> lstRows = new List <Row>();

            Row row = new Row();

            row.Add("id", 1);
            row.Add("nombre", "Catálogo");

            lstRows.Add(row);

            row = new Row();
            row.Add("id", 2);
            row.Add("nombre", "Código validación");

            lstRows.Add(row);

            row = new Row();
            row.Add("id", 3);
            row.Add("nombre", "Lista");

            lstRows.Add(row);

            return(lstRows);
        }
Ejemplo n.º 5
0
        public void AddTwoWithTag(string label, double value, string tag)
        {
            Row r = new Row();

            AddPaddedLabel(r, label);
            r.Add(1, FormatFloatingPt(value));
            r.Add(2, tag);
            Add(r);
        }
Ejemplo n.º 6
0
        public void AddDateTimeRow(string label, DateTimeOffset value)
        {
            Row r = new Row();

            AddPaddedLabel(r, label);
            r.Add(1, value.ToString(" yy.MM.dd"));
            r.Add(2, "     ");
            r.Add(3, value.ToString("HH:mm:ss"));
            Add(r);
        }
Ejemplo n.º 7
0
        public void AddNumericRow(string label, Tuple value)
        {
            Row r = new Row();

            AddPaddedLabel(r, label);
            r.Add(1, FormatFloatingPt(value.v));
            r.Add(2, " +-");
            r.Add(3, FormatFloatingPt(value.err));
            Add(r);
        }
Ejemplo n.º 8
0
        public void AddNumericRowWithExtra(string label, Tuple value, double extra)
        {
            Row r = new Row();

            AddPaddedLabel(r, label);
            r.Add(1, FormatFloatingPt(value.v));
            r.Add(2, " +-");
            r.Add(3, FormatFloatingPt(value.err));
            r.Add(4, FormatFloatingPt(extra));
            Add(r);
        }
Ejemplo n.º 9
0
        public static Row CreateRow(HVControl.HVCalibrationParameters h, int i)
        {
            Row row = new Row();

            row.Add((int)HVCalibVals.MinHV, h.MinHV.ToString());
            row.Add((int)HVCalibVals.MaxHV, h.MaxHV.ToString());
            row.Add((int)HVCalibVals.DurationSeconds, h.HVDuration.ToString());
            row.Add((int)HVCalibVals.StepVolts, h.Step.ToString());
            row.Add((int)HVCalibVals.DelaySeconds, h.Delay.ToString());
            return(row);
        }
Ejemplo n.º 10
0
        public static unsafe void AddString(string Text, Row Row, TextStyle Style,
                                            Segment Segment)
        {
            if (Text == "")
            {
                return;
            }

            StringBuilder CurrentWord = new StringBuilder();

            char[] Buff = Text.ToCharArray();
            fixed(char *c = &Buff[0])
            {
                for (int i = 0; i < Text.Length; i++)
                {
                    if (c[i] == ' ' || c[i] == '\t')
                    {
                        if (CurrentWord.Length != 0)
                        {
                            Word word = Row.Add(CurrentWord.ToString());
                            word.Style   = Style;
                            word.Segment = Segment;
                            CurrentWord  = new StringBuilder();
                        }

                        Word ws = Row.Add(c[i].ToString
                                              (CultureInfo.InvariantCulture));
                        if (c[i] == ' ')
                        {
                            ws.Type = WordType.xtSpace;
                        }
                        else
                        {
                            ws.Type = WordType.xtTab;
                        }
                        ws.Style   = Style;
                        ws.Segment = Segment;
                    }
                    else
                    {
                        CurrentWord.Append(c[i].ToString
                                               (CultureInfo.InvariantCulture));
                    }
                }
                if (CurrentWord.Length != 0)
                {
                    Word word = Row.Add(CurrentWord.ToString());
                    word.Style   = Style;
                    word.Segment = Segment;
                }
            }
        }
Ejemplo n.º 11
0
        public void AddDualDateOnlyRow(string label, DateTime value, DateTime value2)
        {
            Row r = new Row();

            AddPaddedLabel(r, label);

            r.Add(1, value.ToString(" yy.MM.dd"));
            r.Add(2, "     ");
            r.Add(3, "     ");
            r.Add(4, "     ");
            r.Add(5, value2.ToString(" yy.MM.dd"));
            Add(r);
        }
Ejemplo n.º 12
0
        public void AddCycleColumnRow(int num, ulong[] values, string qc, int[] widths)
        {
            Row    r = new Row();
            string f = String.Format("{{0,{0}}}", widths[0]);

            r.Add(0, String.Format(f, num));
            for (int i = 0; i < values.Length; i++)
            {
                f = String.Format("{{0,{0}}}", widths[i + 1]);
                r.Add(i + 1, String.Format(f, values[i]));
            }
            f = String.Format("{{0,{0}}}", widths[widths.Length - 1]);
            r.Add(widths.Length, String.Format(f, qc));
            Add(r);
        }
Ejemplo n.º 13
0
 public void Insert(UIRect ui)
 {
     Row.Add(ui.LeftEdge);
     Row.Add(ui.RightEdge);
     Column.Add(ui.DownEdge);
     Column.Add(ui.UpEdge);
 }
Ejemplo n.º 14
0
        void SubscribeBarManager(CanvasBarDrawManager manager, bool subscribe)
        {
            if (manager == null)
            {
                return;
            }

            if (subscribe)
            {
                manager.BarAdded += Manager_BarAdded;;

                Row row = null;
                if (manager.Bars.Count() > 0)
                {
                    foreach (var bar in manager.Bars)
                    {
                        row = GetRow(bar.Index);

                        row.Add(bar);
                    }
                }
            }
            else
            {
                manager.BarAdded -= Manager_BarAdded;
            }
        }
Ejemplo n.º 15
0
        private Row readRow()
        {
            if (!csv.Read())
            {
                return(null);
            }
            var context = csv.Context;
            var record  = context.Record;

            var fields = record.ToList().Skip(opts.skipColumns);

            if (opts.maxColumns != null)
            {
                fields = fields.Take((int)opts.maxColumns);
            }

            Row row = new Row();

            foreach (Object field in fields)
            {
                row.Add(field);
            }

            if (row.Count == 0)
            {
                return(null);
            }

            rowsRead += 1;
            return(row);
        }
Ejemplo n.º 16
0
        public override RowSet ExecuteQuery(SqlStatementWithParameters sqlStatementWithParameters)
        {
            Log(LogSeverity.Verbose, "Executing query {Query}.", sqlStatementWithParameters.Statement);

            using (var command = PrepareSqlCommand(sqlStatementWithParameters))
            {
                command.Connection = _connection;
                var rowSet = new RowSet();
                using (var sqlReader = command.ExecuteReader())
                {
                    try
                    {
                        while (sqlReader.Read())
                        {
                            var row = new Row();
                            for (var i = 0; i < sqlReader.FieldCount; i++)
                            {
                                row.Add(sqlReader.GetName(i), sqlReader[i]);
                            }

                            rowSet.Rows.Add(row);
                        }

                        return(rowSet);
                    }
                    catch (SQLiteException ex)
                    {
                        var newEx = new Exception($"Sql fails:\r\n{command.CommandText}\r\n{ex.Message}", ex);
                        throw newEx;
                    }
                }
            }
        }
Ejemplo n.º 17
0
        public static Row CreateRow(HVControl.HVStatus h, int i)
        {
            Row row = new Row();

            row.Add((int)HVVals.Run, i.ToString());
            row.Add((int)HVVals.Time, h.time.ToString("s"));
            row.Add((int)HVVals.HVRead, h.HVread.ToString());
            row.Add((int)HVVals.HVSetPt, h.HVsetpt.ToString());

            for (int j = (int)HVVals.C1; j <= (int)HVVals.C32; j++)
            {
                row.Add(j, h.counts[j - (int)HVVals.C1].ToString());
            }

            return(row);
        }
Ejemplo n.º 18
0
        public QueryTableResult QueryTable(string SQL)
        {
            List <Row> rows = new List <Row>();

            var cmdtext = SQL;

            SqlCommand cmd = new SqlCommand(cmdtext, Conn, Trans);

            cmd.CommandTimeout = TimeOut;
            SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.KeyInfo);

            var schema  = dr.GetSchemaTable();
            var coldefs = new ColumnDefinitions(schema);

            while (dr.Read())
            {
                Row row = new Row();

                for (int t = 0; t < dr.FieldCount; t++)
                {
                    row.Add(dr.GetName(t), dr.GetValue(t));
                }
                rows.Add(row);
            }
            dr.Close();
            cmd.Dispose();

            var qtr = new QueryTableResult();

            qtr.rows      = rows;
            qtr.columns   = coldefs;
            qtr.TableName = coldefs.CommonTableName();

            return(qtr);
        }
Ejemplo n.º 19
0
        public QueryResult QuerySingle(string SQL)
        {
            var result = new QueryResult();

            var cmdtext = SQL;

            SqlCommand cmd = new SqlCommand(cmdtext, Conn, Trans);

            cmd.CommandTimeout = TimeOut;
            SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.SingleRow);

            if (dr.FieldCount > 0)
            {
                if (dr.Read())
                {
                    Row row = new Row();
                    for (int t = 0; t < dr.FieldCount; t++)
                    {
                        string fieldName  = dr.GetName(t);
                        object fieldValue = dr.GetValue(t);
                        row.Add(fieldName, fieldValue);

                        if (result.rows.Count == 0)
                        {
                            result.columns.Add(fieldName, dr.GetDataTypeName(t));
                        }
                    }
                    result.rows.Add(row);
                }
            }

            dr.Close();
            cmd.Dispose();
            return(result);
        }
Ejemplo n.º 20
0
        static void MapInitialize(ref Map map)
        {
            map.Clear();

            for (int m = 0; m < map.Dimension.Y; m++)
            {
                Row row = new Row();

                for (int c = 0; c < map.Dimension.X; c++)
                {
                    row.Add(new Tile());
                }

                map.Add(row);
            }

            Generate(GetGameObject("tree"), ref map, 5);
            Generate(GetGameObject("boulder"), ref map, 3);
            Generate(GetGameObject("chest"), ref map, 0.5f);


            //spawn the player
            playerPos = new VectorTwoInt(random.Next(map.Dimension.X), random.Next(map.Dimension.Y));


            //mapList[playerY] = mapList[playerY].Substring(0, playerX) + "p" + mapList[playerY].Substring(playerX + 1);
            PlaceGameObject(ref map, GetGameObject("player"), playerPos);
        }
Ejemplo n.º 21
0
        public override void Execute()
        {
            var conversion = (FetchXmlToQueryExpressionResponse)CrmServiceClient.Execute(new FetchXmlToQueryExpressionRequest()
            {
                FetchXml = FetchXml
            });
            var query       = conversion.Query;
            int recordCount = 0;

            Log.Information("Retrieving records");
            EntityCollection results;

            do
            {
                results      = CrmServiceClient.RetrieveMultiple(query);
                recordCount += results.Entities.Count;
                Log.Information("Got {recordCount} records", recordCount);
                foreach (var e in results.Entities)
                {
                    Row row = new Row();
                    foreach (var kvp in e.Attributes)
                    {
                        row.Add(kvp.Key, ConvertCrmValue(kvp.Value));
                    }
                    Output.AddRow(row);
                }
                ((QueryExpression)query).PageInfo.PageNumber++;
                ((QueryExpression)query).PageInfo.PagingCookie = results.PagingCookie;
            } while (results.MoreRecords);
        }
Ejemplo n.º 22
0
        public void AddOne(int value)
        {
            Row r = new Row();

            r.Add(0, value.ToString());
            Add(r);
        }
Ejemplo n.º 23
0
        public void AddHeader(string headtext)
        {
            Row rh = new Row(); rh.Add(0, headtext);  // section header text

            Add(rh);
            Add(new Row()); // blank line
        }
Ejemplo n.º 24
0
        private Row Generate()
        {
            var row0 = new Row();
            var col1 = new Column();
            var row1 = new Row();
            var col2 = new Column();
            var row2 = new Row();
            var col3 = new Column();
            var row3 = new Row();

            AddImages(row0, 1);
            AddImages(col1, 2);
            AddImages(row1, 1);
            AddImages(col2, 3);
            AddImages(row2, 2);
            AddImages(col3, 2);
            AddImages(row3, 2);

            row0.Add(col1);
            col1.Add(row1);
            row1.Add(col2);
            col2.Add(row2);

            AddImages(row0, 1);

            return(row0);
        }
Ejemplo n.º 25
0
        static void Main(string[] args)
        {
            var repository = new FileRepository();
            var path       = "C:/Users/Sapik/Desktop/New folder";

            var test = new ImageModifierService(repository);

            var r1 = new Row();
            var c1 = new Column();
            var r2 = new Row();
            var c2 = new Column();
            var r3 = new Row();

            r1.Add(repository.LoadFile(path + "/" + "1.jpg"))
            .Add(c1)
            .Add(repository.LoadFile(path + "/" + "2.jpg"));

            c1.Add(r2)
            .Add(repository.LoadFile(path + "/" + "3.jpg"));

            r2.Add(repository.LoadFile(path + "/" + "4.jpg"))
            .Add(c2);

            c2.Add(r3)
            .Add(repository.LoadFile(path + "/" + "5.jpg"));

            r3.Add(repository.LoadFile(path + "/" + "6.jpg")).Add(repository.LoadFile(path + "/" + "7.jpg"));

            test.Test <Row, Column>(r1, 1000);

            //c1.Add(repository.LoadFile(path + "/" + "1.jpg")).Add(repository.LoadFile(path + "/" + "2.jpg"))
            //    .Add(repository.LoadFile(path + "/" + "3.jpg")).Add(repository.LoadFile(path + "/" + "4.jpg"));
            //test.Test<Column, Row>(c1, 10);
        }
Ejemplo n.º 26
0
        static void Main(string[] args)
        {
            string host            = ConfigurationManager.AppSettings["socrata.host"];
            string datasetId       = ConfigurationManager.AppSettings["socrata.sample.publishDataset"];
            string username        = ConfigurationManager.AppSettings["socrata.username"];
            string password        = ConfigurationManager.AppSettings["socrata.password"];
            string appToken        = ConfigurationManager.AppSettings["socrata.appToken"];
            var    basicAuthClient = new Soda2Client(username, password, appToken);
            var    dataset         = basicAuthClient.getDatasetInfo <Row>(host, datasetId);

            //demo only - this simple CSV parsing doesn't handle escaped commas!
            FileStream       movieCsv = File.OpenRead("resources/movies.csv");
            StreamReader     reader   = new StreamReader(movieCsv);
            var              header   = reader.ReadLine().Split(',');
            LinkedList <Row> rows     = new LinkedList <Row>();

            while (!reader.EndOfStream)
            {
                var line = reader.ReadLine().Split(',');
                Row row  = new Row();
                for (int i = 0; i < line.Length; i++)
                {
                    row.Add(header[i], line[i]);
                }
                rows.AddLast(row);
            }
            dataset.truncate();
            dataset.upsert(rows.ToArray());
        }
Ejemplo n.º 27
0
        public static IEnumerable <Row> ParseToIEnumerable(string path, params char[] separator)
        {
            using (System.IO.TextReader r = new StreamReader(path))
            {
                while (true)
                {
                    var s = r.ReadLine();
                    if (s == null)
                    {
                        break;
                    }

                    var col = s.Split(separator);
                    Row row = new Row();
                    foreach (var c in col)
                    {
                        row.Add(new Column()
                        {
                            Value = c
                        });
                    }

                    yield return(row);
                }
            }
        }
Ejemplo n.º 28
0
 public override void Execute()
 {
     using var cmd      = DbConnection.CreateCommand();
     cmd.CommandText    = Query;
     cmd.CommandTimeout = CommandTimeout;
     try
     {
         using var rs = cmd.ExecuteReader();
         int counter = 0;
         while (rs.Read())
         {
             counter++;
             var row = new Row();
             for (int i = 0; i < rs.VisibleFieldCount; i++)
             {
                 row.Add(rs.GetName(i), rs.GetValue(i));
             }
             Output.AddRow(row);
             if (counter % 5000 == 0)
             {
                 Log.Debug("Got {counter} rows", counter);
             }
         }
         Log.Information("Retrieved a total of {counter} rows", counter);
     }
     catch (SqlException ex)
     {
         throw new StepException($"Failed to run query: {ex.Message}", ex);
     }
 }
Ejemplo n.º 29
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="RowIndex"></param>
        public void ParsePreviewLine(int RowIndex)
        {
            Row Row = Document[RowIndex];

            Row.Clear();
            Row.Add(Row.Text);
        }
Ejemplo n.º 30
0
        private Table GenerateTable()
        {
            // Controlli del caso omessi per semplicità
            string        fixtureName = tempTable[0][0].Attribute;
            List <string> argNames    = new List <string>();
            List <string> argTypes    = new List <string>();

            foreach (Token t in tempTable[1])
            {
                argNames.Add(t.Attribute);
            }
            foreach (Token t in tempTable[2])
            {
                argTypes.Add(t.Attribute);
            }
            tempTable.RemoveRange(0, 3);
            Table resultTable = new Table(fixtureName, argNames, argTypes);

            foreach (List <Token> l in tempTable)
            {
                Row r = new Row();
                for (int i = 0; i < argNames.Count; i++)
                {
                    r.Add(Convert.ChangeType(
                              l[i].Attribute,
                              stringToType[argTypes[i]],
                              System.Globalization.CultureInfo.InvariantCulture));
                }
                resultTable.Add(r);
            }
            return(resultTable);
        }
Ejemplo n.º 31
0
 public static void AddPatternString(string Text,Row Row,Pattern Pattern,TextStyle Style,Segment Segment,bool HasError)
 {
     Word x= Row.Add (Text);
     x.Style = Style;
     x.Pattern = Pattern;
     x.HasError =HasError;
     x.Segment =Segment;
 }
Ejemplo n.º 32
0
        //public static char[] Parse(string text,string separators)
        //{
        //    //string Result="";
        //    System.Text.StringBuilder Result=new System.Text.StringBuilder ();
        //    text= " " + text +" ";

        //    char c;

        //    for(int i = 0; i <text.Length;i++)
        //    {
        //        c = text[i];
        //        if (separators.IndexOf (c)>=0 )
        //            Result.Append (' ');
        //        else
        //            Result.Append ('.');
        //    }

        //    return Result.ToString().ToCharArray ();
        //}



        public static void AddPatternString(string text, Row row, Pattern pattern, TextStyle style, TextStyle matchingStyle, Segment segment, bool hasError)
        {
            Word x = row.Add(text);
            x.Style = style;
            x.MatchingStyle = matchingStyle;
            x.Pattern = pattern;
            x.HasError = hasError;
            x.Segment = segment;
        }
Ejemplo n.º 33
0
        public SheetHDR(ulong Id, string XmlSource, ExcelStream Excel, SharedStrings stringDictionary)
            : base(Id, Excel, stringDictionary)
        {
            var xd = new XmlDocument();
            xd.LoadXml(XmlSource);
            var rows = xd.GetElementsByTagName("row");
            // 遍历row标签
            var flag = false;
            Header = new Header();
            foreach (XmlNode x in rows)
            {
                var cols = x.ChildNodes;
                var objs = new Row(Header);
                // 遍历c标签
                foreach (XmlNode y in cols)
                {
                    string value = null;
                    // 如果是字符串类型,则需要从字典中查询
                    if (y.Attributes["t"]?.Value == "s")
                    {
                        var index = Convert.ToUInt64(y.FirstChild.InnerText);
                        value = StringDictionary[index];
                    }
                    else if (y.Attributes["t"]?.Value == "inlineStr")
                    {
                        value = y.FirstChild.FirstChild.InnerText;
                    }
                    // 否则其中的v标签值即为单元格内容
                    else
                    {
                        value = y.InnerText;
                    }

                    if (!flag)
                    {
                        Header.Add(value, y.Attributes["r"].Value);
                        continue;
                    }
                    objs.Add(value, y.Attributes["r"].Value);
                }
                if (!flag)
                {
                    while (Header.LastOrDefault() == null)
                        Header.RemoveAt(Header.Count - 1);
                    flag = true;
                    continue;
                }
                // 去掉末尾的null
                while (objs.LastOrDefault() == null)
                    objs.RemoveAt(objs.Count - 1);
                if (objs.Count > 0)
                    this.Add(objs);
            }
            while (this.Count > 0 && this.Last().Count == 0)
                this.RemoveAt(this.Count - 1);
            GC.Collect();
        }
Ejemplo n.º 34
0
        public static unsafe void AddString(string Text, Row Row, TextStyle Style,
            Segment Segment)
        {
            if (Text == "")
                return;

            StringBuilder CurrentWord = new StringBuilder();
            char[] Buff = Text.ToCharArray();
            fixed (char* c = &Buff[0])
            {
                for (int i = 0; i < Text.Length; i++)
                {
                    if (c[i] == ' ' || c[i] == '\t')
                    {
                        if (CurrentWord.Length != 0)
                        {
                            Word word = Row.Add(CurrentWord.ToString());
                            word.Style = Style;
                            word.Segment = Segment;
                            CurrentWord = new StringBuilder();
                        }

                        Word ws = Row.Add(c[i].ToString
                            (CultureInfo.InvariantCulture));
                        if (c[i] == ' ')
                            ws.Type = WordType.xtSpace;
                        else
                            ws.Type = WordType.xtTab;
                        ws.Style = Style;
                        ws.Segment = Segment;
                    }
                    else
                        CurrentWord.Append(c[i].ToString
                            (CultureInfo.InvariantCulture));
                }
                if (CurrentWord.Length != 0)
                {
                    Word word = Row.Add(CurrentWord.ToString());
                    word.Style = Style;
                    word.Segment = Segment;
                }
            }
        }
Ejemplo n.º 35
0
 public static void AddPatternString(string Text, Row Row, Pattern Pattern,
     TextStyle Style, Span span, bool HasError)
 {
     var x = new Word
     {
         Style = Style,
         Pattern = Pattern,
         HasError = HasError,
         Span = span,
         Text = Text
     };
     Row.Add(x);
 }
Ejemplo n.º 36
0
        public static unsafe void AddString(string Text, Row Row, TextStyle Style, Span span)
        {
            if (Text == "") {
                return;
            }

            var CurrentWord = new StringBuilder();
            char[] Buff = Text.ToCharArray();
            fixed (char* c = &Buff[0]) {
                for (int i = 0; i < Text.Length; i++) {
                    if (c[i] == ' ' || c[i] == '\t') {
                        if (CurrentWord.Length != 0) {
                            Word word = Row.Add(CurrentWord.ToString());
                            word.Style = Style;
                            word.Span = span;
                            CurrentWord = new StringBuilder();
                        }

                        Word ws = Row.Add(c[i].ToString());
                        if (c[i] == ' ') {
                            ws.Type = WordType.Space;
                        } else {
                            ws.Type = WordType.Tab;
                        }
                        ws.Style = Style;
                        ws.Span = span;
                    } else {
                        CurrentWord.Append(c[i].ToString());
                    }
                }
                if (CurrentWord.Length != 0) {
                    Word word = Row.Add(CurrentWord.ToString());
                    word.Style = Style;
                    word.Span = span;
                }
            }
        }
Ejemplo n.º 37
0
        private IEnumerable<Row> ReadCsv()
        {
            var rows = new List<Row>();
            while (_reader.Read())
            {
                var row = new Row();
                for (var i = 0; i < _reader.CurrentRecord.Length; i++)
                {
                    row.Add(new Column(_reader.FieldHeaders[i], _reader.CurrentRecord[i].Trim()));
                }
                rows.Add(row);
            }

            return rows;
        }
Ejemplo n.º 38
0
        public void AddDualDateOnlyRow(string label, DateTime value, DateTime value2)
        {
            Row r = new Row();
            AddPaddedLabel(r, label);

            r.Add(1, value.ToString(" yy.MM.dd"));
            r.Add(2, "     ");
            r.Add(3, "     ");
            r.Add(4, "     ");
            r.Add(5, value2.ToString(" yy.MM.dd"));
            Add(r);
        }
Ejemplo n.º 39
0
 public void AddDateTimeRow(string label, DateTimeOffset value)
 {
     Row r = new Row();
     AddPaddedLabel(r, label);
     r.Add(1, value.ToString(" yy.MM.dd"));
     r.Add(2, "     ");
     r.Add(3, value.ToString("HH:mm:ss"));
     Add(r);
 }
Ejemplo n.º 40
0
 public static Row CreateRow(HVControl.HVCalibrationParameters h, int i)
 {
     Row row = new Row();
     row.Add((int)HVCalibVals.MinHV, h.MinHV.ToString());
     row.Add((int)HVCalibVals.MaxHV, h.MaxHV.ToString());
     row.Add((int)HVCalibVals.DurationSeconds, h.HVDuration.ToString());
     row.Add((int)HVCalibVals.StepVolts, h.Step.ToString());
     row.Add((int)HVCalibVals.DelaySeconds, h.Delay.ToString());
     return row;
 }
Ejemplo n.º 41
0
 Row GenRatesParamsRow(RatesResultEnhanced rrm, Cycle c = null)
 {
     Row row = new Row();
     int shift = 0;
     if (c != null)
     {
         row.Add(0, c.seq.ToString());
         shift = 1;
     }
     row.Add((int)RateInterval.GateWidth + shift, rrm.gateWidthInTics.ToString());
     row.Add((int)RateInterval.CompletedGates + shift, rrm.completedIntervals.ToString());
     row.Add((int)RateInterval.OverallTime + shift, rrm.totaltime.TotalSeconds.ToString());
     return row;
 }
Ejemplo n.º 42
0
 public void AddOne(int value)
 {
     Row r = new Row();
     r.Add(0, value.ToString());
     Add(r);
 }
Ejemplo n.º 43
0
 public void AddColumnRow(ulong[] values, int[] widths)
 {
     Row r = new Row();
     for (int i = 0; i < values.Length; i++)
     {
         string f = String.Format("{{0,{0}}}", widths[i]);
         r.Add(i, String.Format(f, values[i]));
     }
     Add(r);
 }
Ejemplo n.º 44
0
 public void AddTwoWithTag(string label, double value, string tag)
 {
     Row r = new Row();
     AddPaddedLabel(r, label);
     r.Add(1, FormatFloatingPt(value));
     r.Add(2, tag);
     Add(r);
 }
Ejemplo n.º 45
0
 public void AddTwo(string label, string value)
 {
     Row r = new Row();
     AddPaddedLabel(r, label);
     r.Add(1, value);
     Add(r);
 }
Ejemplo n.º 46
0
        void AddPaddedLabel(Row r, string label)
        {
            string s = String.Empty;

            switch (sectiontype) // INCC5 spacing hard-coded and enforced here
            {
                case ReportSection.Standard:
                    s = String.Format("{0,24}", label);
                    break;
                case ReportSection.MethodResults:
                    s = String.Format("{0,41}", label);
                    break;
                case ReportSection.Summary:
                    s = String.Format("{0,39}", label);
                    break;
                case ReportSection.MultiColumn:
                    s = String.Format("{0,4} ", label);
                    break;
            }
            r.Add(0, s);
        }
Ejemplo n.º 47
0
        protected Section ConstructReportSection(INCCReportSection section, Detector det, MeasOptionSelector moskey = null)
        {
            INCCStyleSection sec = null;
            try
            {
                switch (section)
                {
                    case INCCReportSection.Header:
                        sec = new INCCStyleSection(null, 1);
                        sec.AddHeader(N.App.Name + " " + N.App.Config.VersionString);  // section header
                        break;
                    case INCCReportSection.Context:
                        sec = new INCCStyleSection(null, 1);
                        ConstructContextContent(sec, det);
                        break;
                    case INCCReportSection.Isotopics:
                        if (AssaySelector.ForMass(meas.MeasOption))
                        {
                            sec = new INCCStyleSection(null, 1);
                            sec.SetFPCurrentFormatPrecision(4);
                            Isotopics curiso = Isotopics.update_isotopics(1.0, meas.MeasDate, meas.Isotopics, meas.logger, N.App.AppContext.INCCParity);
                            if (curiso == null)
                            {
                                curiso = new Isotopics();
                                meas.Isotopics.CopyTo(curiso);
                                ctrllog.TraceEvent(LogLevels.Warning, 82034,  "Using incorrect updated defaults for " + meas.Isotopics.id);
                            }
                            sec.AddTwo("Isotopics id:", meas.Isotopics.id);
                            sec.AddTwo("Isotopics source code:", meas.Isotopics.source_code.ToString());
                            sec.AddDualNumericRow("Pu238:", meas.Isotopics[Isotope.pu238], curiso[Isotope.pu238]);
                            sec.AddDualNumericRow("Pu239:", meas.Isotopics[Isotope.pu239], curiso[Isotope.pu239]);
                            sec.AddDualNumericRow("Pu240:", meas.Isotopics[Isotope.pu240], curiso[Isotope.pu240]);
                            sec.AddDualNumericRow("Pu241:", meas.Isotopics[Isotope.pu241], curiso[Isotope.pu241]);
                            sec.AddDualNumericRow("Pu242:", meas.Isotopics[Isotope.pu242], curiso[Isotope.pu242]);
                            sec.AddDualDateOnlyRow("Pu date:", meas.Isotopics.pu_date, curiso.pu_date);
                            sec.AddDualNumericRow("Am241:", meas.Isotopics[Isotope.am241], curiso[Isotope.am241]);
                            sec.AddDualDateOnlyRow("Am date:", meas.Isotopics.am_date, curiso.am_date);
                            // dev note: here is where the alternative K vals are added in the Euratom version
                        }
                        break;
                    case INCCReportSection.ShiftRegister:
                        sec = new INCCStyleSection(null, 1);
                        ConstructSRSection(sec, moskey.MultiplicityParams, det);
                        break;
                    case INCCReportSection.Adjustments:
                        sec = new INCCStyleSection(null, 1);
                        if (AssaySelector.ForMass(meas.MeasOption) || meas.MeasOption == AssaySelector.MeasurementOption.rates)
                        {
                            ushort push = sec.FPFormatPrecision;
                            sec.SetFPCurrentFormatPrecision(4);
                            sec.AddNumericRow("Normalization constant:", meas.Norm.currNormalizationConstant);
                            sec.SetFPCurrentFormatPrecision(push);
                        }
                        if (AssaySelector.UsesBackground(meas.MeasOption))
                        {
                            sec.AddNumericRow("Passive singles bkgrnd:", meas.Background.DeadtimeCorrectedSinglesRate);
                            sec.AddNumericRow("Passive doubles bkgrnd:", meas.Background.DeadtimeCorrectedDoublesRate);
                            sec.AddNumericRow("Passive triples bkgrnd:", meas.Background.DeadtimeCorrectedTriplesRate);

                            if (det.Id.SRType <= InstrType.AMSR)
                            {
                                sec.AddNumericRow("Passive scaler1 bkgrnd:", meas.Background.Scaler1.v);
                                sec.AddNumericRow("Passive scaler2 bkgrnd:", meas.Background.Scaler2.v);
                            }

                            sec.AddNumericRow("Active singles bkgrnd:", meas.Background.INCCActive.Singles);
                            sec.AddNumericRow("Active doubles bkgrnd:", meas.Background.INCCActive.Doubles);
                            sec.AddNumericRow("Active triples bkgrnd:", meas.Background.INCCActive.Triples);
                            if (det.Id.SRType <= InstrType.AMSR)
                            {
                                sec.AddNumericRow("Passive scaler1 bkgrnd:", meas.Background.INCCActive.Scaler1Rate);
                                sec.AddNumericRow("Passive scaler2 bkgrnd:", meas.Background.INCCActive.Scaler2Rate);
                            }
                        }
                        break;
                    case INCCReportSection.CycleSummary:
                        sec = new INCCStyleSection(null, 1);
                        sec.AddIntegerRow(String.Format("Number {0} cycles:",meas.INCCAnalysisState.Methods.HasActiveSelected() || meas.INCCAnalysisState.Methods.HasActiveMultSelected()?"Active":"Passive"), (int)meas.Cycles.GetValidCycleCountForThisKey(moskey.MultiplicityParams)); //det.MultiplicityParams)); // could also use CycleList length but CycleList can be longer when a reanalysis occurs and the analysis processing stops short of the end of the list due to modified termination conditions
                        sec.AddNumericRow("Count time (sec):", (meas.Cycles.Count > 0 ? meas.Cycles[0].TS.TotalSeconds : 0.0));
                        break;

                    case INCCReportSection.Messages:
                        List<MeasurementMsg> sl = null;
                        bool found = meas.Messages.TryGetValue(moskey.MultiplicityParams, out sl);
                        if (found)
                        {
                            sec = new INCCStyleSection(null, 1);
                            sec.AddHeader(String.Format("{0} messages", meas.INCCAnalysisState.Methods.HasActiveSelected() || meas.INCCAnalysisState.Methods.HasActiveMultSelected() ? "Active" : "Passive"));  /// todo: is there an active messages section header analog?
                            foreach (MeasurementMsg m in sl)
                            {
                                Row r = new Row();
                                r.Add(0, m.text);  // expand to log style with toString?
                                sec.Add(r);
                            }
                        }
                        break;
                    case INCCReportSection.Reference:
                        sec = new INCCStyleSection(null, 1);
                        sec.AddHeader("Counting results, summaries and cycle counts file name");  // section header
                        Row resline = new Row(); resline.Add(0, "  " + meas.ResultsFileName);
                        sec.Add(resline);
                        break;
                    default:
                        break;
                }
            }
            catch (Exception e)
            {
                ctrllog.TraceException(e);
            }
            return sec;
        }
Ejemplo n.º 48
0
        Row GenRossiParamsRow(RossiAlphaResultExt rar, Cycle c = null)
        {
            Row row = new Row();
            int shift = 0;
            if (c != null)
            {
                row.Add(0, c.seq.ToString());
                shift = 1;
            }

            row.Add((int)Rossi.GateWidth + shift, rar.gateWidth.ToString());
            row.Add((int)Rossi.Numgates + shift, rar.gateData.Length.ToString());
            return row;
        }
Ejemplo n.º 49
0
 Row GenTimeIntervalParamsRow(TimeIntervalResult esr, Cycle c = null)
 {
     Row row = new Row();
     int shift = 0;
     if (c != null)
     {
         row.Add(0, c.seq.ToString());
         shift = 1;
     }
     row.Add((int)TimeInterval.GateWidth + shift, esr.gateWidthInTics.ToString());
     row.Add((int)TimeInterval.Bins + shift, esr.maxIndexOfNonzeroHistogramEntry.ToString());
     return row;
 }
Ejemplo n.º 50
0
 public void AddCycleColumnRow(int num, ulong[] values, string qc, int[] widths)
 {
     Row r = new Row();
     string f = String.Format("{{0,{0}}}", widths[0]);
     r.Add(0, String.Format(f, num));
     for (int i = 0; i < values.Length; i++)
     {
         f = String.Format("{{0,{0}}}", widths[i + 1]);
         r.Add(i + 1, String.Format(f, values[i]));
     }
     f = String.Format("{{0,{0}}}", widths[widths.Length - 1]);
     r.Add(widths.Length, String.Format(f, qc));
     Add(r);
 }
Ejemplo n.º 51
0
        protected Section ConstructReportSection(INCCReportSection section, MeasOptionSelector moskey, INCCResult ir, Detector det)
        {
            INCCStyleSection sec = null;
            try
            {
                switch (section)
                {

                    // NEXT: in progress, an identical copy of full INCC report sections
                    case INCCReportSection.SummedRawData:
                        sec = new INCCStyleSection(null, 1, INCCStyleSection.ReportSection.Summary);
                        sec.SetFPCurrentFormatPrecision(0);
                        sec.AddHeader(String.Format("{0} summed raw data",meas.INCCAnalysisState.Methods.HasActiveSelected() || meas.INCCAnalysisState.Methods.HasActiveMultSelected()?"Active":"Passive"));  // section header
                        sec.AddNumericRow("Shift register singles sum:", meas.SinglesSum);
                        sec.AddNumericRow("Shift register reals + accidentals sum:", ir.RASum);
                        sec.AddNumericRow("Shift register accidentals sum:", ir.ASum);
                        if (!det.Id.source.UsingVirtualSRCounting(det.Id.SRType))
                        {
                            sec.AddNumericRow("Shift register 1st scaler sum:", ir.S1Sum);
                            sec.AddNumericRow("Shift register 2nd scaler sum:", ir.S2Sum);
                        }
                        break;

                    case INCCReportSection.SummedRA:
                        sec = new INCCStyleSection(null, 1, INCCStyleSection.ReportSection.MultiColumn);
                        sec.AddHeader(String.Format("{0} summed multiplicity distributions",meas.INCCAnalysisState.Methods.HasActiveSelected() || meas.INCCAnalysisState.Methods.HasActiveMultSelected()?"Active":"Passive"));  // section header
                        int[] srawidths = new int[] { 5, 12, 12 };
                        int minbin, maxbin;
                        minbin = Math.Min(ir.RAMult.Length, ir.NormedAMult.Length);
                        maxbin = Math.Max(ir.RAMult.Length, ir.NormedAMult.Length);
                        sec.AddColumnRowHeader(new string[] { " ", "R+A sums", "A sums" }, srawidths);
                        for (int i = 0; i < minbin; i++)
                            sec.AddColumnRow(new ulong[] { (ulong)i, ir.RAMult[i], ir.NormedAMult[i] }, srawidths);
                        for (int i = minbin; i < maxbin; i++)  // check for uneven column
                        {
                            ulong[] potential = new ulong[3];
                            potential[0] = (ulong)i;
                            if (i < ir.RAMult.Length)
                                potential[1] = ir.RAMult[i];
                            if (i < ir.NormedAMult.Length)
                                potential[2] = ir.NormedAMult[i];
                            sec.AddColumnRow(potential, srawidths);
                        }
                        break;

                    case INCCReportSection.MassResults:
                        sec = new INCCStyleSection(null, 1, INCCStyleSection.ReportSection.MethodResults);
                        //Results are not always passive. Boo.
                        sec.AddHeader(String.Format("{0} Results",meas.INCCAnalysisState.Methods.HasActiveSelected() || meas.INCCAnalysisState.Methods.HasActiveMultSelected()?"Active":"Passive"));  // section header
                        sec.AddNumericRow("Singles:", ir.DeadtimeCorrectedSinglesRate);
                        sec.AddNumericRow("Doubles:", ir.DeadtimeCorrectedDoublesRate);
                        sec.AddNumericRow("Triples:", ir.DeadtimeCorrectedTriplesRate);
                        //changed to DTC rates.  Raw rates meaningless here hn 11.5.2014
                        //sec.AddNumericRow("Quads:", mcr.DeadtimeCorrectedQuadsRate); // todo: quads delayed until pents are ready per DN
                        if (!det.Id.source.UsingVirtualSRCounting(det.Id.SRType))
                        {
                            sec.AddNumericRow("Scaler 1:", ir.Scaler1);
                            sec.AddNumericRow("Scaler 2:", ir.Scaler2);
                        }

                        //if (det.Id.SRType >= LMDAQ.InstrType.NPOD)
                        //{
                        //    sec.Add(new Row()); // blank line
                        //    sec.AddNumericRow("Dyt. Singles:", ir.DytlewskiCorrectedSinglesRate);
                        //    sec.AddNumericRow("Dyt. Doubles:", ir.DytlewskiCorrectedDoublesRate);
                        //    sec.AddNumericRow("Dyt. Triples:", ir.DytlewskiCorrectedTriplesRate);
                        //}
                        break;
                    case INCCReportSection.MethodResultsAndParams:
                        // ir contains the measurement option-specific results: empty for rates and holdup, and also empty for calib and verif, the method-focused analyses, 
                        // but values are present for initial, normalization, precision, and should be present for background for the tm bkg results 
                        List<Row> rl = ir.ToLines(meas);
                        sec = new INCCStyleSection(null, 0, INCCStyleSection.ReportSection.MethodResults);
                        sec.AddRange(rl);

                        switch (meas.MeasOption)
                        {
                            case AssaySelector.MeasurementOption.background:
                                if (meas.Background.TMBkgParams.ComputeTMBkg)
                                    ctrllog.TraceEvent(LogLevels.Warning, 82010, "Background truncated multiplicity"); // todo: present the tm bkg results on m.Background
                                break;
                            case AssaySelector.MeasurementOption.initial:
                            case AssaySelector.MeasurementOption.normalization:
                            case AssaySelector.MeasurementOption.precision:
                                break;
                            case AssaySelector.MeasurementOption.verification:
                            case AssaySelector.MeasurementOption.calibration:
                                {
                                    INCCMethodResults imrs;
                                    bool beendonegot = meas.INCCAnalysisResults.TryGetINCCResults(moskey.MultiplicityParams, out imrs);
                                    if (beendonegot && imrs.Count > 0) // should be true for verification and calibration
                                    {
                                        // we've got a distinct detector id and material type on the methods, so that is the indexer here
                                        Dictionary<AnalysisMethod, INCCMethodResult> amimr = imrs[meas.INCCAnalysisState.Methods.selector];

                                        // now get an enumerator over the map of method results
                                        Dictionary<AnalysisMethod, INCCMethodResult>.Enumerator ai = amimr.GetEnumerator();
                                        while (ai.MoveNext())
                                        {
                                            INCCMethodResult imr = ai.Current.Value;
                                            // show the primaryMethod
                                            if (ai.Current.Key.Equals(imrs.primaryMethod))
                                            {
                                                sec.Add(new Row());
                                                Row rh = new Row();
                                                rh.Add(0, "            PRIMARY RESULT");
                                                sec.Add(rh);
                                            }
                                            rl = imr.ToLines(meas);
                                            sec.AddRange(rl);
                                            // todo: optional use of END_PRIMARY_RESULT as in some INCC report formats, but not others
                                        }
                                    }
                                }
                                break;
                            case AssaySelector.MeasurementOption.rates:
                            case AssaySelector.MeasurementOption.holdup:
                            case AssaySelector.MeasurementOption.unspecified:
                            default: // nothing new to present with these
                                break;
                        }
                        break;
                    case INCCReportSection.RawCycles:
                        sec = new INCCStyleSection(null, 1, INCCStyleSection.ReportSection.MultiColumn);
                        sec.AddHeader(String.Format("{0} cycle raw data",meas.INCCAnalysisState.Methods.HasActiveSelected() || meas.INCCAnalysisState.Methods.HasActiveMultSelected()?"Active":"Passive"));  // section header
                        int[] crdwidths = new int[] { 5, 10, 10, 10, 10, 10, 10 };
                        sec.AddColumnRowHeader(new string[] { "Cycle", "Singles", "R+A  ", "A    ", "Scaler1", "Scaler2", "QC Tests" }, crdwidths);
                        foreach (Cycle cyc in meas.Cycles)
                        {
                            // if no results on the cycle, these map indexers throw
                            if (cyc.CountingAnalysisResults.GetResultsCount(typeof(Multiplicity)) > 0)                            // if no results on the cycle, these map indexers throw
                            {
                                MultiplicityCountingRes mcr = (MultiplicityCountingRes)cyc.CountingAnalysisResults[moskey.MultiplicityParams];
                                sec.AddCycleColumnRow(cyc.seq,
                                    new ulong[] { (ulong)mcr.Totals, (ulong)mcr.RASum, (ulong)mcr.ASum, (ulong)mcr.Scaler1.v, (ulong)mcr.Scaler2.v },
                                    meas.AcquireState.qc_tests?cyc.QCStatus(moskey.MultiplicityParams).INCCString():"Off", crdwidths);
                            }
                        }
                        break;
                    case INCCReportSection.DTCRateCycles:
                       
                        sec = new INCCStyleSection(null, 1, INCCStyleSection.ReportSection.MultiColumn);
                        sec.AddHeader(String.Format("{0} cycle DTC rate data",meas.AcquireState.well_config == WellConfiguration.Active?"Active":"Passive"));  // section header
                        int[] crawidths = new int[] { 5, 13, 13, 13, 13, 10 };
                        sec.AddColumnRowHeader(new string[] { "Cycle", "Singles", "Doubles", "Triples", "Mass", "QC Tests" }, crawidths);
                        
                        foreach (Cycle cyc in meas.Cycles)
                        {
                            if (cyc.CountingAnalysisResults.GetResultsCount(typeof(Multiplicity)) > 0)                            // if no results on the cycle, these map indexers throw
                            {
                                MultiplicityCountingRes mcr = (MultiplicityCountingRes)cyc.CountingAnalysisResults[moskey.MultiplicityParams];
                                //These debug rows show raw rates for comparison hn 10.30
                                //sec.AddCycleColumnRow(cyc.seq,
                                    //Again, could be wrong.
                                //    new double[] { mcr.RawSinglesRate.v, mcr.RawDoublesRate.v, -1, -1 },
                                //     cyc.QCStatus(moskey.MultiplicityParams).INCCString(), crawidths); 
                                    //Again, could be wrong.
                               // TODO: Am actually printing out the DTC rates per cycle.  This seems to work in all cases EXCEPT "precision" hn 11.5
                                sec.AddCycleColumnRow(cyc.seq,
                                     // Using the corrected rates!
                                     new double[] { mcr.DeadtimeCorrectedSinglesRate.v, mcr.DeadtimeCorrectedDoublesRate.v, mcr.DeadtimeCorrectedTriplesRate.v, mcr.mass/*Mass*/ },
                                      meas.AcquireState.qc_tests?cyc.QCStatus(moskey.MultiplicityParams).INCCString():"Off", crawidths);
                            }
                        }
                        break;
                    case INCCReportSection.MultiplicityDistributions:
                        sec = new INCCStyleSection(null, 1, INCCStyleSection.ReportSection.MultiColumn);
                        sec.AddHeader(String.Format("{0} multiplicity distributions for each cycle",meas.INCCAnalysisState.Methods.HasActiveSelected() || meas.INCCAnalysisState.Methods.HasActiveMultSelected()?"Active":"Passive"));  // section header
                        int[] csrawidths = new int[] { 6, 12, 12 };
                        foreach (Cycle cyc in meas.Cycles)
                        {
                            if (cyc.CountingAnalysisResults.GetResultsCount(typeof(Multiplicity)) > 0)                            // if no results on the cycle, these map indexers throw
                            {
                                MultiplicityCountingRes mcr = (MultiplicityCountingRes)cyc.CountingAnalysisResults[moskey.MultiplicityParams];
                                minbin = Math.Min(mcr.RAMult.Length, mcr.NormedAMult.Length);
                                maxbin = Math.Max(mcr.RAMult.Length, mcr.NormedAMult.Length);
                                sec.AddColumnRowHeader(new string[] { "Cycle " + cyc.seq, "R+A ", "A   " }, csrawidths);
                                for (int i = 0; i < minbin; i++)
                                    sec.AddColumnRow(new ulong[] { (ulong)i, mcr.RAMult[i], mcr.NormedAMult[i] }, csrawidths);
                                for (int i = minbin; i < maxbin; i++)  // check for uneven column
                                {
                                    ulong[] potential = new ulong[3];
                                    potential[0] = (ulong)i;
                                    if (i < mcr.RAMult.Length)
                                        potential[1] = mcr.RAMult[i];
                                    if (i < mcr.NormedAMult.Length)
                                        potential[2] = mcr.NormedAMult[i];
                                    sec.AddColumnRow(potential, csrawidths);
                                }
                            }
                            sec.Add(new Row());// blank
                        }
                        break;
                    default:
                        break;
                }
            }
            catch (Exception e)
            {
                ctrllog.TraceException(e);
            }
            return sec;
        }
Ejemplo n.º 52
0
 public void AddNumericRow(string label, Tuple value)
 {
     Row r = new Row();
     AddPaddedLabel(r, label);
     r.Add(1, FormatFloatingPt(value.v));
     r.Add(2, " +-");
     r.Add(3, FormatFloatingPt(value.err));
     Add(r);
 }
Ejemplo n.º 53
0
 public void AddHeader(string headtext)
 {
     Row rh = new Row(); rh.Add(0, headtext);  // section header text
     Add(rh);
     Add(new Row()); // blank line
 }
Ejemplo n.º 54
0
 public void AddNumericRowWithExtra(string label, Tuple value, double extra)
 {
     Row r = new Row();
     AddPaddedLabel(r, label);
     r.Add(1, FormatFloatingPt(value.v));
     r.Add(2, " +-");
     r.Add(3, FormatFloatingPt(value.err));
     r.Add(4, FormatFloatingPt(extra));
     Add(r);
 }
Ejemplo n.º 55
0
 Row GenRatesParamsRow(Cycle c)
 {
     Row row = new Row();
     int shift = 0;
     if (c != null)
     {
         row.Add(0, c.seq.ToString());
         shift = 1;
     }
     row.Add((int)RateIntervalCalc.OverallTime + shift, c.TS.TotalSeconds.ToString());
     return row;
 }
Ejemplo n.º 56
0
 public void AddIntegerRow(string label, Int32 value)
 {
     Row r = new Row();
     AddPaddedLabel(r, label);
     r.Add(1, FormatInteger(value));
     Add(r);
 }
Ejemplo n.º 57
0
 public void AddNumericRow(string label, double value)
 {
     Row r = new Row();
     AddPaddedLabel(r, label);
     r.Add(1, FormatFloatingPt(value));
     Add(r);
 }
Ejemplo n.º 58
0
        public void AddDualNumericRow(string label, Tuple value, Tuple value2)
        {
            Row r = new Row();
            AddPaddedLabel(r, label);

            r.Add(1, FormatFloatingPt(value.v));
            r.Add(2, " +-");
            r.Add(3, FormatFloatingPt(value.err));
            r.Add(4, "     ");
            r.Add(5, FormatFloatingPt(value2.v));
            r.Add(6, " +-");
            r.Add(7, FormatFloatingPt(value2.err));
            Add(r);
        }
Ejemplo n.º 59
0
        // print only up to the last non-zero entry, later use the Feynman X,Y dual row technique for this compression attempt
        Row GenRossiDataRow(RossiAlphaResultExt rar, Cycle c = null)
        {
            Row row = new Row();
            int shift = 0;
            if (c != null)
            {
                row.Add(0, c.seq.ToString());
                shift = 1;
            }
            int maxindex = rar.gateData.Length - 1;
            int i = 0;
            for (i = rar.gateData.Length - 1; i >= 0; i--)
            {
                if (rar.gateData[i] > 0)
                {
                    maxindex = i;
                    break;
                }
            }
            //happy dad!
            if (i == 0) // rolled all the way to the start ofthe array and found all 0s, empty bins!
            {
                maxindex = 0; // not 1000 and not -1
            }

            for (i = 0; i <= maxindex; i++)
            {
                row.Add(i + shift, rar.gateData[i].ToString());
            }
            return row;
        }
Ejemplo n.º 60
0
        public static Row CreateRow(HVControl.HVStatus h, int i)
        {
            Row row = new Row();
            row.Add((int)HVVals.Run, i.ToString());
            row.Add((int)HVVals.Time, h.time.ToString("s"));
            row.Add((int)HVVals.HVRead, h.HVread.ToString());
            row.Add((int)HVVals.HVSetPt, h.HVsetpt.ToString());

            for (int j = (int)HVVals.C1; j <= (int)HVVals.C32; j++)
            {
                row.Add(j, h.counts[j - (int)HVVals.C1].ToString());
            }

            return row;
        }