Commit b89483a94be6ce5a737091202183e043e637d2bf

Authored by Alain Klotz
1 parent f5ef10d6
Exists in master

Add dawnelev for ephemeris of target

docs/source/install_for_dev.rst
@@ -48,7 +48,7 @@ Then, in the Powershell terminal: @@ -48,7 +48,7 @@ Then, in the Powershell terminal:
48 48
49 cd C:\Users\xxx\Documents\guitastro\install 49 cd C:\Users\xxx\Documents\guitastro\install
50 pip install pip-tools --user 50 pip install pip-tools --user
51 - python -m piptools compile requirements.in --user 51 + python -m piptools compile requirements.in --user
52 python -m pip install -r requirements.txt --user 52 python -m pip install -r requirements.txt --user
53 53
54 3. Import guitastro from everywhere 54 3. Import guitastro from everywhere
src/guitastro/ephemeris.py
@@ -1075,7 +1075,8 @@ class Ephemeris(EphemerisException, GuitastroTools): @@ -1075,7 +1075,8 @@ class Ephemeris(EphemerisException, GuitastroTools):
1075 1075
1076 * horizon: An object of the class Horizon of Guitastro that defines the horizon line. 1076 * horizon: An object of the class Horizon of Guitastro that defines the horizon line.
1077 * preference: A string "bestelev" or "immediate" to compute the visibility 1077 * preference: A string "bestelev" or "immediate" to compute the visibility
1078 - * duskelev: A float, the elevation of the Sun defining the start and end of the night. 1078 + * duskelev: A float, the elevation of the Sun defining the start of the night.
  1079 + * dawnelev: A float, the elevation of the Sun defining the end of the night.
1079 * wavelength_nm: A float, the observation wavelength (in nanometers) 1080 * wavelength_nm: A float, the observation wavelength (in nanometers)
1080 * humidity: A float, the relative humidiy (between 0 and 1) 1081 * humidity: A float, the relative humidiy (between 0 and 1)
1081 * distmin_sun: A float to define the minimum angular distance from the Sun (degrees) 1082 * distmin_sun: A float to define the minimum angular distance from the Sun (degrees)
@@ -1145,10 +1146,17 @@ class Ephemeris(EphemerisException, GuitastroTools): @@ -1145,10 +1146,17 @@ class Ephemeris(EphemerisException, GuitastroTools):
1145 preference = kwargs['preference'].lower() 1146 preference = kwargs['preference'].lower()
1146 else: 1147 else:
1147 preference="bestelev" 1148 preference="bestelev"
1148 - if 'duskelev' in kwargs.keys(): 1149 + duskelev= -7
  1150 + dawnelev = duskelev
  1151 + if 'duskelev' in kwargs.keys() and 'dawnelev' not in kwargs.keys():
1149 duskelev = kwargs['duskelev'] 1152 duskelev = kwargs['duskelev']
1150 - else:  
1151 - duskelev = -7 1153 + dawnelev = duskelev
  1154 + elif 'duskelev' not in kwargs.keys() and 'dawnelev' in kwargs.keys():
  1155 + dawnelev = kwargs['dawnelev']
  1156 + duskelev = dawnelev
  1157 + elif 'duskelev' in kwargs.keys() and 'dawnelev' in kwargs.keys():
  1158 + duskelev = kwargs['duskelev']
  1159 + dawnelev = kwargs['dawnelev']
1152 if 'humidity' in kwargs.keys(): 1160 if 'humidity' in kwargs.keys():
1153 rel_humidity = kwargs['humidity'] 1161 rel_humidity = kwargs['humidity']
1154 else: 1162 else:
@@ -1379,6 +1387,7 @@ class Ephemeris(EphemerisException, GuitastroTools): @@ -1379,6 +1387,7 @@ class Ephemeris(EphemerisException, GuitastroTools):
1379 horizons = np.zeros(nsec) 1387 horizons = np.zeros(nsec)
1380 # --- visibility_flag 1388 # --- visibility_flag
1381 kk = 0 1389 kk = 0
  1390 + nsec_midnight = nsec / 2
1382 for alt, az in zip(alts, azs): 1391 for alt, az in zip(alts, azs):
1383 k = int(np.floor(az))%360 1392 k = int(np.floor(az))%360
1384 altmini = hor_elev[k] 1393 altmini = hor_elev[k]
@@ -1386,8 +1395,12 @@ class Ephemeris(EphemerisException, GuitastroTools): @@ -1386,8 +1395,12 @@ class Ephemeris(EphemerisException, GuitastroTools):
1386 if alt < altmini: 1395 if alt < altmini:
1387 visibility_flags[kk] += 1 1396 visibility_flags[kk] += 1
1388 if sunmoon == True: 1397 if sunmoon == True:
1389 - if ephem_sun['alt'][kk] > duskelev:  
1390 - visibility_flags[kk] += 2 1398 + if kk < nsec_midnight:
  1399 + if ephem_sun['alt'][kk] > duskelev:
  1400 + visibility_flags[kk] += 2
  1401 + else:
  1402 + if ephem_sun['alt'][kk] > dawnelev:
  1403 + visibility_flags[kk] += 2
1391 kk += 1 1404 kk += 1
1392 visibility_flags = np.where(distsuns > distmin_sun, visibility_flags, visibility_flags+4) 1405 visibility_flags = np.where(distsuns > distmin_sun, visibility_flags, visibility_flags+4)
1393 visibility_flags = np.where(distmoons > distmin_moon, visibility_flags, visibility_flags+8) 1406 visibility_flags = np.where(distmoons > distmin_moon, visibility_flags, visibility_flags+8)