Пример #1
0
 /**
  * this test is only for manual usage with enough memory allocated.
  *
  * @throws Exception
  */
 @Test
 @Ignore
 public void testVeryBigDataFiles() throws Exception {
   Fits f = new Fits();
   ImageData data = new ImageData(new float[50000][50000]);
   Header manufactureHeader = ImageHDU.manufactureHeader(data);
   f.addHDU(FitsFactory.hduFactory(manufactureHeader, data));
   BufferedFile bf = new BufferedFile("target/big.fits", "rw");
   f.write(bf);
   System.out.println(Arrays.toString(ArrayFuncs.getDimensions(f.getHDU(0).getData().getData())));
   f = new Fits("target/big.fits");
   System.out.println(Arrays.toString(ArrayFuncs.getDimensions(f.getHDU(0).getData().getData())));
 }
Пример #2
0
  private Object[] getSampleCols(float base) {

    float[] realCol = new float[50];

    for (int i = 0; i < realCol.length; i += 1) {
      realCol[i] = base * i * i * i + 1;
    }

    int[] intCol = (int[]) ArrayFuncs.convertArray(realCol, int.class);
    long[] longCol = (long[]) ArrayFuncs.convertArray(realCol, long.class);
    double[] doubleCol = (double[]) ArrayFuncs.convertArray(realCol, double.class);

    String[] strCol = new String[realCol.length];

    for (int i = 0; i < realCol.length; i += 1) {
      strCol[i] = "ABC" + String.valueOf(realCol[i]) + "CDE";
    }
    return new Object[] {realCol, intCol, longCol, doubleCol, strCol};
  }
Пример #3
0
  private void prepareData() {

    double[] img = null;
    try {
      Object dataArray = tiler.getTile(new int[] {0, 0}, hdu.getAxes());
      img = (double[]) ArrayFuncs.convertArray(dataArray, double.class);
      data = (float[]) ArrayFuncs.convertArray(img, float.class);
      processingFriendlyData = (double[][]) ArrayFuncs.convertArray(hdu.getKernel(), double.class);
      imageFriendlyData = new double[width * height];
      for (int h = height - 1; h >= 0; h--) {
        for (int w = 0; w < width; w++) {
          imageFriendlyData[h * width + w] = (img[(height - 1 - h) * width + w]);
        }
      }
    } catch (IOException | FitsException e) {
      e.printStackTrace();
    }

    System.out.println(processingFriendlyData.length + ", " + processingFriendlyData[0].length);
  }