Пример #1
0
 /// <summary>
 /// Consructor initislizing header,data
 /// </summary>
 /// <param name="hdr"></param>
 /// <param name="datum"></param>
 public BinaryTableHDU(Header hdr, Data datum)
     : base((TableData)datum)
 {
     myHeader = hdr;
     myData = datum;
     table = (BinaryTable) datum;
 }
Пример #2
0
 /// <summary>
 /// Create an ascii table header/data unit
 /// </summary>
 /// <param name="h">The template specifying the ascii table.</param>
 /// <param name="d"> The FITS data structure containing the table data.</param>
 ///  <exception cref="FitsException"> FitsException if there was a problem with the header.</exception>
 public AsciiTableHDU(Header h, Data d)
     : base((TableData) d)
 {
     myHeader = h;
     data = (AsciiTable) d;
     myData = d;
 }
Пример #3
0
 /// <summary>Create a header which points to the given data object.</summary>
 /// <param name="o">The data object to be described.</param>
 /// <exception cref="FitsException"> FitsException if the data was not valid for this header.</exception>
 public Header(Data o)
 {
     InitBlock();
     o.FillHeader(this);
 }
Пример #4
0
 /// <summary>Make a header point to the given object.</summary>
 /// <param name="odata">The random groups data the header should describe.</param>
 internal static Header ManufactureHeader(Data d)
 {
     if (d == null)
     {
         throw new FitsException("Attempt to create null Random Groups data");
     }
     Header h = new Header();
     d.FillHeader(h);
     return h;
 }
Пример #5
0
 //internal Object dataArray;
 /// <summary>Create an HDU from the given header and data</summary>
 public RandomGroupsHDU(Header h, Data d)
 {
     myHeader = h;
     myData = d;
 }
Пример #6
0
        /// <summary>Create a  header that describes the given
        /// image data.
        /// </summary>
        /// <param name="o">The image to be described.
        /// </param>
        /// <exception cref=""> FitsException if the object does not contain
        /// valid image data.
        /// 
        /// </exception>
        public static Header ManufactureHeader(Data d)
        {
            Header h = new Header();
            d.FillHeader(h);

            return h;
        }
Пример #7
0
 /// <summary>Build an image HDU using the supplied data.</summary>
 /// <param name="obj">the data used to build the image.</param>
 /// <exception cref=""> FitsException if there was a problem with the data.</exception>
 public UndefinedHDU(Header h, Data d)
 {
     myData = d;
     myHeader = h;
 }
Пример #8
0
 /// <summary>Create a header to match the input data.</summary>
 public static Header ManufactureHeader(Data d)
 {
     Header hdr = new Header();
     d.FillHeader(hdr);
     Cursor c = hdr.GetCursor();
     return hdr;
 }
Пример #9
0
 /// <summary>Create an HDU from the given Data.</summary>
 /// <param name="datum">The data to be described in this HDU.</param>
 public static BasicHDU MakeHDU(Data datum)
 {
     Header hdr = new Header();
     datum.FillHeader(hdr);
     return FitsFactory.HDUFactory(hdr, datum);
 }
Пример #10
0
 /// <summary> Create an ascii table header/data unit.</summary>
 /// <param name="header">the template specifying the ascii table.</param>
 /// <exception cref=""> FitsException if there was a problem with the header.</exception>
 public AsciiTableHDU(Header h, Data d) : base((TableData)d)
 {
     myHeader = h;
     data     = (AsciiTable)d;
     myData   = d;
 }
Пример #11
0
 /// <summary>Build a binary table HDU from the supplied data.</summary>
 /// <param name="data">the array used to build the binary table.</param>
 /// <exception cref="FitsException"> If there was a problem with the data.</exception>
 public static Header ManufactureHeader(Data data)
 {
     Header hdr = new Header();
     data.FillHeader(hdr);
     return hdr;
 }
Пример #12
0
        // change suggested in .99.5 version: Method made public from protected.
        /// <summary>Given Header and data objects return the appropriate type of HDU.</summary>
        public static BasicHDU HDUFactory(Header hdr, Data d)
        {
            if (d is ImageData)
            {
                return new ImageHDU(hdr, d);
            }
            else if (d is RandomGroupsData)
            {
                return new RandomGroupsHDU(hdr, d);
            }
            else if (d is AsciiTable)
            {
                return new AsciiTableHDU(hdr, d);
            }
            else if (d is BinaryTable)
            {
                return new BinaryTableHDU(hdr, d);
            }
            else if (d is UndefinedData)
            {
                return new UndefinedHDU(hdr, d);
            }

            return null;
        }
Пример #13
0
 /// <summary>Build an image HDU using the supplied data.</summary>
 /// <param name="obj">the data used to build the image.</param>
 /// <exception cref="FitsException">If there was a problem with the data.</exception>
 public ImageHDU(Header h, Data d)
 {
     myData = d;
     myHeader = h;
 }
Пример #14
0
        /// <summary>Create a  header that describes the given image data.</summary>
        /// <param name="o">The image to be described.</param>
        /// <exception cref=""> FitsException if the object does not contain valid image data.</exception>
        public static Header ManufactureHeader(Data d)
        {
            if (d == null)
            {
                return null;
            }

            Header h = new Header();
            d.FillHeader(h);

            return h;
        }
Пример #15
0
        /// <summary>Read in the Data object for this HDU.</summary>
        /// <param name="stream">the stream from which the data is read.</param>
        /// <exception cref="FitsException"> FitsException if the Data object could not be created from this HDU's Header</exception>
        public virtual void ReadData(ArrayDataIO stream)
        {
            myData = null;
            try
            {
                myData = ManufactureData();
            }
            finally
            {
                // if we cannot build a Data object, skip this section
                if (myData == null)
                {
                    try
                    {
                        SkipData(stream, myHeader);
                    }
                    catch(Exception)
                    {
                    }
                }
            }

            myData.Read(stream);
        }
Пример #16
0
 /// <summary>Read out the HDU from the data stream.  This
 /// will overwrite any existing header and data components.
 /// </summary>
 public virtual void Read(ArrayDataIO stream)
 {
     myHeader = Header.ReadHeader(stream);
     myData = myHeader.MakeData();
     myData.Read(stream);
 }