Index: branches/pap/ppSim/src/ppSimSequenceObject.c
===================================================================
--- branches/pap/ppSim/src/ppSimSequenceObject.c	(revision 27708)
+++ branches/pap/ppSim/src/ppSimSequenceObject.c	(revision 28003)
@@ -1,5 +1,5 @@
 # include "ppSimSequence.h"
 
-bool ppSimSequenceObject (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, const char *ppSimCommand, const char *injectCommand) {
+bool ppSimSequenceObject (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, const char *ppSimCommand, const char *injectCommand, psArray *files) {
 
     bool status;
@@ -34,12 +34,12 @@
     // loop over the filters & exposure times
     for (int i = 0; i < filters->n; i++) {
-	    
+	        
 	// offset parameters
 	float dR = psMetadataLookupF32 (&status, sequence, "OFFSET.RA");
 	float dD = psMetadataLookupF32 (&status, sequence, "OFFSET.DEC");
-  
+      
 	int nR = psMetadataLookupS32 (&status, sequence, "OFFSET.NR");
 	int nD = psMetadataLookupS32 (&status, sequence, "OFFSET.ND");
-  
+      
 	// loop over the offset sequence
 	for (int iR = 0; iR < nR; iR++) {
@@ -50,12 +50,12 @@
 		float R = Ro + dR*(iR - 0.5*nR + 0.5) / cos (RAD_DEG*Do) / 3600.0;
 		float D = Do + dD*(iD - 0.5*nD + 0.5) / 3600.0;
-      
+              
 		// dither parameters
 		float dr = psMetadataLookupF32 (&status, sequence, "DITHER.RA");
 		float dd = psMetadataLookupF32 (&status, sequence, "DITHER.DEC");
-  
+          
 		int nr = psMetadataLookupS32 (&status, sequence, "DITHER.NR");
 		int nd = psMetadataLookupS32 (&status, sequence, "DITHER.ND");
-  
+          
 		// loop over the dither sequence
 		for (int ir = 0; ir < nr; ir++) {
@@ -65,5 +65,5 @@
 			float ra = R + dr*(ir - 0.5*nr + 0.5) / cos (RAD_DEG*D) / 3600.0;
 			float dec = D + dd*(id - 0.5*nd + 0.5) / 3600.0;
-	  
+	              
 			// rotation sequence parameters
 			float pos_min   = psMetadataLookupF32 (&status, sequence, "POS_MIN");
@@ -72,8 +72,8 @@
 			assert (pos_delta > 0.0);
 			assert (pos_max >= pos_min);
-	    
+	                
 			// loop over rotation sequence
 			for (float pos = pos_min; pos <= pos_max; pos += pos_delta) {
-	      
+	                  
 			    // define the output filename
 			    psString filename = NULL;
@@ -95,9 +95,9 @@
 			    psStringAppend (&command, " -dec %f", dec);
 			    psStringAppend (&command, " -pa %f", pos);
-                            psStringAppend (&command, " -obs_mode OBJECT.%s", (char *) filters->data[i]);
+			    psStringAppend (&command, " -obs_mode OBJECT.%s", (char *) filters->data[i]);
 
 			    double frnd = psRandomUniform(rng);
 			    float seeing = IQmin + (IQmax - IQmin)*frnd;
-	      
+	                  
 			    psStringAppend (&command, " -seeing %f", seeing);
 
@@ -106,13 +106,17 @@
 			    fprintf (simfile, "%s\n", command);
 			    psFree (command);
-			    
+			                
 			    // define the inject command
 			    // path should be dirname/filename
-			    command = psStringCopy (injectCommand);
-			    psStringAppend (&command, " %s*.fits",    filename);
-			    fprintf (inject, "%s\n", command);
-			    psFree (command);
+			    
+			    // we use the filename above (really the file root) to construct the filenames
+			    for (int i = 0; i < files->n; i++) {
+				command = psStringCopy (injectCommand);
+				psStringAppend (&command, " %s.%s", filename, (char *) files->data[i]);
+				fprintf (inject, "%s\n", command);
+				psFree (command);
+			    }
+
 			    psFree (filename);
-
 			    nImage ++;
 			}
