Examples of BasicHDU


Examples of net.ivoa.fits.hdu.BasicHDU

      return null;
    }

    Data datum = hdr.makeData();
    datum.read(dataStr);
    BasicHDU nextHDU = FitsFactory.HDUFactory(hdr, datum);

    hduList.addElement(nextHDU);
    return nextHDU;
  }
View Full Code Here

Examples of net.ivoa.fits.hdu.BasicHDU

  public BasicHDU getHDU(int n) throws FitsException, IOException {

    int size = getNumberOfHDUs();

    for (int i = size; i <= n; i += 1) {
      BasicHDU hdu;
      hdu = readHDU();
      if (hdu == null) {
        return null;
      }
    }
View Full Code Here

Examples of net.ivoa.fits.hdu.BasicHDU

      throw new FitsException("Attempt to delete non-existent HDU:" + n);
    }
    try {
      hduList.removeElementAt(n);
      if (n == 0 && size > 1) {
        BasicHDU newFirst = (BasicHDU) hduList.elementAt(0);
        if (newFirst.canBePrimary()) {
          newFirst.setPrimaryHDU(true);
        } else {
          insertHDU(BasicHDU.getDummyHDU(), 0);
        }
      }
    } catch (NoSuchElementException e) {
View Full Code Here

Examples of net.ivoa.fits.hdu.BasicHDU

    } else {
      throw new FitsException("Cannot create ArrayDataOutput from class "
          + os.getClass().getName());
    }

    BasicHDU hh;
    for (int i = 0; i < getNumberOfHDUs(); i += 1) {
      try {
        hh = (BasicHDU) hduList.elementAt(i);
        hh.write(obs);
      } catch (ArrayIndexOutOfBoundsException e) {
        e.printStackTrace();
        throw new FitsException("Internal Error: Vector Inconsistency"
            + e);
      }
View Full Code Here

Examples of net.ivoa.fits.hdu.BasicHDU

    bf.flush();
    bf.close();

    // read file
    f = new Fits("bt1.fits");
    BasicHDU hdu;

    f.read();
    for (int i = 0; i < f.getNumberOfHDUs(); i += 1) {
      hdu = f.getHDU(i);
    }
View Full Code Here

Examples of net.ivoa.fits.hdu.BasicHDU

      assertEquals(strings[i], tstr[i].trim());
    }
  }

  public void testTable2() throws Exception {
    BasicHDU hdu = Fits.makeHDU(new Object[]{floats, vf, vs, vd, shorts,
        vbool});
    Fits f = new Fits();
    f.addHDU(hdu);

    BufferedDataOutputStream bdos = new BufferedDataOutputStream(
View Full Code Here

Examples of net.ivoa.fits.hdu.BasicHDU

      x[i][2] = new int[][]{{i, 2 * i}, {3 * i, 4 * i}};
    }

    f = new Fits();
    FitsFactory.setUseAsciiTables(false);
    BasicHDU hdu = Fits.makeHDU(x);
    hdu.toString();
    f.addHDU(hdu);
    bf = new BufferedFile("bt5.fits", "rw");
    f.write(bf);
    bf.close();

View Full Code Here

Examples of net.ivoa.fits.hdu.BasicHDU

    bf.close();

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

    int i = 0;
    BasicHDU h;

    do {
      h = f.readHDU();
      if (h != null) {
        Object[] info = (Object[]) h.getKernel();
        i += 1;
      }
    } while (h != null);

    bf = new BufferedFile("test2.fits", "rw");
View Full Code Here

Examples of net.ivoa.fits.hdu.BasicHDU

    String file = args[0];

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

    f.skipHDU(12);
    i = 12;

    do {
      h = f.readHDU();
      if (h != null) {
        if (i == 0) {
          System.out.println("\n\nPrimary header:\n");
        } else {
          System.out.println("\n\nExtension " + i + ":\n");
        }
        i += 1;
        System.out.println(h.toString());
      }
    } while (h != null);

  }
View Full Code Here

Examples of net.ivoa.fits.hdu.BasicHDU

    Object[][] data = new Object[1][2];
    data[0][0] = pa;
    data[0][1] = fa;

    System.out.println("***** Write header ******");
    BasicHDU hdu = Fits.makeHDU(data);
    Header hdr = hdu.getHeader();
    // Change the number of groups
    hdr.addValue("GCOUNT", 20, "Number of groups");
    hdr.write(bf);

    System.out.println("***** Write data group by group ******");
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.