/// <summary>Add a column</summary> public override int AddColumn(Object newCol) { data.AddColumn(newCol); // Move the cursor to point after all the data describing // the previous column. Cursor c = myHeader.PositionAfterIndex("TBCOL", data.NCols); int rowlen = data.AddColInfo(NCols, c); int oldRowlen = myHeader.GetIntValue("NAXIS1"); myHeader.SetNaxis(1, rowlen + oldRowlen); int oldTfields = myHeader.GetIntValue("TFIELDS"); try { myHeader.AddValue("TFIELDS", oldTfields + 1, null); } catch (Exception e) { Console.Error.WriteLine("Impossible exception at addColumn:" + e); } return(NCols); }
public static Data Encapsulate(Object o) { if (o != null && o.GetType().IsArray) { if (ArrayFuncs.IsArrayOfArrays(o)) { Array oo = (Array)o; AsciiTable d = new AsciiTable(); for (int i = 0; i < oo.Length; i += 1) { d.AddColumn(oo.GetValue(i)); } return(d); } else { throw new Exception("OOPS. FIX AsciiTableHDU.Encapsulate(Object o)."); } } return(null); }
/// <summary> /// Create a ASCII table data structure from /// an array of objects representing the columns. /// </summary> public static Data Encapsulate(Object o) { if(o != null && o.GetType().IsArray) { if(ArrayFuncs.IsArrayOfArrays(o)) { Array oo = (Array)o; AsciiTable d = new AsciiTable(); for (int i = 0; i < oo.Length; i += 1) { d.AddColumn(oo.GetValue(i)); } return d; } else { throw new Exception("OOPS. FIX AsciiTableHDU.Encapsulate(Object o)."); } } return null; }