   int rc = 0;
   for (int img = 0; img < fullsize[0]; img+=BS, rc++)
     {
-      if (rc % 12 != tid) continue;
+      if (rc % 64 != tid) continue;
       int end = min((int) fullsize[0], img + BS);
 	int imgcount = end - img;
 	count[0] = imgcount;
       offset[0] = img;
+      phccount[0] = imgcount;
+      phcoffset[0] = img;
       lambdaSpace.selectHyperslab(H5S_SELECT_SET, count, offset);
       memSpace.selectHyperslab(H5S_SELECT_SET, count, zerooffset);
 //      expectedLambdaSpace.selectHyperslab(H5S_SELECT_SET, count, offset);
       photonSpace.selectHyperslab(H5S_SELECT_SET, count, offset);
+      phcMemSpace.selectHyperslab(H5S_SELECT_SET, phccount, zerooffset);
+      phcSpace.selectHyperslab(H5S_SELECT_SET, phccount, phcoffset);
       lambdas.read(lambdaVals.data(), H5::PredType::NATIVE_FLOAT, memSpace, lambdaSpace);
+      
       if (img == 0)
       {
 	lambdaValsZero = lambdaVals;
       }     
       photons.read(photonVals.data(), H5::PredType::NATIVE_SHORT, memSpace, photonSpace);
+      phcframe.read(hPhc.data(), H5::PredType::NATIVE_INT64, phcMemSpace, phcSpace);
+      fprintf(stderr, "%lld %lld %lld\n", hPhc[0], hPhc[1], hPhc[2]);
       int psum[BS] = {0};
       float lsum[BS] = {0};
       for (int j = 0; j < imgcount; j++)

  myspherer.dLambdas = &myspherer.dLambdas[zval * NY * NX];
  //myspherer.lfactor = 0.25 / sqrt(lsum) * (((int) bx 0)) + 1.0;
//  myspherer.lfactor =  1.00 * pow(1.1f, -1.f + bx * 2.f);
//  myspherer.ebase = (0 + bx) * 1e-4;
  myspherer.ebase = -lsum[zval] * (myspherer.lfactor - 1) / 46215;
  myspherer.ebase = 0;

//  logLsSpace.selectHyperslab(H5S_SELECT_SET, count, offset);
  photonSpace.selectHyperslab(H5S_SELECT_SET, count, offset);
  H5::DataSpace memSpace(3, count);
  H5::DataSpace phcMemSpace(2, phccount);

  boost::multi_array<float, 3> lambdaVals(extents[BS][NY][NX]);
  boost::multi_array<float, 3> lambdaValsZero(extents[BS][NY][NX]);
