Package net.ivoa.fits

Examples of net.ivoa.fits.FitsException


   *                if an invalid index was requested.
   */
  public String getColumnFormat(int index) throws FitsException {
    int flds = myHeader.getIntValue("TFIELDS", 0);
    if (index < 0 || index >= flds) {
      throw new FitsException("Bad column index " + index + " (only "
          + flds + " columns)");
    }

    return myHeader.getStringValue("TFORM" + (index + 1)).trim();
  }
View Full Code Here


   *            The random groups data the header should describe.
   */
  public static Header manufactureHeader(Data d) throws FitsException {

    if (d == null) {
      throw new FitsException("Attempt to create null Random Groups data");
    }
    Header h = new Header();
    d.fillHeader(h);
    return h;

View Full Code Here

    int pcount = hdr.getIntValue("PCOUNT", -1);

    if (!hdr.getBooleanValue("GROUPS")
        || hdr.getIntValue("NAXIS1", -1) != 0 || gcount < 0
        || pcount < 0 || hdr.getIntValue("NAXIS") < 2) {
      throw new FitsException("Invalid Random Groups Parameters");
    }

    // Allocate the object.
    Object[][] dataArray;
View Full Code Here

      break;
    case -64:
      baseClass = Double.TYPE;
      break;
    default:
      throw new FitsException("Invalid BITPIX:" + bitpix);
    }

    // Note that we have to invert the order of the axes
    // for the FITS file to get the order in the array we
    // are generating. Also recall that NAXIS1=0, so that
    // we have an 'extra' dimension.

    for (int i = 0; i < ndim; i += 1) {
      long cdim = h.getIntValue("NAXIS" + (i + 2), 0);
      if (cdim < 0) {
        throw new FitsException("Invalid array dimension:" + cdim);
      }
      dims[ndim - i - 1] = (int) cdim;
    }

    Object[] sample = new Object[2];
View Full Code Here

  public static Data encapsulate(Object o) throws FitsException {
    if (o instanceof Object[][]) {
      return new RandomGroupsData((Object[][]) o);
    } else {
      throw new FitsException(
          "Attempt to encapsulate invalid data in Random Group");
    }
  }
View Full Code Here

          retHeader.addValue(CRPIX + (i + 1), crpix - offset[i],
              "WCS reference point coordinate");
        }
      }
    } catch (IOException ioex) {
      throw new FitsException(ioex.toString());
    }
    return ret;
  }
View Full Code Here

    } else if (o instanceof Object[][]) {
      return new BinaryTable((Object[][]) o);
    } else if (o instanceof Object[]) {
      return new BinaryTable((Object[]) o);
    } else {
      throw new FitsException("Unable to encapsulate object of type:"
          + o.getClass().getName() + " as BinaryTable");
    }
  }
View Full Code Here

      myData.write(stream);
    }
    try {
      stream.flush();
    } catch (java.io.IOException e) {
      throw new FitsException("Error flushing at end of HDU: "
          + e.getMessage());
    }
  }
View Full Code Here

    if (rewriteable()) {
      myHeader.rewrite();
      myData.rewrite();
    } else {
      throw new FitsException("Invalid attempt to rewrite HDU");
    }
  }
View Full Code Here

      case BITPIX_INT :
      case BITPIX_FLOAT :
      case BITPIX_DOUBLE :
        break;
      default :
        throw new FitsException("Unknown BITPIX type " + bitpix);
    }

    return bitpix;
  }
View Full Code Here

TOP

Related Classes of net.ivoa.fits.FitsException

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.