 	}
       
 //      if (psum - lsum < 2500) continue;
-      dim3 grid(48, 3, imgcount);
+      dim3 grid(48, 1, imgcount);
       dim3 block(22, 22, 1);
 
       int base = (grid.y * block.y * grid.x * block.x * block.z);



    float factor = (/*0.01f + 0.99f **/ expf(- gr / (2 * sigmag * sigmag)));
    //factor *= sinc(qx / sigma * 0.5) * sinc(qy / sigma * 0.5);

    //float factor = 1.0f;


  thrust::device_vector<float> dLambdas(BS * NY * NX);
  thrust::device_vector<float> dExpLambdas(NY * NX);
  thrust::device_vector<float> dLogLs(NY * NX);
  thrust::device_vector<float> dIntensity(BS * 1 * 48 * 32 * 32);
  thrust::host_vector<float> hIntensity(BS * 1 * 48 * 32 * 32);
  thrust::device_vector<float> dIntensity2(BS * 1 * 48 * 32 * 32);
  thrust::host_vector<float> hIntensity2(BS * 1 * 48 * 32 * 32);
  thrust::device_vector<int> dpsum(BS);
  thrust::device_vector<float> dlsum(BS);
  thrust::host_vector<long long> hPhc(BS * 3);
