 	if (hIntensity[k] < minval) minval = hIntensity[k];
 }
 
-      dim3 unigrid(1,1,1);
+/*      dim3 unigrid(1,1,1);
       dim3 uniblock(1,1,1);
       getExpLambdas<<<unigrid, uniblock>>>(dExpLambdas.data().get(), dLogLs.data().get(), maxidx, spherer, psum, lsum, block, grid);
-      expLambdaVals.assign(dExpLambdas.begin(), dExpLambdas.end());
-      logLsVals.assign(dLogLs.begin(), dLogLs.end());
-      expectedLambdas.write(expLambdaVals.data(), H5::PredType::NATIVE_FLOAT, memSpace, expectedLambdaSpace);
-      logLs.write(logLsVals.data(), H5::PredType::NATIVE_FLOAT, memSpace, expectedLambdaSpace);
+      expLambdaVals.assign(dExpLambdas.begin(), dExpLambdas.end());*/
+//      logLsVals.assign(dLogLs.begin(), dLogLs.end());
+//      expectedLambdas.write(expLambdaVals.data(), H5::PredType::NATIVE_FLOAT, memSpace, expectedLambdaSpace);
+//      logLs.write(logLsVals.data(), H5::PredType::NATIVE_FLOAT, memSpace, expectedLambdaSpace);
       //expectedLambdaFile.flush(H5F_SCOPE_LOCAL);
-      hIntensity2.assign(dIntensity2.begin(), dIntensity2.end());
+      //hIntensity2.assign(dIntensity2.begin(), dIntensity2.end());
 	int maxR = maxidx / grid.y / block.y / grid.x / block.x;
 	int maxX = maxidx % block.x;
 	int maxY = (maxidx / (grid.x * block.x)) % block.y;

  __host__ __device__ float getIntensity(const int& data) {
  	float lbase = spherer.dLambdas[data] * spherer.lfactor;
	lbase += spherer.ebase;
	if (lbase < 2e-3) lbase = 2e-3;
  	float intensity = spherer(data) * factor + lbase;

	return intensity;

	}
      
//      if (psum - lsum < 2500) continue;
      dim3 grid(1, 1, 1350);
      dim3 block(32, 32, 1);

      spherer.rfactor = 0.005;
      spherer.roffset = -10;
      spherer.baseoffsetx = NX / 2 - 10 - 29 - 0.5; // good val -10
      spherer.baseoffsety = NY / 2 + 10 - 35 - 0.5; // good val +10
      dPhotons.assign(photonVals.data(), photonVals.data() + NY * NX);
      dLambdas.assign(lambdaVals.data(), lambdaVals.data() + NY * NX);
      
