   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++)

		  thrust::tabulate(thrust::device, d_complexSpace.data(), d_complexSpace.data() + FX * FY, reals);
		  cufftExecC2C(plan, d_complexSpace.data().get(), d_complexSpace.data().get(), CUFFT_FORWARD);
		  thrust::transform(thrust::device, d_complexSpace.begin(), d_complexSpace.end(), dPattern.begin(), sqabser);
		  computeintensity<<<grid, block>>>(dIntensity.data().get(), dIntensity2.data().get(), spherer, dpsum.data().get(), dlsum.data().get());
		  hIntensity.assign(dIntensity.begin(), dIntensity.end());
		  hIntensity2.assign(dIntensity2.begin(), dIntensity2.end());
		  for (int k = 0; k < grid.y * block.y * grid.x * block.x * grid.z * block.z; k++)

      spherer.baseoffsety = NY / 2 + 10 - 13 - 0.5; // good val +10
      dPhotons.assign(photonVals.data(), photonVals.data() + imgcount * NY * NX);
      dLambdas.assign(lambdaVals.data(), lambdaVals.data() + imgcount * NY * NX);
      dPhc.assign(hPhc.data(), hPhc.data() + imgcount * 3);

      dlsum.assign(&lsum[0], &lsum[BS]);
      dpsum.assign(&psum[0], &psum[BS]);
