Index: branches/eam_branches/ipp-dev-20210817/ppImage/src/ppImageArguments.c
===================================================================
--- branches/eam_branches/ipp-dev-20210817/ppImage/src/ppImageArguments.c	(revision 41856)
+++ branches/eam_branches/ipp-dev-20210817/ppImage/src/ppImageArguments.c	(revision 41857)
@@ -116,4 +116,5 @@
     pmConfigFileSetsMD (config->arguments, &argc, argv, "FRINGE", "-fringe", "-fringelist");
     pmConfigFileSetsMD (config->arguments, &argc, argv, "LINEARITY", "-linearity", "-linearlist");
+    pmConfigFileSetsMD (config->arguments, &argc, argv, "PATTERN.ROW.AMP", "-pattern-row-amplitude", "-not-defined");
 
     if ((argnum = psArgumentGet(argc, argv, "-burntool"))) {
Index: branches/eam_branches/ipp-dev-20210817/ppImage/src/ppImageDetrendPattern.c
===================================================================
--- branches/eam_branches/ipp-dev-20210817/ppImage/src/ppImageDetrendPattern.c	(revision 41856)
+++ branches/eam_branches/ipp-dev-20210817/ppImage/src/ppImageDetrendPattern.c	(revision 41857)
@@ -31,4 +31,13 @@
     // CELLS in the format:CHIPS metadata table)
 
+    // New 2021 October : During ppImageParseCamera, we have loaded a file identified by
+    // PPIMAGE.PATTERN.ROW.AMP on config->files.  This file contains a collection of FITS
+    // tables, one per chip.  Each table lists the typical bias-drift amplitude for cell,
+    // measured from a collection of dark images.  These values are passed (via
+    // cell->analysis) to pmPatternRow which choosed to apply the correction based on the
+    // ratio of the poisson noise due to the median background (+ read noise) and the
+    // typical amplitude.  Tests show that if the amplitude / noise < 1/6, then the
+    // row-by-row variations are insignificant.
+
     // We also check the chip header for the boolean 'PTRN_ROW' : if this is true, we have
     // already applied this correct to this data, so we simply skip the correction for this
@@ -53,4 +62,10 @@
 	pmFPAfile *input = psMetadataLookupPtr(&status, config->files, "PPIMAGE.INPUT");
 
+	// grab the KH correction file
+	pmFPAfile *PRAfile = psMetadataLookupPtr (NULL, config->files, "PPIMAGE.PATTERN.ROW.AMP");
+	if (!PRAfile) {
+	  psLogMsg("ppImage", PS_LOG_INFO, "Pattern Row Amplitude file not found, applying to all (with limits from ROW.SUBSET) ");
+	}
+	
 	pmFPAview *view = pmFPAviewAlloc(0); // View for local processing
 	*view = *inputView;
@@ -75,4 +90,17 @@
                 continue;
             }
+
+	    // grab the corresponding cell
+	    if (PRAfile) {
+	      pmCell *PRAcell = pmFPAviewThisCell (view, PRAfile->fpa);
+	      psAssert (PRAcell, "found Pattern Row Amplitude file, but not cell?");
+
+	      // find the nominal signal amplitude (check the ghost and/or crosstalk recipe file)
+	      float amplitude = psMetadataLookupF32 (&status, PRAcell->analysis, "PTN.ROW.AMP");
+	      if (!status) amplitude = NAN;
+	    
+	      // put the value on the science cell
+	      psMetadataAddF32 (cell->analysis, PS_LIST_TAIL, "PTN.ROW.AMP", PS_META_REPLACE, "", amplitude);
+	    }
 
             bool doPattern = false;
@@ -280,9 +308,4 @@
 bool ppImageDetrendPatternApplyCell (pmConfig *config, pmFPA *fpa, pmChip *chip, pmCell *cell, pmFPAview *view, ppImageOptions *options) {
   
-    // A very detailed log message. 
-    const char *chipName = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME");
-    const char *cellName = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME");
-    psLogMsg("ppImage", PS_LOG_INFO, "Performing row pattern correction for %s, %s\n", chipName, cellName);
-
     // process each of the readouts
     pmReadout *readout;         // Readout from cell
Index: branches/eam_branches/ipp-dev-20210817/ppImage/src/ppImageParseCamera.c
===================================================================
--- branches/eam_branches/ipp-dev-20210817/ppImage/src/ppImageParseCamera.c	(revision 41856)
+++ branches/eam_branches/ipp-dev-20210817/ppImage/src/ppImageParseCamera.c	(revision 41857)
@@ -181,4 +181,16 @@
             psError (PS_ERR_IO, false, "Can't find a fringe image source");
             return NULL;
+        }
+    }
+
+    if (options->doPatternRow) {
+        if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.PATTERN.ROW.AMP", "PATTERN.ROW.AMP",
+			       PM_FPA_FILE_PATTERN_ROW_AMP, PM_DETREND_TYPE_PATTERN_ROW_AMP)) {
+            psWarning ("Can't find a pattern row amplitude source, will apply to all cells or defined subset");
+	    // an empty or invalid file may have been generated -- we want to skip, not raise an error
+	    pmFPAfile *PRAfile = psMetadataLookupPtr (NULL, config->files, "PPIMAGE.PATTERN.ROW.AMP");
+	    if (PRAfile) {
+	      PRAfile->state |= PM_FPA_STATE_INACTIVE;
+	    }
         }
     }
