예제 #1
0
 public void test() throws Exception {
   int o = 8;
   for (int i = 0; i < HealpixProc.order2Npix(o); ++i) {
     assertEquals(
         "pixel mismatch_nest", i, HealpixProc.ang2pixNest(o, HealpixProc.pix2angNest(o, i)));
     assertEquals(
         "pixel mismatch_nest", i, HealpixProc.vec2pixNest(o, HealpixProc.pix2vecNest(o, i)));
     assertEquals(
         "pixel mismatch_ring", i, HealpixProc.ang2pixRing(o, HealpixProc.pix2angRing(o, i)));
     assertEquals(
         "pixel mismatch_ring", i, HealpixProc.vec2pixRing(o, HealpixProc.pix2vecRing(o, i)));
     assertEquals(
         "pixel mismatch",
         i,
         HealpixProc.ring2nest(o, HealpixProc.ang2pixRing(o, HealpixProc.pix2angNest(o, i))));
     assertEquals(
         "pixel mismatch_ringnestring", i, HealpixProc.ring2nest(o, HealpixProc.nest2ring(o, i)));
   }
 }
예제 #2
0
  public void test_ringnestring() throws Exception {
    System.out.println("Testing identity ring2nest(nest2ring(i))==i");
    Random rng = new Random(5);

    for (int o = 0; o <= HealpixBase.order_max; ++o) {
      for (int m = 0; m < nsamples; ++m) {
        long pix = (long) (rng.nextDouble() * HealpixProc.order2Npix(o));
        assertEquals(
            "ringnestring problem", HealpixProc.ring2nest(o, HealpixProc.nest2ring(o, pix)), pix);
      }
    }
  }
예제 #3
0
 public void test_neighbours() throws Exception {
   System.out.println("Testing neighbour function");
   int omax = HealpixBase.order_max;
   Random rng = new Random(5);
   for (int o = 0; o <= omax; ++o) {
     double maxang = 2.01 * HealpixProc.maxPixrad(o);
     for (int m = 0; m < nsamples; ++m) {
       long pix = (long) (rng.nextDouble() * HealpixProc.order2Npix(o));
       Vec3 v = HealpixProc.pix2vecRing(o, pix);
       long[] nb = HealpixProc.neighboursRing(o, pix);
       long[] nb2 = HealpixProc.neighboursNest(o, HealpixProc.ring2nest(o, pix));
       int nnb = 0;
       for (int n = 0; n < 8; ++n) {
         if (nb[n] < 0) assertTrue("neighbour problem 1", nb2[n] < 0);
         else {
           ++nnb;
           assertEquals("neighbour problem 2", HealpixProc.ring2nest(o, nb[n]), nb2[n]);
           assertTrue("neighbour problem 3", HealpixProc.pix2vecRing(o, nb[n]).angle(v) < maxang);
         }
       }
       assertTrue("neighbour problem 4 " + o + " " + nnb, (nnb >= 7) || ((o == 0) && (nnb >= 6)));
     }
   }
 }