Commit b89483a94be6ce5a737091202183e043e637d2bf
1 parent
f5ef10d6
Exists in
master
Add dawnelev for ephemeris of target
Showing
2 changed files
with
20 additions
and
7 deletions
Show diff stats
docs/source/install_for_dev.rst
... | ... | @@ -48,7 +48,7 @@ Then, in the Powershell terminal: |
48 | 48 | |
49 | 49 | cd C:\Users\xxx\Documents\guitastro\install |
50 | 50 | pip install pip-tools --user |
51 | - python -m piptools compile requirements.in --user | |
51 | + python -m piptools compile requirements.in --user | |
52 | 52 | python -m pip install -r requirements.txt --user |
53 | 53 | |
54 | 54 | 3. Import guitastro from everywhere | ... | ... |
src/guitastro/ephemeris.py
... | ... | @@ -1075,7 +1075,8 @@ class Ephemeris(EphemerisException, GuitastroTools): |
1075 | 1075 | |
1076 | 1076 | * horizon: An object of the class Horizon of Guitastro that defines the horizon line. |
1077 | 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 | 1080 | * wavelength_nm: A float, the observation wavelength (in nanometers) |
1080 | 1081 | * humidity: A float, the relative humidiy (between 0 and 1) |
1081 | 1082 | * distmin_sun: A float to define the minimum angular distance from the Sun (degrees) |
... | ... | @@ -1145,10 +1146,17 @@ class Ephemeris(EphemerisException, GuitastroTools): |
1145 | 1146 | preference = kwargs['preference'].lower() |
1146 | 1147 | else: |
1147 | 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 | 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 | 1160 | if 'humidity' in kwargs.keys(): |
1153 | 1161 | rel_humidity = kwargs['humidity'] |
1154 | 1162 | else: |
... | ... | @@ -1379,6 +1387,7 @@ class Ephemeris(EphemerisException, GuitastroTools): |
1379 | 1387 | horizons = np.zeros(nsec) |
1380 | 1388 | # --- visibility_flag |
1381 | 1389 | kk = 0 |
1390 | + nsec_midnight = nsec / 2 | |
1382 | 1391 | for alt, az in zip(alts, azs): |
1383 | 1392 | k = int(np.floor(az))%360 |
1384 | 1393 | altmini = hor_elev[k] |
... | ... | @@ -1386,8 +1395,12 @@ class Ephemeris(EphemerisException, GuitastroTools): |
1386 | 1395 | if alt < altmini: |
1387 | 1396 | visibility_flags[kk] += 1 |
1388 | 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 | 1404 | kk += 1 |
1392 | 1405 | visibility_flags = np.where(distsuns > distmin_sun, visibility_flags, visibility_flags+4) |
1393 | 1406 | visibility_flags = np.where(distmoons > distmin_moon, visibility_flags, visibility_flags+8) | ... | ... |