Package nom.tam.fits

Examples of nom.tam.fits.Fits


    @Override
    public void retrieveObservations() throws ObservationReadError,
        InterruptedException {

      try {
        Fits fits = new Fits(getInputStreams().get(0));
        BasicHDU[] hdus = fits.read();
        retrieveKeplerObservations(hdus);
      } catch (FitsException e) {
        throw new ObservationReadError(e.getLocalizedMessage());
      }
    }
View Full Code Here


    @Override
    public void retrieveObservations() throws ObservationReadError,
        InterruptedException {

      try {
        Fits fits = new Fits(getInputStreams().get(0));
        BasicHDU[] hdus = fits.read();
        double jdRef = retrieveJDReference(hdus);
        retrieveObservations(hdus, jdRef);
      } catch (FitsException e) {
        throw new ObservationReadError(e.getLocalizedMessage());
      }
View Full Code Here

                configList.add(getConfig(text, font, fill));
            }
            i++;
        }

        Fits fits = fitsImage.getFits();
        _deleteBinaryTable(fits, extName);
        BinaryTable table = new BinaryTable();
        FitsFactory.setUseAsciiTables(false);
        table.addColumn(typeList.toArray(new String[typeList.size()]));
        table.addColumn(coordList.toArray(new String[coordList.size()]));
        table.addColumn(configList.toArray(new String[configList.size()]));
        BinaryTableHDU hdu = (BinaryTableHDU) Fits.makeHDU(table);
        hdu.getHeader().addValue("EXTNAME", extName, "Contains saved JSkyCat graphics");
        hdu.setColumnName(0, "type", null);
        hdu.setColumnName(1, "coords", null);
        hdu.setColumnName(2, "config", null);
        deleteHDU(extName);
        fits.addHDU(hdu);
        imageDisplay.checkExtensions(true);
    }
View Full Code Here

        if (name != null) {
            // Check for a stored StarTable, which has a corresponding VOTMETA HDU with more info
            String votMetaName = VOTMETA + name.replace(TABLE_SUFFIX, "");
            BasicHDU votMetaHdu = findHDU(fits, votMetaName);
            if (votMetaHdu != null) {
                Fits tmpFits = new Fits();
                tmpFits.addHDU(votMetaHdu);
                tmpFits.addHDU(hdu);
                votMetaHdu.getHeader().removeCard("EXTNAME"); // not expected by FitsPlusTableBuilder
                votMetaHdu.getHeader().removeCard("EXTEND"); // not expected by FitsPlusTableBuilder
                ByteArrayOutputStream os = new ByteArrayOutputStream();
                BufferedDataOutputStream bos = new BufferedDataOutputStream(os);
                tmpFits.write(bos);
                bos.flush();
                // Restore the name that was removed above
                votMetaHdu.getHeader().addValue("EXTNAME", votMetaName, "Table metadata in VOTable format");
                ByteArrayDataSource dataSrc = new ByteArrayDataSource(filename, os.toByteArray());
                bos.close();
View Full Code Here

     * @throws IOException              if there is a problem reading the file
     * @throws IllegalArgumentException if not a FITS table
     */
    public static NavigatorFITSTable getFitsTable(String filename)
            throws FitsException, IOException {
        Fits fits = new Fits(filename);
        fits.read();
        int n = fits.getNumberOfHDUs();
        if (n != 2) {
            throw new IllegalArgumentException(
                    "Wrong file format: Expected FITS file with one table.");
        }
        BasicHDU basicHDU = fits.getHDU(1);
        if (!(basicHDU instanceof TableHDU)) {
            throw new IllegalArgumentException(
                    "Wrong file format: First FITS extension is not a table.");
        }

View Full Code Here

        // Use the StarJava classes to write the FITS table and then copy the HDUs into the FITS image file
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        new FitsPlusTableWriter().writeStarTable(table.getStarTable(), os);
        ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray());
        Fits tableFits = new Fits(is);

        BasicHDU votMetaHdu = tableFits.getHDU(0);
        votMetaHdu.getHeader().addValue("EXTNAME", votMetaName, "Table metadata in VOTable format");

        TableHDU hdu = (TableHDU) tableFits.getHDU(1);
        hdu.getHeader().addValue("EXTNAME", tableName, "Contains saved query results");
        is.close();
        os.close();

        // add the new table (delete existing one, if found)
View Full Code Here

    @SuppressWarnings({"UnusedDeclaration"})
    public FITSImage(SeekableStream input, FITSDecodeParam param, int page) throws IOException, FitsException {
//        _param = param;

        // Create a Fits object from the stream
        _fits = new Fits(input);
        _fits.read();

        // Switch to the specified HDU/extension
        if (_fits.getNumberOfHDUs() > page) {
            setHDU(page);
View Full Code Here

    public FITSImage(String fileOrUrl) throws IOException, FitsException {
        // First try to open the file using the Fits classes, since they
        // work more efficiently with thier own I/O classes (they also handle
        // gzipped FITS files).
        try {
            _fits = new Fits(fileOrUrl);
            _fits.read();
        } catch (Throwable e) { // nom.tam.fits class throws Error in some cases
            // Might be an HCompressed FITS file...
            try {
                _fits = new Fits(new FitsFilterInputStream(_getStream(fileOrUrl)));
                _fits.read();
            } catch (Throwable e2) {
                //e2.printStackTrace();
                if (e instanceof FitsException) {
                    throw (FitsException) e;
View Full Code Here

     */
    public FITSImage(final Object ar) throws IOException, FitsException {
        ImageData data = new ImageData(ar);
        Header header = new Header(data);
        ImageHDU hdu = new ImageHDU(header, data);
        _fits = new Fits();
        _fits.addHDU(hdu);

        // Default to the primary HDU
        setHDU(0);

View Full Code Here

TOP

Related Classes of nom.tam.fits.Fits

Copyright © 2018 www.massapicom. 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.