Commit 6cc7afa4d61a8c35bcb3c3b5c505bcdb2215efb0
1 parent
4290c2cf
Exists in
dev
Adding Guitastro to PyROS (With git clone project on install), replacing all cel…
…me import with guitastro, add guitastro dependencies in requirements.txt
Showing
8 changed files
with
42 additions
and
26 deletions
Show diff stats
install/requirements.txt
@@ -38,8 +38,10 @@ django-debug-toolbar==1.9.1 | @@ -38,8 +38,10 @@ django-debug-toolbar==1.9.1 | ||
38 | #plantuml | 38 | #plantuml |
39 | httplib2 | 39 | httplib2 |
40 | dataclasses | 40 | dataclasses |
41 | +# For YAML Config | ||
41 | pykwalify | 42 | pykwalify |
42 | PyYAML | 43 | PyYAML |
44 | +# For SP TAC Assignation | ||
43 | matplotlib | 45 | matplotlib |
44 | numpy | 46 | numpy |
45 | # For Celery: | 47 | # For Celery: |
@@ -51,5 +53,15 @@ numpy | @@ -51,5 +53,15 @@ numpy | ||
51 | ##kombu==3.0.37 | 53 | ##kombu==3.0.37 |
52 | ##django-celery==3.1.17 | 54 | ##django-celery==3.1.17 |
53 | 55 | ||
56 | +# For working with GIT within Python | ||
57 | +GitPython | ||
58 | + | ||
54 | # For working with date | 59 | # For working with date |
55 | -python-dateutil | ||
56 | \ No newline at end of file | 60 | \ No newline at end of file |
61 | +python-dateutil | ||
62 | + | ||
63 | +# Celme / guitastro packages | ||
64 | +pypylon | ||
65 | +sep | ||
66 | +astroquery | ||
67 | +astroalign | ||
68 | +ccdproc | ||
57 | \ No newline at end of file | 69 | \ No newline at end of file |
pyros.py
@@ -13,7 +13,7 @@ import sys | @@ -13,7 +13,7 @@ import sys | ||
13 | import time | 13 | import time |
14 | import re | 14 | import re |
15 | import glob | 15 | import glob |
16 | - | 16 | +from git import Repo |
17 | 17 | ||
18 | 18 | ||
19 | """ | 19 | """ |
@@ -476,6 +476,10 @@ def install_or_update(UPDATE:bool=False, packages_only:bool=False, database_only | @@ -476,6 +476,10 @@ def install_or_update(UPDATE:bool=False, packages_only:bool=False, database_only | ||
476 | print("Running INSTALL command") | 476 | print("Running INSTALL command") |
477 | print("- packages_only:", packages_only) | 477 | print("- packages_only:", packages_only) |
478 | print("- database_only:", database_only) | 478 | print("- database_only:", database_only) |
479 | + # Git clone Guitastro: | ||
480 | + print("Cloning Guiastro repository") | ||
481 | + cloned_repo = Repo.clone_from("https://gitlab.irap.omp.eu/aklotz/guitastro.git", os.path.join(os.getcwd(),"./src/core/guitastro")) | ||
482 | + print("Cloned successfully: ", cloned_repo.__class__ is Repo) | ||
479 | #if test_mode(): print("in test mode") | 483 | #if test_mode(): print("in test mode") |
480 | # self.execProcess("python3 install/install.py install") | 484 | # self.execProcess("python3 install/install.py install") |
481 | # if (os.path.basename(os.getcwd()) != "private"): | 485 | # if (os.path.basename(os.getcwd()) != "private"): |
src/core/pyros_django/utils/plc/guitalens_observatory/run_goc.py
@@ -20,7 +20,7 @@ py_pwd = os.getcwd() | @@ -20,7 +20,7 @@ py_pwd = os.getcwd() | ||
20 | py_pwd = os.getcwd() + "/../.." | 20 | py_pwd = os.getcwd() + "/../.." |
21 | if (py_pwd not in py_path): | 21 | if (py_pwd not in py_path): |
22 | (os.sys.path).append(py_pwd) | 22 | (os.sys.path).append(py_pwd) |
23 | -import celme | 23 | +import guitastro |
24 | import report | 24 | import report |
25 | 25 | ||
26 | # === Some debug states | 26 | # === Some debug states |
@@ -91,11 +91,11 @@ get_ip_address('eth0') | @@ -91,11 +91,11 @@ get_ip_address('eth0') | ||
91 | 91 | ||
92 | # ======================================= | 92 | # ======================================= |
93 | def get_sunelev(): | 93 | def get_sunelev(): |
94 | - date = celme.Date("now") | ||
95 | - site = celme.Site("GPS 2 E 43 148") | 94 | + date = guitastro.Date("now") |
95 | + site = guitastro.Site("GPS 2 E 43 148") | ||
96 | skyobj= {'planet':'Sun'} | 96 | skyobj= {'planet':'Sun'} |
97 | outputs = ['elev'] | 97 | outputs = ['elev'] |
98 | - target = celme.Target() | 98 | + target = guitastro.Target() |
99 | target.define(skyobj) | 99 | target.define(skyobj) |
100 | output0s = ['ra','dec'] | 100 | output0s = ['ra','dec'] |
101 | results = target.ephem(date,site,output0s) | 101 | results = target.ephem(date,site,output0s) |
@@ -226,7 +226,7 @@ while True: | @@ -226,7 +226,7 @@ while True: | ||
226 | meteo_conditions = meteo_conditions +8 | 226 | meteo_conditions = meteo_conditions +8 |
227 | 227 | ||
228 | # === Json status | 228 | # === Json status |
229 | - date = celme.Date("now") | 229 | + date = guitastro.Date("now") |
230 | date_iso_utc = date.iso(); | 230 | date_iso_utc = date.iso(); |
231 | rep = report.Status_json() | 231 | rep = report.Status_json() |
232 | rep.new_status("PLC","20181014_0854") | 232 | rep.new_status("PLC","20181014_0854") |
src/core/pyros_django/utils/report/status_json.py
@@ -19,7 +19,7 @@ if (py_pwd not in py_path): | @@ -19,7 +19,7 @@ if (py_pwd not in py_path): | ||
19 | 19 | ||
20 | #import utils.celme as celme | 20 | #import utils.celme as celme |
21 | #sys.path.append('..') | 21 | #sys.path.append('..') |
22 | -import src.core.celme as celme | 22 | +import src.core.guitastro as guitastro |
23 | 23 | ||
24 | # ======================================================== | 24 | # ======================================================== |
25 | # ======================================================== | 25 | # ======================================================== |
@@ -254,7 +254,7 @@ https://github.com/hjson/hjson-py | @@ -254,7 +254,7 @@ https://github.com/hjson/hjson-py | ||
254 | 254 | ||
255 | def _status_new_entity(self, entity_name, theorigin, version_firmware, site, date=""): | 255 | def _status_new_entity(self, entity_name, theorigin, version_firmware, site, date=""): |
256 | if date=="": | 256 | if date=="": |
257 | - date = (celme.Date("now")).iso() | 257 | + date = (guitastro.Date("now")).iso() |
258 | entity= {'entity_name':entity_name, 'origin':theorigin, 'version_firmware':version_firmware, 'site':site, 'date':date, 'devices':[]} | 258 | entity= {'entity_name':entity_name, 'origin':theorigin, 'version_firmware':version_firmware, 'site':site, 'date':date, 'devices':[]} |
259 | #self._status['statuses'][0]['entities'].append(entity); | 259 | #self._status['statuses'][0]['entities'].append(entity); |
260 | self._status['entities'].append(entity); | 260 | self._status['entities'].append(entity); |
@@ -279,9 +279,9 @@ https://github.com/hjson/hjson-py | @@ -279,9 +279,9 @@ https://github.com/hjson/hjson-py | ||
279 | if indiced == -1: | 279 | if indiced == -1: |
280 | return "" | 280 | return "" |
281 | if date_data=="": | 281 | if date_data=="": |
282 | - date_data = (celme.Date("now")).iso() | 282 | + date_data = (guitastro.Date("now")).iso() |
283 | else: | 283 | else: |
284 | - date_data = (celme.Date(date_data)).iso() | 284 | + date_data = (guitastro.Date(date_data)).iso() |
285 | dico = {'name':name, 'data_type':data_type, 'value':value, 'unit':unit, 'monitoring_name':monitoring_name, 'comment':comment, 'date_data':date_data} | 285 | dico = {'name':name, 'data_type':data_type, 'value':value, 'unit':unit, 'monitoring_name':monitoring_name, 'comment':comment, 'date_data':date_data} |
286 | #self._status['statuses'][0]['entities'][indicee]['devices'][indiced]['device_values'].append(dico) | 286 | #self._status['statuses'][0]['entities'][indicee]['devices'][indiced]['device_values'].append(dico) |
287 | self._status['entities'][indicee]['devices'][indiced]['device_values'].append(dico) | 287 | self._status['entities'][indicee]['devices'][indiced]['device_values'].append(dico) |
src/device_controller/abstract_component/device_controller.py
@@ -31,7 +31,7 @@ from typing import Dict | @@ -31,7 +31,7 @@ from typing import Dict | ||
31 | #sys.path.append("../../..") | 31 | #sys.path.append("../../..") |
32 | sys.path.append("../../../..") | 32 | sys.path.append("../../../..") |
33 | #import src.core.pyros_django.utils.celme as celme | 33 | #import src.core.pyros_django.utils.celme as celme |
34 | -import src.core.celme as celme | 34 | +import src.core.guitastro as guitastro |
35 | from src.logpyros import LogPyros | 35 | from src.logpyros import LogPyros |
36 | 36 | ||
37 | #sys.path.append('../..') | 37 | #sys.path.append('../..') |
@@ -794,10 +794,10 @@ class DeviceController(): | @@ -794,10 +794,10 @@ class DeviceController(): | ||
794 | def _connect_to_device(self): | 794 | def _connect_to_device(self): |
795 | self._my_channel._connect_to_server() | 795 | self._my_channel._connect_to_server() |
796 | 796 | ||
797 | - def get_celme_longitude(self, longitude): | ||
798 | - return celme.Angle(longitude).sexagesimal("d:+0180.0") | 797 | + def get_guitastro_longitude(self, longitude): |
798 | + return guitastro.Angle(longitude).sexagesimal("d:+0180.0") | ||
799 | def get_celme_latitude(self, latitude): | 799 | def get_celme_latitude(self, latitude): |
800 | - return celme.Angle(latitude).sexagesimal("d:+090.0") | 800 | + return guitastro.Angle(latitude).sexagesimal("d:+090.0") |
801 | 801 | ||
802 | #@override ClientChannel send_data | 802 | #@override ClientChannel send_data |
803 | def send_data(self, data:str): | 803 | def send_data(self, data:str): |
@@ -850,7 +850,7 @@ class DeviceController(): | @@ -850,7 +850,7 @@ class DeviceController(): | ||
850 | 850 | ||
851 | 851 | ||
852 | def get_utc_date(self): | 852 | def get_utc_date(self): |
853 | - return celme.Date("now").iso(0) | 853 | + return guitastro.Date("now").iso(0) |
854 | #return celme.Date("now").ymdhms() | 854 | #return celme.Date("now").ymdhms() |
855 | 855 | ||
856 | 856 |
src/device_controller/abstract_component/mount.py
@@ -18,7 +18,7 @@ import time | @@ -18,7 +18,7 @@ import time | ||
18 | # from src_socket/client/ | 18 | # from src_socket/client/ |
19 | sys.path.append("../../../..") | 19 | sys.path.append("../../../..") |
20 | #import src.core.pyros_django.utils.celme as celme | 20 | #import src.core.pyros_django.utils.celme as celme |
21 | -import src.core.celme as celme | 21 | +import src.core.guitastro as guitastro |
22 | 22 | ||
23 | 23 | ||
24 | # Local application imports | 24 | # Local application imports |
@@ -212,9 +212,9 @@ class DC_Mount(DeviceController): | @@ -212,9 +212,9 @@ class DC_Mount(DeviceController): | ||
212 | 212 | ||
213 | 213 | ||
214 | def get_celme_longitude(self, longitude): | 214 | def get_celme_longitude(self, longitude): |
215 | - return celme.Angle(longitude).sexagesimal("d:+0180.0") | 215 | + return guitastro.Angle(longitude).sexagesimal("d:+0180.0") |
216 | def get_celme_latitude(self, latitude): | 216 | def get_celme_latitude(self, latitude): |
217 | - return celme.Angle(latitude).sexagesimal("d:+090.0") | 217 | + return guitastro.Angle(latitude).sexagesimal("d:+090.0") |
218 | 218 | ||
219 | 219 | ||
220 | 220 |
src/device_controller/abstract_component/plc.py
@@ -21,7 +21,7 @@ sys.path.append("..") | @@ -21,7 +21,7 @@ sys.path.append("..") | ||
21 | # from src_socket/client/ | 21 | # from src_socket/client/ |
22 | sys.path.append("../../..") | 22 | sys.path.append("../../..") |
23 | #import src.core.pyros_django.utils.celme as celme | 23 | #import src.core.pyros_django.utils.celme as celme |
24 | -import src.core.celme as celme | 24 | +import src.core.guitastro as guitastro |
25 | 25 | ||
26 | 26 | ||
27 | # Local application imports | 27 | # Local application imports |
src/logpyros.py
@@ -11,7 +11,7 @@ if (py_pwd not in py_path): | @@ -11,7 +11,7 @@ if (py_pwd not in py_path): | ||
11 | (os.sys.path).append(py_pwd) | 11 | (os.sys.path).append(py_pwd) |
12 | 12 | ||
13 | # --- import PyROS celestial mechanics from the pyros root directory | 13 | # --- import PyROS celestial mechanics from the pyros root directory |
14 | -import src.core.celme as celme | 14 | +import src.core.guitastro as guitastro |
15 | 15 | ||
16 | 16 | ||
17 | ''' | 17 | ''' |
@@ -124,7 +124,7 @@ class LogPyros: | @@ -124,7 +124,7 @@ class LogPyros: | ||
124 | self._date.date(date) | 124 | self._date.date(date) |
125 | jd = self._date.jd() | 125 | jd = self._date.jd() |
126 | jd0 = math.floor(jd) - self._noon_hour/24 | 126 | jd0 = math.floor(jd) - self._noon_hour/24 |
127 | - d = celme.Date(jd0) | 127 | + d = guitastro.Date(jd0) |
128 | djd = jd-jd0 | 128 | djd = jd-jd0 |
129 | # print(f"jd0 = {d.iso()} djd={djd}") | 129 | # print(f"jd0 = {d.iso()} djd={djd}") |
130 | if djd>=1: | 130 | if djd>=1: |
@@ -132,7 +132,7 @@ class LogPyros: | @@ -132,7 +132,7 @@ class LogPyros: | ||
132 | djd = jd-jd0 | 132 | djd = jd-jd0 |
133 | if djd>=1: | 133 | if djd>=1: |
134 | jd0 += 1 | 134 | jd0 += 1 |
135 | - d = celme.Date(jd0) | 135 | + d = guitastro.Date(jd0) |
136 | night = d.digits(0)[0:8] | 136 | night = d.digits(0)[0:8] |
137 | return night | 137 | return night |
138 | 138 | ||
@@ -142,7 +142,7 @@ class LogPyros: | @@ -142,7 +142,7 @@ class LogPyros: | ||
142 | jd_midnight = midnight instant | 142 | jd_midnight = midnight instant |
143 | jd_noon1 = next noon | 143 | jd_noon1 = next noon |
144 | """ | 144 | """ |
145 | - d = celme.Date(night) | 145 | + d = guitastro.Date(night) |
146 | d_noon0 = d + self._noon_hour/24 | 146 | d_noon0 = d + self._noon_hour/24 |
147 | jd_noon0 = d_noon0.jd() | 147 | jd_noon0 = d_noon0.jd() |
148 | jd_midnight = jd_noon0 + 0.5 | 148 | jd_midnight = jd_noon0 + 0.5 |
@@ -456,8 +456,8 @@ class LogPyros: | @@ -456,8 +456,8 @@ class LogPyros: | ||
456 | # --- | 456 | # --- |
457 | if path_wwwpyros != "": | 457 | if path_wwwpyros != "": |
458 | self.path_wwwpyros = path_wwwpyros | 458 | self.path_wwwpyros = path_wwwpyros |
459 | - self._date = celme.Date() | ||
460 | - self._home = celme.Home(home) | 459 | + self._date = guitastro.Date() |
460 | + self._home = guitastro.Home(home) | ||
461 | self._noon_hour = 12 ; # local hour corresponding to the date change | 461 | self._noon_hour = 12 ; # local hour corresponding to the date change |
462 | self.logtable = None | 462 | self.logtable = None |
463 | self.nbmax_last_lines = 30 | 463 | self.nbmax_last_lines = 30 |