Commit ce4ce3e630936a6ce8ee2ad1a659ad9733e79b52
1 parent
0a1f0e75
Exists in
dev
add duskelev & dawn
Showing
3 changed files
with
23 additions
and
7 deletions
Show diff stats
config/pyros_observatory/general/schemas/schema_observatory-2.0.yml
src/core/pyros_django/obs_config/obsconfig_class.py
... | ... | @@ -10,6 +10,8 @@ import socket |
10 | 10 | from datetime import datetime |
11 | 11 | from pykwalify.errors import PyKwalifyException, SchemaError |
12 | 12 | from pathlib import Path |
13 | +import ast | |
14 | + | |
13 | 15 | |
14 | 16 | sys.path.append(os.environ.get("PROJECT_ROOT_PATH", os.path.join(os.getcwd(),"../../../../"))) |
15 | 17 | from vendor.guitastro.src.guitastro import FileNames, Home |
... | ... | @@ -1242,13 +1244,24 @@ class OBSConfig: |
1242 | 1244 | |
1243 | 1245 | def getDuskElev(self)->float: |
1244 | 1246 | """ |
1245 | - Return duskelev of current unit | |
1247 | + Return dusk_elev of current unit | |
1246 | 1248 | |
1247 | 1249 | Returns: |
1248 | - float: string reprensenting duskelev of unit | |
1250 | + Tuple: string reprensenting dusk_elev of unit | |
1251 | + """ | |
1252 | + dusk_elev = ast.literal_eval(self.get_unit_by_name(self.unit_name).get("dusk_elev")) | |
1253 | + return dusk_elev | |
1254 | + | |
1255 | + def getDawnElev(self)->float: | |
1249 | 1256 | """ |
1250 | - duskelev = float(self.get_unit_by_name(self.unit_name).get("duskelev")) | |
1251 | - return duskelev | |
1257 | + Return dawn_elev of current unit | |
1258 | + | |
1259 | + Returns: | |
1260 | + Tuple: string reprensenting dusk_elev of unit | |
1261 | + """ | |
1262 | + dawn_elev = ast.literal_eval(self.get_unit_by_name(self.unit_name).get("dawn_elev")) | |
1263 | + return dawn_elev | |
1264 | + | |
1252 | 1265 | |
1253 | 1266 | def get_agent_path_data_root(self, agent_name:str, computer_hostname=None) -> str: |
1254 | 1267 | """ | ... | ... |
src/core/pyros_django/seq_submit/validators.py
... | ... | @@ -109,7 +109,7 @@ def check_sequence_validity(seq): |
109 | 109 | guitastro_home = guitastro.Home(home) |
110 | 110 | fn.longitude = guitastro_home.longitude |
111 | 111 | seq.night_id = fn.get_night(seq.start_date.isoformat()[:19]) |
112 | - duskelev = -7 | |
112 | + _, duskelev = config.getDuskElev() | |
113 | 113 | try: |
114 | 114 | # TODO remplacer les none par les fichiers pickle de ephem_sun & ephem_moon |
115 | 115 | # On a besoin de calculer la visibilité de l'objet donc il faut l'ephemeride | ... | ... |