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 | 38 | #plantuml |
39 | 39 | httplib2 |
40 | 40 | dataclasses |
41 | +# For YAML Config | |
41 | 42 | pykwalify |
42 | 43 | PyYAML |
44 | +# For SP TAC Assignation | |
43 | 45 | matplotlib |
44 | 46 | numpy |
45 | 47 | # For Celery: |
... | ... | @@ -51,5 +53,15 @@ numpy |
51 | 53 | ##kombu==3.0.37 |
52 | 54 | ##django-celery==3.1.17 |
53 | 55 | |
56 | +# For working with GIT within Python | |
57 | +GitPython | |
58 | + | |
54 | 59 | # For working with date |
55 | -python-dateutil | |
56 | 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 | 69 | \ No newline at end of file | ... | ... |
pyros.py
... | ... | @@ -13,7 +13,7 @@ import sys |
13 | 13 | import time |
14 | 14 | import re |
15 | 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 | 476 | print("Running INSTALL command") |
477 | 477 | print("- packages_only:", packages_only) |
478 | 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 | 483 | #if test_mode(): print("in test mode") |
480 | 484 | # self.execProcess("python3 install/install.py install") |
481 | 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 | 20 | py_pwd = os.getcwd() + "/../.." |
21 | 21 | if (py_pwd not in py_path): |
22 | 22 | (os.sys.path).append(py_pwd) |
23 | -import celme | |
23 | +import guitastro | |
24 | 24 | import report |
25 | 25 | |
26 | 26 | # === Some debug states |
... | ... | @@ -91,11 +91,11 @@ get_ip_address('eth0') |
91 | 91 | |
92 | 92 | # ======================================= |
93 | 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 | 96 | skyobj= {'planet':'Sun'} |
97 | 97 | outputs = ['elev'] |
98 | - target = celme.Target() | |
98 | + target = guitastro.Target() | |
99 | 99 | target.define(skyobj) |
100 | 100 | output0s = ['ra','dec'] |
101 | 101 | results = target.ephem(date,site,output0s) |
... | ... | @@ -226,7 +226,7 @@ while True: |
226 | 226 | meteo_conditions = meteo_conditions +8 |
227 | 227 | |
228 | 228 | # === Json status |
229 | - date = celme.Date("now") | |
229 | + date = guitastro.Date("now") | |
230 | 230 | date_iso_utc = date.iso(); |
231 | 231 | rep = report.Status_json() |
232 | 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 | 19 | |
20 | 20 | #import utils.celme as celme |
21 | 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 | 254 | |
255 | 255 | def _status_new_entity(self, entity_name, theorigin, version_firmware, site, date=""): |
256 | 256 | if date=="": |
257 | - date = (celme.Date("now")).iso() | |
257 | + date = (guitastro.Date("now")).iso() | |
258 | 258 | entity= {'entity_name':entity_name, 'origin':theorigin, 'version_firmware':version_firmware, 'site':site, 'date':date, 'devices':[]} |
259 | 259 | #self._status['statuses'][0]['entities'].append(entity); |
260 | 260 | self._status['entities'].append(entity); |
... | ... | @@ -279,9 +279,9 @@ https://github.com/hjson/hjson-py |
279 | 279 | if indiced == -1: |
280 | 280 | return "" |
281 | 281 | if date_data=="": |
282 | - date_data = (celme.Date("now")).iso() | |
282 | + date_data = (guitastro.Date("now")).iso() | |
283 | 283 | else: |
284 | - date_data = (celme.Date(date_data)).iso() | |
284 | + date_data = (guitastro.Date(date_data)).iso() | |
285 | 285 | dico = {'name':name, 'data_type':data_type, 'value':value, 'unit':unit, 'monitoring_name':monitoring_name, 'comment':comment, 'date_data':date_data} |
286 | 286 | #self._status['statuses'][0]['entities'][indicee]['devices'][indiced]['device_values'].append(dico) |
287 | 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 | 31 | #sys.path.append("../../..") |
32 | 32 | sys.path.append("../../../..") |
33 | 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 | 35 | from src.logpyros import LogPyros |
36 | 36 | |
37 | 37 | #sys.path.append('../..') |
... | ... | @@ -794,10 +794,10 @@ class DeviceController(): |
794 | 794 | def _connect_to_device(self): |
795 | 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 | 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 | 802 | #@override ClientChannel send_data |
803 | 803 | def send_data(self, data:str): |
... | ... | @@ -850,7 +850,7 @@ class DeviceController(): |
850 | 850 | |
851 | 851 | |
852 | 852 | def get_utc_date(self): |
853 | - return celme.Date("now").iso(0) | |
853 | + return guitastro.Date("now").iso(0) | |
854 | 854 | #return celme.Date("now").ymdhms() |
855 | 855 | |
856 | 856 | ... | ... |
src/device_controller/abstract_component/mount.py
... | ... | @@ -18,7 +18,7 @@ import time |
18 | 18 | # from src_socket/client/ |
19 | 19 | sys.path.append("../../../..") |
20 | 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 | 24 | # Local application imports |
... | ... | @@ -212,9 +212,9 @@ class DC_Mount(DeviceController): |
212 | 212 | |
213 | 213 | |
214 | 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 | 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 | 21 | # from src_socket/client/ |
22 | 22 | sys.path.append("../../..") |
23 | 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 | 27 | # Local application imports | ... | ... |
src/logpyros.py
... | ... | @@ -11,7 +11,7 @@ if (py_pwd not in py_path): |
11 | 11 | (os.sys.path).append(py_pwd) |
12 | 12 | |
13 | 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 | 124 | self._date.date(date) |
125 | 125 | jd = self._date.jd() |
126 | 126 | jd0 = math.floor(jd) - self._noon_hour/24 |
127 | - d = celme.Date(jd0) | |
127 | + d = guitastro.Date(jd0) | |
128 | 128 | djd = jd-jd0 |
129 | 129 | # print(f"jd0 = {d.iso()} djd={djd}") |
130 | 130 | if djd>=1: |
... | ... | @@ -132,7 +132,7 @@ class LogPyros: |
132 | 132 | djd = jd-jd0 |
133 | 133 | if djd>=1: |
134 | 134 | jd0 += 1 |
135 | - d = celme.Date(jd0) | |
135 | + d = guitastro.Date(jd0) | |
136 | 136 | night = d.digits(0)[0:8] |
137 | 137 | return night |
138 | 138 | |
... | ... | @@ -142,7 +142,7 @@ class LogPyros: |
142 | 142 | jd_midnight = midnight instant |
143 | 143 | jd_noon1 = next noon |
144 | 144 | """ |
145 | - d = celme.Date(night) | |
145 | + d = guitastro.Date(night) | |
146 | 146 | d_noon0 = d + self._noon_hour/24 |
147 | 147 | jd_noon0 = d_noon0.jd() |
148 | 148 | jd_midnight = jd_noon0 + 0.5 |
... | ... | @@ -456,8 +456,8 @@ class LogPyros: |
456 | 456 | # --- |
457 | 457 | if path_wwwpyros != "": |
458 | 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 | 461 | self._noon_hour = 12 ; # local hour corresponding to the date change |
462 | 462 | self.logtable = None |
463 | 463 | self.nbmax_last_lines = 30 | ... | ... |