Index: /trunk/ppImage/src/ppFocusParseCamera.c
===================================================================
--- /trunk/ppImage/src/ppFocusParseCamera.c	(revision 13561)
+++ /trunk/ppImage/src/ppFocusParseCamera.c	(revision 13562)
@@ -25,5 +25,5 @@
     // not all input or output images are used in a given recipe
     if (options->doBias) {
-	if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.BIAS", "BIAS", PM_FPA_FILE_IMAGE)) {
+	if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.BIAS", "BIAS", PM_FPA_FILE_IMAGE, PM_DETREND_TYPE_BIAS)) {
 	    psError (PS_ERR_IO, false, "Can't find a bias image source");
 	    return NULL;
@@ -31,5 +31,5 @@
     }
     if (options->doDark) {
-	if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.DARK", "DARK", PM_FPA_FILE_IMAGE)) {
+	if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.DARK", "DARK", PM_FPA_FILE_IMAGE, PM_DETREND_TYPE_DARK)) {
 	    psError (PS_ERR_IO, false, "Can't find a dark image source");
 	    return NULL;
@@ -37,5 +37,5 @@
     }
     if (options->doMask) {
-	if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.MASK", "MASK", PM_FPA_FILE_MASK)) {
+	if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.MASK", "MASK", PM_FPA_FILE_MASK, PM_DETREND_TYPE_MASK)) {
 	    psError (PS_ERR_IO, false, "Can't find a mask image source");
 	    return NULL;
@@ -43,5 +43,5 @@
     }
     if (options->doFlat) {
-	if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.FLAT", "FLAT", PM_FPA_FILE_IMAGE)) {
+	if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.FLAT", "FLAT", PM_FPA_FILE_IMAGE, PM_DETREND_TYPE_FLAT)) {
 	    psError (PS_ERR_IO, false, "Can't find a shutter image source");
 	    return NULL;
Index: /trunk/ppImage/src/ppImage.h
===================================================================
--- /trunk/ppImage/src/ppImage.h	(revision 13561)
+++ /trunk/ppImage/src/ppImage.h	(revision 13562)
@@ -61,5 +61,5 @@
 void ppFocusDropCamera (pmConfig *config);
 
-bool ppImageDefineFile (pmConfig *config, pmFPA *input, char *filerule, char *argname, pmFPAfileType type);
+bool ppImageDefineFile (pmConfig *config, pmFPA *input, char *filerule, char *argname, pmFPAfileType fileType, pmDetrendType detrendType);
 
 #endif
Index: /trunk/ppImage/src/ppImageDefineFile.c
===================================================================
--- /trunk/ppImage/src/ppImageDefineFile.c	(revision 13561)
+++ /trunk/ppImage/src/ppImageDefineFile.c	(revision 13562)
@@ -5,5 +5,5 @@
 # include "ppImage.h"
 
-bool ppImageDefineFile (pmConfig *config, pmFPA *input, char *filerule, char *argname, pmFPAfileType type) {
+bool ppImageDefineFile (pmConfig *config, pmFPA *input, char *filerule, char *argname, pmFPAfileType fileType, pmDetrendType detrendType) {
 
     bool status;
@@ -17,6 +17,6 @@
     }
     if (file) {
-	if (file->type != type) {
-	    psError(PS_ERR_IO, true, "%s is not of type %s", filerule, pmFPAfileStringFromType (type));
+	if (file->type != fileType) {
+	    psError(PS_ERR_IO, true, "%s is not of type %s", filerule, pmFPAfileStringFromType (fileType));
 	    return false;
 	}
@@ -31,6 +31,6 @@
     }
     if (file) {
-	if (file->type != type) {
-	    psError(PS_ERR_IO, true, "%s is not of type %s", filerule, pmFPAfileStringFromType (type));
+	if (file->type != fileType) {
+	    psError(PS_ERR_IO, true, "%s is not of type %s", filerule, pmFPAfileStringFromType (fileType));
 	    return false;
 	}
@@ -39,12 +39,12 @@
 
     // look for the file to be loaded from the detrend database
-    pmFPAfileDefineFromDetDB (&status, config, filerule, input, type);
+    file = pmFPAfileDefineFromDetDB (&status, config, filerule, input, detrendType);
     if (!status) {
-	psError (PS_ERR_UNKNOWN, false, "failed to load find definition");
+	psError (PS_ERR_UNKNOWN, false, "failed to load file definition");
 	return false;
     }
     if (file) {
-	if (file->type != type) {
-	    psError(PS_ERR_IO, true, "%s is not of type %s", filerule, pmFPAfileStringFromType (type));
+	if (file->type != fileType) {
+	    psError(PS_ERR_IO, true, "%s is not of type %s", filerule, pmFPAfileStringFromType (fileType));
 	    return false;
 	}
Index: /trunk/ppImage/src/ppImageParseCamera.c
===================================================================
--- /trunk/ppImage/src/ppImageParseCamera.c	(revision 13561)
+++ /trunk/ppImage/src/ppImageParseCamera.c	(revision 13562)
@@ -52,5 +52,5 @@
     // not all input or output images are used in a given recipe
     if (options->doBias) {
-	if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.BIAS", "BIAS", PM_FPA_FILE_IMAGE)) {
+	if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.BIAS", "BIAS", PM_FPA_FILE_IMAGE, PM_DETREND_TYPE_BIAS)) {
 	    psError (PS_ERR_IO, false, "Can't find a bias image source");
 	    psFree (options);
@@ -59,5 +59,5 @@
     }
     if (options->doDark) {
-	if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.DARK", "DARK", PM_FPA_FILE_IMAGE)) {
+	if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.DARK", "DARK", PM_FPA_FILE_IMAGE, PM_DETREND_TYPE_DARK)) {
 	    psError (PS_ERR_IO, false, "Can't find a dark image source");
 	    psFree (options);
@@ -66,5 +66,5 @@
     }
     if (options->doMask) {
-	if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.MASK", "MASK", PM_FPA_FILE_MASK)) {
+	if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.MASK", "MASK", PM_FPA_FILE_MASK, PM_DETREND_TYPE_MASK)) {
 	    psError (PS_ERR_IO, false, "Can't find a mask image source");
 	    psFree (options);
@@ -73,5 +73,5 @@
     }
     if (options->doShutter) {
-	if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.SHUTTER", "SHUTTER", PM_FPA_FILE_IMAGE)) {
+	if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.SHUTTER", "SHUTTER", PM_FPA_FILE_IMAGE, PM_DETREND_TYPE_SHUTTER)) {
 	    psError (PS_ERR_IO, false, "Can't find a flat image source");
 	    psFree (options);
@@ -81,5 +81,5 @@
 
     if (options->doFlat) {
-	if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.FLAT", "FLAT", PM_FPA_FILE_IMAGE)) {
+	if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.FLAT", "FLAT", PM_FPA_FILE_IMAGE, PM_DETREND_TYPE_FLAT)) {
 	    psError (PS_ERR_IO, false, "Can't find a shutter image source");
 	    psFree (options);
@@ -136,5 +136,5 @@
 skip_fringe:
     if (options->doFringe) {
-	if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.FRINGE", "FRINGE", PM_FPA_FILE_FRINGE)) {
+	if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.FRINGE", "FRINGE", PM_FPA_FILE_FRINGE, PM_DETREND_TYPE_FRINGE_IMAGE)) {
 	    psError (PS_ERR_IO, false, "Can't find a fringe image source");
 	    return NULL;
