Index: trunk/ippToPsps/src/ippToPsps.c
===================================================================
--- trunk/ippToPsps/src/ippToPsps.c	(revision 29282)
+++ trunk/ippToPsps/src/ippToPsps.c	(revision 29294)
@@ -24,4 +24,15 @@
 extern int ippToPsps_batchDifference(IppToPsps *data);
 
+// Gets uncalibrated instrumental flux from magnitude
+__inline bool ippToPsps_getFlux(const float exposureTime, const float magnitude, float* flux, const float magnitudeErr, float* fluxErr) {
+
+    *flux = powf(10.0, -0.4*magnitude) / exposureTime;
+    if (!isfinite(*flux) || *flux < 0.000001) return false;
+    if (fluxErr) *fluxErr = fabsf((magnitudeErr * *flux)/1.085736);
+      if (fluxErr)    printf("Mag = %03.03f, Flux = %03.03f, Mag err = %03.03f, Flux Err = %03.03f\n", magnitude, *flux, magnitudeErr, *fluxErr);
+
+    return true;
+}
+
 // Destructor
 static void ippToPsps_Destructor(IppToPsps* this) {
@@ -55,5 +66,5 @@
     // save XML document for results
     if (this->resultsXmlDoc) {
-    
+
         xmlSaveFormatFileEnc(this->resultsPath, this->resultsXmlDoc, "UTF-8", 1);
 
@@ -215,7 +226,10 @@
             this->batchType == BATCH_STACK ||
             this->batchType == BATCH_DIFFERENCE ) {
-    
-        if (this->numOfInputFiles < 1) this->exitCode = PS_EXIT_DATA_ERROR;
-        psError(PS_ERR_UNKNOWN, false, "No input files for this batch");
+
+        if (this->numOfInputFiles < 1) {
+
+            this->exitCode = PS_EXIT_DATA_ERROR;
+            psError(PS_ERR_UNKNOWN, false, "No input files for this batch");
+        }
 
     }
