Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

As a sanity check I wrote the world's dumbest analysis program, which simply memory maps the data file, loops over all the data, and applies some simple cuts. No indexing, no bining, no smarts. On my 2Ghz amd64 linux machine it took 149ms to analyze the data file.

Code Block
titleMain.java
borderStylesolid

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.FileChannel.MapMode;

/**
 *
 * @author tonyj
 */
public class Main
{
   public static void main(String[] args) throws IOException
   {
      File file = new File(args[0]);
      FileInputStream in = new FileInputStream(file);
      FileChannel channel = in.getChannel();
      ByteBuffer buffer = channel.map(MapMode.READ_ONLY,0,file.length());
      buffer.order(ByteOrder.BIG_ENDIAN);
      final int size = buffer.getInt();
      FloatBuffer floats = buffer.asFloatBuffer();
      
      int nAccept = 0;
      float eCut = (float) Math.exp(4);
      long start = System.currentTimeMillis();
      for (int i=0; i<4*size; i += 4)
      {
         float time = floats.get(i);
         if (time < 20000 || time > 70000) continue;
         float energy = floats.get(i+1);
         if (energy < eCut) continue;
         float rightAscension = floats.get(i+2);
         float declination = floats.get(i+3);
         float dRA = rightAscension-180;
         float dDec = declination-0;
         if (dRA*dRA + dDec*dDec > 15*15) continue;
         nAccept++;
         //System.out.printf("%g %g %g %g\n",time,energy,dRA,dDec);
      }
      long stop = System.currentTimeMillis();
      System.out.println("Elapsed "+(stop-start)+"ms");
      System.out.println("Accepted "+nAccept+"/"+size);
      in.close();
      
   }
   
}
No Format
Elapsed 149ms
Accepted 2716/922782

Image Added

Analysis program and plots are attached.