Beispiel #1
0
        /// <summary>Create a binary table from given header information.</summary>
        /// <param name="myHeader">header describing what the binary table should look like.</param>
        public BinaryTable(Header myHeader)
        {
            int heapSize = myHeader.GetIntValue("PCOUNT");
            heapOffset = myHeader.GetIntValue("THEAP");

            // .99.1 changes: changed the sequence of code lines.
            int rwsz = myHeader.GetIntValue("NAXIS1");
            nRow = myHeader.GetIntValue("NAXIS2");

            // Subtract out the size of the regular table from
            // the heap offset.

            if (heapOffset > 0)
            {
                heapOffset -= nRow * rwsz;
            }

            if (heapOffset < 0 || heapOffset > heapSize)
            {
                throw new FitsException("Inconsistent THEAP and PCOUNT");
            }

            heap = new FitsHeap(heapSize - heapOffset);
            nCol = myHeader.GetIntValue("TFIELDS");
            rowLen = 0;

            ExtendArrays(nCol);
            for (int col = 0; col < nCol; col += 1)
            {
                rowLen += ProcessCol(myHeader, col);
            }

            // .99.1 changes: Added to replace new value of NAXIS1 keyword.
            HeaderCard card = myHeader.FindCard("NAXIS1");
            card.Value = rowLen.ToString();
            myHeader.UpdateLine("NAXIS1", card);
        }