Index: trunk/FACT++/src/makedata.cc
===================================================================
--- trunk/FACT++/src/makedata.cc	(revision 17958)
+++ trunk/FACT++/src/makedata.cc	(revision 17959)
@@ -1,3 +1,3 @@
-#include "externals/nova.h"
+#include "externals/Prediction.h"
 
 #include "Database.h"
@@ -97,20 +97,4 @@
     const string fDatabase   = conf.Get<string>("source-database");
 
-    // ------------------ Precalc moon coord ---------------------
-
-    vector<tuple<EquPosn, double, double>> fMoonCoords;
-    vector<EquPosn> fSunCoords;
-
-    for (double h=0; h<1; h+=1./(24*12))
-    {
-        const EquPosn sun  = GetSolarEquCoords(jd+h);
-        const EquPosn moon = GetLunarEquCoords(jd+h, 0.01);
-        const double  disk = GetLunarDisk(jd+h);
-        const double edist = GetLunarEarthDist(jd+h)/384400;
-
-        fMoonCoords.emplace_back(moon, disk, edist);
-        fSunCoords.emplace_back(sun);
-    }
-
     // ------------- Get Sources from databasse ---------------------
 
@@ -137,34 +121,13 @@
             continue;
 
+        const SolarObjects so(jd+h);
+
         // get local position of source
         const HrzPosn hrz = GetHrzFromEqu(pos, jd+h);
 
-        // Get sun and moon properties and
-            const EquPosn  sun   = fSunCoords[i];
-            const EquPosn  moon  = get<0>(fMoonCoords[i]);
-            const double   disk  = get<1>(fMoonCoords[i]);
-            const double   edist = get<2>(fMoonCoords[i]);
-            const HrzPosn  hrzm  = GetHrzFromEqu(moon, jd+h);
-            const ZdAzPosn hrzs  = GetHrzFromEqu(sun,  jd+h);
-
-        // Distance between source and moon
-        const double angle = GetAngularSeparation(moon, pos);
-
-        // Current prediction
-        const double sin_malt  = hrzm.alt<0 ? 0 : sin(hrzm.alt*M_PI/180);
-        const double cos_mdist = cos(angle*M_PI/180);
-        const double sin_szd   = sin(hrzs.zd*M_PI/180);
-
-        const double k0 = pow(disk,      2.63);
-        const double k1 = pow(sin_malt,  0.60);
-        const double k2 = pow(edist,    -2.00);
-        const double k3 = exp(0.67*cos_mdist*cos_mdist*cos_mdist*cos_mdist);
-        const double k4 = exp(-97.8+105.8*sin_szd*sin_szd);
-
-        const double cur = 6.2 + 95.7*k0*k1*k2*k3 + k4;
+        // get current prediction
+        const double cur = FACT::PredictI(so, pos);
 
         // Relative  energy threshold prediction
-        //const double cs = cos((90+hrz.alt)*M_PI/180);
-        //const double ratio = (10.*sqrt(409600.*cs*cs+9009.) + 6400.*cs - 60.)/10.;
         const double ratio = pow(cos((90-hrz.alt)*M_PI/180), -2.664);
 
@@ -190,5 +153,5 @@
 
         if (no_limits || (cur<max_current && 90-hrz.alt<max_zd))
-            cout << angle;
+            cout << GetAngularSeparation(so.fMoonEqu, pos);
         cout << "\n";
     }
