]> AND Private Git Repository - predictops.git/blobdiff - predictops/source/ephemeris.py
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
lightgbm is now working
[predictops.git] / predictops / source / ephemeris.py
index 33c0f2d31f2ff26beb7dcced68cc08033c495ea1..e1c07ecfe604de8012715c25a773c2a66fed7bb7 100644 (file)
@@ -1,27 +1,55 @@
+from configparser import ConfigParser
 from datetime import datetime, timedelta
 from datetime import datetime, timedelta
+from logging import getLogger
+from logging.config import fileConfig
+from pathlib import Path
+
 import time
 import calendar
 
 import time
 import calendar
 
+fileConfig((Path.cwd() / 'config') / 'logging.cfg')
+logger = getLogger()
+
 class Ephemeris:
 
 class Ephemeris:
 
-    def __init__(self, start = time.strptime('19960101000000', '%Y%m%d%H%M%S'),
-                 end = datetime.now(), features = []):
-        self._start = start
-        self._end = end
-        self._features = features
+    _start = None
+    _end   = None
+
+    def __init__(self, config_file):
+
+        self._config = ConfigParser()
+        self._config.read(config_file)
+
+        # Collecting ephemeris features
+        self._features = [section for section in self._config
+                              if self._config[section].getboolean('numerical')
+                              or self._config[section].getboolean('categorical')]
 
         self._dated_features = {}
 
 
 
         self._dated_features = {}
 
 
+    @property
+    def start(self):
+        return self._start
+
+    @start.setter
+    def start(self, x):
+        self._start = x
 
 
-    def update(self):
-        pass
 
 
+    @property
+    def end(self):
+        return self._end
+
+    @end.setter
+    def end(self, x):
+        self._end = x
 
 
     @property
     def dated_features(self):
         if self._dated_features == {}:
 
 
     @property
     def dated_features(self):
         if self._dated_features == {}:
+            logger.info("Adding ephemeris features")
             date = self._start
             while date <= self._end:
                 dict_hour = {}
             date = self._start
             while date <= self._end:
                 dict_hour = {}