Index: trunk/ppImage/src/ppImageDetrendReadout.c
===================================================================
--- trunk/ppImage/src/ppImageDetrendReadout.c	(revision 39501)
+++ trunk/ppImage/src/ppImageDetrendReadout.c	(revision 42340)
@@ -124,4 +124,13 @@
       // psLogMsg ("ppImage", 6, "nonlinear correction: %f sec\n", psTimerMark ("detrend.readout"));
     }
+    // New Non-linearity correction (exclusive of the above)
+    if (options->doNewNonLin) {
+      if (!ppImageDetrendNewNonLinear(input, detview, config)) {
+	psError(PS_ERR_UNKNOWN, false, "Unable to correct Non-Linearity with new version (2023)");
+	psFree(detview);
+	return(false);
+      }
+      // psLogMsg ("ppImage", 6, "nonlinear correction: %f sec\n", psTimerMark ("detrend.readout"));
+    }
 
     // set up the dark and bias
@@ -188,39 +197,4 @@
             psImageUnbin (noiseImage, noiseMap->image, binning);
             psFree (binning);
-	    // Stolen from pmSkySubtract.c
-	    // CZW: Unneeded, as psImageUnbin does the bilinear interpolation?  It still looks blocky. 
-/* 	    psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, RECIPE_NAME); // Recipe */
-/* 	    psAssert(recipe, "Should be there!"); */
-
-/* 	    psS32 xBinFactor = psMetadataLookupS32(NULL,recipe,"NOISE.XBIN"); */
-/* 	    psS32 yBinFactor = psMetadataLookupS32(NULL,recipe,"NOISE.YBIN"); */
-/* 	    psImageInterpolateOptions *interp = psImageInterpolateOptionsAlloc(PS_INTERPOLATE_BILINEAR, */
-/* 									       noiseMap->image, */
-/* 									       NULL, NULL, */
-/* 									       0, 0.0, 0.0, 0, 0, 0.0); */
-/* 	    for (psS32 row = 0; row < input->image->numRows; row++) { */
-/* 	      for (psS32 col = 0; col < input->image->numCols; col++) { */
-/* 		// We calculate the F32 value of the pixel coordinates in the */
-/* 		// binned image and then use a pixel interpolation routine to */
-/* 		// determine the value of the pixel at that location. */
-/* 		psF32 binRowF64 = ((psF32) row) / ((psF32) yBinFactor); */
-/* 		psF32 binColF64 = ((psF32) col) / ((psF32) xBinFactor); */
-/* 		// We add 0.5 to the pixel locations since the pixel */
-/* 		// interpolation routine defines the location of pixel */
-/* 		// (i, j) as (i+0.5, j+0.5). */
-/* 		binRowF64+= 0.5; */
-/* 		binColF64+= 0.5; */
-
-/* 		double binPixel; */
-/* 		if (!psImagePixelInterpolate(&binPixel, NULL, NULL, binColF64, binRowF64, interp)) { */
-/* 		  psError(PS_ERR_UNKNOWN, false, "Unable to interpolate image."); */
-/* 		  psFree(interp); */
-/* 		  psFree(noiseImage); */
-/* 		  return NULL; */
-/* 		} */
-/* 		noiseImage->data.F32[row][col] = binPixel; */
-/* 	      } */
-/* 	    } */
-/* 	    psFree(interp); */
         }
 
