Exemplo n.º 1
0
        public void Delete()
        {
            Fits f = null;

            try
            {
                f = new Fits(TestFileSetup.GetTargetFilename("at1.fits"), FileAccess.ReadWrite);

                TableHDU th = (TableHDU)f.GetHDU(1);
                Assert.AreEqual(50, th.NRows);

                th.DeleteRows(2, 2);
                Assert.AreEqual(48, th.NRows);

                BufferedFile bf = new BufferedFile(TestFileSetup.GetTargetFilename("at1y.fits"), FileAccess.ReadWrite,
                                                   FileShare.ReadWrite);
                f.Write(bf);
                bf.Close();
                bf.Dispose();
                f.Close();

                f  = new Fits(TestFileSetup.GetTargetFilename("at1y.fits"));
                th = (TableHDU)f.GetHDU(1);
                Assert.AreEqual(48, th.NRows);

                Assert.AreEqual(5, th.NCols);
                th.DeleteColumnsIndexZero(3, 2);
                Assert.AreEqual(3, th.NCols);

                th.DeleteColumnsIndexZero(0, 2);
                Assert.AreEqual(1, th.NCols);
                bf = new BufferedFile(TestFileSetup.GetTargetFilename("at1z.fits"), FileAccess.ReadWrite,
                                      FileShare.ReadWrite);

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

                f  = new Fits(TestFileSetup.GetTargetFilename("at1z.fits"));
                th = (TableHDU)f.GetHDU(1);
                Assert.AreEqual(1, th.NCols);
            }
            finally
            {
                if (f != null)
                {
                    f.Close();
                }
            }
        }
Exemplo n.º 2
0
        public void Delete()
        {
            Fits f = new Fits("at1.fits", FileAccess.ReadWrite);

            TableHDU th = (TableHDU)f.GetHDU(1);

            Assertion.AssertEquals("delrBef", 50, th.NRows);

            th.DeleteRows(2, 2);
            Assertion.AssertEquals("delrAft", 48, th.NRows);

            BufferedFile bf = new BufferedFile("at1y.fits", FileAccess.ReadWrite, FileShare.ReadWrite);

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

            f  = new Fits("at1y.fits");
            th = (TableHDU)f.GetHDU(1);
            Assertion.AssertEquals("delrAft2", 48, th.NRows);

            Assertion.AssertEquals("delcBef", 5, th.NCols);
            th.DeleteColumnsIndexZero(3, 2);
            Assertion.AssertEquals("delcAft1", 3, th.NCols);

            th.DeleteColumnsIndexZero(0, 2);
            Assertion.AssertEquals("delcAft2", 1, th.NCols);
            bf = new BufferedFile("at1z.fits", FileAccess.ReadWrite, FileShare.ReadWrite);

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

            f  = new Fits("at1z.fits");
            th = (TableHDU)f.GetHDU(1);
            Assertion.AssertEquals("delcAft3", 1, th.NCols);
            f.Close();
        }
Exemplo n.º 3
0
 public TableHduHandler(TableHDU hdu)
     : base(hdu)
 {
 }