示例#1
0
        public void TestFitsCopy( /*String[] args*/ )
        {
            String file = "E:\\CSharpFITSIO\\AISCHV3_228_13637_0001_sv09-fd-int.fits" /*args[0]*/;

            Fits f = new Fits(file);
            int i = 0;
            BasicHDU h;

            do
            {
                h = f.ReadHDU();
                if (h != null)
                {
                    if (i == 0)
                    {
                        System.Console.Out.WriteLine("\n\nPrimary header:\n");
                    }
                    else
                    {
                        System.Console.Out.WriteLine("\n\nExtension " + i + ":\n");
                    }
                    i += 1;
                    h.Info();
                }
            } while (h != null);

            BufferedFile bf = new BufferedFile("gbfits3.fits" /*args[1]*/, FileAccess.ReadWrite, FileShare.ReadWrite);
            f.Write(bf);
            bf.Close();
        }
示例#2
0
        public void TestFitsCopy( /*String[] args*/ )
        {
            String file = Path.GetTempFileName();
            File.Copy("..\\..\\testdocs\\ht1.fits", file, true);
            Fits f = new Fits(file);
            int i = 0;
            BasicHDU h;

            do
            {
                h = f.ReadHDU();
                if (h != null)
                {
                    if (i == 0)
                    {
                        System.Console.Out.WriteLine("\n\nPrimary header:\n");
                    }
                    else
                    {
                        System.Console.Out.WriteLine("\n\nExtension " + i + ":\n");
                    }
                    i += 1;
                    h.Info();
                }
            } while (h != null);

            BufferedFile bf = new BufferedFile("gbfits3.fits" /*args[1]*/, FileAccess.ReadWrite, FileShare.ReadWrite);
            f.Write(bf);
            bf.Close();
        }
示例#3
0
        public void TestFits()
        {
            String file = Path.GetTempFileName();
            File.Copy("..\\..\\testdocs\\ht1.fits", file, true);
            Fits f = new Fits(new FileStream(file,FileMode.Open),false);
            // Fits f = new Fits(new FileStream("E:\\CSharpFITSIO\\AISCHV3_228_13637_0001_sv09-fd-int.fits.gz",FileMode.Open),true);
             //Fits f = new Fits(new FileStream("E:\\CSharpFITSIO\\LAB-2.0kms.fits",FileMode.Open),false);
            // Fits f = new Fits("http://skyview.gsfc.nasa.gov/cgi-bin/images?position=180.0%2C8.0&survey=NEAT&pixels=300%2C300&sampler=Clip&size=0.3%2C0.3&projection=Tan&coordinates=J2000.0&return=FITS");
            // Fits f = new Fits(new FileStream("D:\\VOIndia\\Sample FITS files\\Previous\\swift_events.fits",FileMode.Open),false);

              //  String fits = "E:\\CSharpFITSIO\\AISCHV3_228_13637_0001_sv09-fd-int.fits.gz";
              //  Fits f = new Fits(fits);
            Console.Out.WriteLine("FitsReader called.");

            int i = 0;
            BasicHDU h;

            do
            {
                h = f.ReadHDU();
                if (h != null)
                {
                    if (i == 0)
                    {
                        Console.Out.WriteLine("\n\nPrimary header:\n");
                    }
                    else
                    {
                        Console.Out.WriteLine("\n\nExtension " + i + ":\n");
                    }
                    i += 1;
                    h.Info();
                }
            } while (h != null);
        }
示例#4
0
        public void TestFitsCopy(/*String[] args*/)
        {
            String file = Path.GetTempFileName();

            File.Copy("testdocs\\ht1.fits", file, true);
            Fits     f = new Fits(file);
            int      i = 0;
            BasicHDU h;

            do
            {
                h = f.ReadHDU();
                if (h != null)
                {
                    if (i == 0)
                    {
                        System.Console.Out.WriteLine("\n\nPrimary header:\n");
                    }
                    else
                    {
                        System.Console.Out.WriteLine("\n\nExtension " + i + ":\n");
                    }
                    i += 1;
                    h.Info();
                }
            } while (h != null);

            BufferedFile bf = new BufferedFile("gbfits3.fits" /*args[1]*/, FileAccess.ReadWrite, FileShare.ReadWrite);

            f.Write(bf);
            bf.Close();
        }
示例#5
0
        public void test()
        {
            float[][] data = new float[300][];
            for (int i = 0; i < 300; i++)
                data[i] = new float[300];

            for (int i = 0; i < 300; i += 1)
            {
                for (int j = 0; j < 300; j += 1)
                {
                    data[i][j] = 1000 * i + j;
                }
            }

            Fits f = new Fits();

            BufferedFile bf = new BufferedFile("tiler1.fits", FileAccess.ReadWrite, FileShare.ReadWrite);
            f.AddHDU(Fits.MakeHDU(data));

            f.Write(bf);
            bf.Close();

            f = new Fits("tiler1.fits");

            ImageHDU h = (ImageHDU)f.ReadHDU();

            ImageTiler t = h.Tiler;
            doTile("t1", data, t, 200, 200, 50, 50);
            doTile("t2", data, t, 133, 133, 72, 26);

            Object o = h.Data.Kernel;
            doTile("t3", data, t, 200, 200, 50, 50);
            doTile("t4", data, t, 133, 133, 72, 26);
        }
        public void TestFits()
        {
            string filename = TestFileSetup.GetTargetFilename("test.fits");

            using (FileStream fs = new FileStream(filename, FileMode.Open))
            {
                Fits f = new Fits(fs, false);

                Console.Out.WriteLine("FitsReader called.");

                int      i = 0;
                BasicHDU h;

                do
                {
                    h = f.ReadHDU();
                    if (h != null)
                    {
                        if (i == 0)
                        {
                            Console.Out.WriteLine("\n\nPrimary header:\n");
                        }
                        else
                        {
                            Console.Out.WriteLine("\n\nExtension " + i + ":\n");
                        }
                        i += 1;
                        h.Info();
                    }
                } while (h != null);
            }
        }
示例#7
0
        public FitsData(Uri uri, bool isInterleave = false)
        {
            var fitsData = new nom.tam.fits.Fits(uri.OriginalString);

            PrimaryHdu = (ImageHDU)fitsData.ReadHDU();

            if (Axes.Length == 2)
            {
                Channels = 1;
                Width    = Axes[0];
                Height   = Axes[1];
            }
            else if (Axes.Length == 3)
            {
                Channels = Axes[0];
                Width    = Axes[1];
                Height   = Axes[2];
            }

            if (BufferSize > 4294967296)
            {
                throw new NotSupportedException("Image Size greater than 4GB aren't supported.");
            }

            IpcChannelDataType dataType;

            if (BitPix == 8 || BitPix == 16 || BitPix == 32)
            {
                dataType = IpcChannelDataType.UInt;
            }
            else if (BitPix == -32 || BitPix == -64)
            {
                dataType = IpcChannelDataType.Float;
            }
            else
            {
                throw new NotSupportedException("Bitpix field in pix is not 8,16,32,-32 or 64. BitSize " + BitPix + " is an unsupported value.");
            }

            BitsPerPixel  = Math.Abs(BitPix);
            BytesPerPixel = BitsPerPixel / 8;

            IpcPixelFormat = isInterleave ?
                             IpcPixelFormats.GetMatchingFormat(Channels, BitsPerPixel, dataType) :
                             IpcPixelFormats.GetMatchingFormat(1, BitsPerPixel, dataType);

            //Construct header card dictionary.
            foreach (DictionaryEntry card in PrimaryHdu.Header)
            {
                HeaderCardDictionary.Add((HeaderCard)card.Value);
            }
        }
示例#8
0
        public void test()
        {
            float[][] data = new float[300][];
            for (int i = 0; i < 300; i++)
            {
                data[i] = new float[300];
            }

            for (int i = 0; i < 300; i += 1)
            {
                for (int j = 0; j < 300; j += 1)
                {
                    data[i][j] = 1000 * i + j;
                }
            }

            Fits f = null;

            try
            {
                f = new Fits();

                BufferedFile bf = new BufferedFile(TestFileSetup.GetTargetFilename("tiler1.fits"), FileAccess.ReadWrite,
                                                   FileShare.ReadWrite);
                f.AddHDU(Fits.MakeHDU(data));
                f.Write(bf);
                bf.Close();
                bf.Dispose();
                f.Close();

                f = new Fits(TestFileSetup.GetTargetFilename("tiler1.fits"));
                ImageHDU h = (ImageHDU)f.ReadHDU();

                ImageTiler t = h.Tiler;
                doTile("t1", data, t, 200, 200, 50, 50);
                doTile("t2", data, t, 133, 133, 72, 26);

                Object o = h.Data.Kernel;
                doTile("t3", data, t, 200, 200, 50, 50);
                doTile("t4", data, t, 133, 133, 72, 26);
            }
            finally
            {
                if (f != null)
                {
                    f.Close();
                }
            }
        }
示例#9
0
        public void TestFits()
        {
            String file = Path.GetTempFileName();

            File.Copy("testdocs\\ht1.fits", file, true);
            Fits f = new Fits(new FileStream(file, FileMode.Open), false);

            // Fits f = new Fits(new FileStream("E:\\CSharpFITSIO\\AISCHV3_228_13637_0001_sv09-fd-int.fits.gz",FileMode.Open),true);
            //Fits f = new Fits(new FileStream("E:\\CSharpFITSIO\\LAB-2.0kms.fits",FileMode.Open),false);
            // Fits f = new Fits("http://skyview.gsfc.nasa.gov/cgi-bin/images?position=180.0%2C8.0&survey=NEAT&pixels=300%2C300&sampler=Clip&size=0.3%2C0.3&projection=Tan&coordinates=J2000.0&return=FITS");
            // Fits f = new Fits(new FileStream("D:\\VOIndia\\Sample FITS files\\Previous\\swift_events.fits",FileMode.Open),false);

            //  String fits = "E:\\CSharpFITSIO\\AISCHV3_228_13637_0001_sv09-fd-int.fits.gz";
            //  Fits f = new Fits(fits);
            Console.Out.WriteLine("FitsReader called.");

            int      i = 0;
            BasicHDU h;

            do
            {
                h = f.ReadHDU();
                if (h != null)
                {
                    if (i == 0)
                    {
                        Console.Out.WriteLine("\n\nPrimary header:\n");
                    }
                    else
                    {
                        Console.Out.WriteLine("\n\nExtension " + i + ":\n");
                    }
                    i += 1;
                    h.Info();
                }
            } while (h != null);
        }
        public void TestFitsCopy()
        {
            String file = TestFileSetup.GetTargetFilename("test_dup.fits");

            Fits     f = new Fits(file);
            int      i = 0;
            BasicHDU h;

            do
            {
                h = f.ReadHDU();
                if (h != null)
                {
                    if (i == 0)
                    {
                        Console.Out.WriteLine("\n\nPrimary header:\n");
                    }
                    else
                    {
                        Console.Out.WriteLine("\n\nExtension " + i + ":\n");
                    }
                    i += 1;
                    h.Info();
                }
            } while (h != null);

            BufferedFile bf = new BufferedFile(
                TestFileSetup.GetTargetFilename("gbfits3.fits"),
                FileAccess.ReadWrite,
                FileShare.ReadWrite);

            f.Write(bf);
            bf.Close();
            bf.Dispose();
            f.Close();
        }