 	    }
 	}
       
-      if (psum - lsum < 2500) continue;
-      dim3 grid(1, 1, 1250);
-      dim3 block(32, 32, 1);
+//      if (psum - lsum < 2500) continue;
+      dim3 grid(32, 1, 1350);
+      dim3 block(11, 16, 1);
 
       spherer.rfactor = 0.005;
       spherer.roffset = -10;
-      spherer.baseoffsetx = NX / 2 - 10 - 51 - 0.5; // good val -10
-      spherer.baseoffsety = NY / 2 + 10 - 19 - 0.5; // good val +10
+      spherer.baseoffsetx = NX / 2 - 10 - 9 - 0.5; // good val -10
+      spherer.baseoffsety = NY / 2 + 10 - 9 - 0.5; // good val +10
       dPhotons.assign(photonVals.data(), photonVals.data() + NY * NX);
       dLambdas.assign(lambdaVals.data(), lambdaVals.data() + NY * NX);
       

intens[idx] = 0;*/
intensityfactor = 1e-13;
}
  intensityfactor *= pow(1.2, /*by*/ - 0 * 0.5);
  likelihood likelihooder(myspherer, intensityfactor);

  return likelihooder;

  myspherer.offsety = (ty * 2 + myspherer.baseoffsety);
  myspherer.extrax = bx;
  myspherer.extray = by;
  //myspherer.lfactor = 0.25 / sqrt(lsum) * (((int) bx 0)) + 1.0;
  myspherer.lfactor = pow(1.04, bx - 24 * 0.5); 
//  myspherer.ebase = (0 + bx) * 1e-4;
  myspherer.ebase = -lsum * (myspherer.lfactor - 1) / 46215;
  myspherer.ebase = 0;
//    myspherer.lfactor = 1.0;

  float intensity = thrust::reduce(thrust::seq,
