diff --git a/docs/source/install_for_dev.rst b/docs/source/install_for_dev.rst index e00c97d..772d2cf 100644 --- a/docs/source/install_for_dev.rst +++ b/docs/source/install_for_dev.rst @@ -48,7 +48,7 @@ Then, in the Powershell terminal: cd C:\Users\xxx\Documents\guitastro\install pip install pip-tools --user - python -m piptools compile requirements.in --user + python -m piptools compile requirements.in --user python -m pip install -r requirements.txt --user 3. Import guitastro from everywhere diff --git a/src/guitastro/ephemeris.py b/src/guitastro/ephemeris.py index 6adad99..4f3f7e8 100644 --- a/src/guitastro/ephemeris.py +++ b/src/guitastro/ephemeris.py @@ -1075,7 +1075,8 @@ class Ephemeris(EphemerisException, GuitastroTools): * horizon: An object of the class Horizon of Guitastro that defines the horizon line. * preference: A string "bestelev" or "immediate" to compute the visibility - * duskelev: A float, the elevation of the Sun defining the start and end of the night. + * duskelev: A float, the elevation of the Sun defining the start of the night. + * dawnelev: A float, the elevation of the Sun defining the end of the night. * wavelength_nm: A float, the observation wavelength (in nanometers) * humidity: A float, the relative humidiy (between 0 and 1) * distmin_sun: A float to define the minimum angular distance from the Sun (degrees) @@ -1145,10 +1146,17 @@ class Ephemeris(EphemerisException, GuitastroTools): preference = kwargs['preference'].lower() else: preference="bestelev" - if 'duskelev' in kwargs.keys(): + duskelev= -7 + dawnelev = duskelev + if 'duskelev' in kwargs.keys() and 'dawnelev' not in kwargs.keys(): duskelev = kwargs['duskelev'] - else: - duskelev = -7 + dawnelev = duskelev + elif 'duskelev' not in kwargs.keys() and 'dawnelev' in kwargs.keys(): + dawnelev = kwargs['dawnelev'] + duskelev = dawnelev + elif 'duskelev' in kwargs.keys() and 'dawnelev' in kwargs.keys(): + duskelev = kwargs['duskelev'] + dawnelev = kwargs['dawnelev'] if 'humidity' in kwargs.keys(): rel_humidity = kwargs['humidity'] else: @@ -1379,6 +1387,7 @@ class Ephemeris(EphemerisException, GuitastroTools): horizons = np.zeros(nsec) # --- visibility_flag kk = 0 + nsec_midnight = nsec / 2 for alt, az in zip(alts, azs): k = int(np.floor(az))%360 altmini = hor_elev[k] @@ -1386,8 +1395,12 @@ class Ephemeris(EphemerisException, GuitastroTools): if alt < altmini: visibility_flags[kk] += 1 if sunmoon == True: - if ephem_sun['alt'][kk] > duskelev: - visibility_flags[kk] += 2 + if kk < nsec_midnight: + if ephem_sun['alt'][kk] > duskelev: + visibility_flags[kk] += 2 + else: + if ephem_sun['alt'][kk] > dawnelev: + visibility_flags[kk] += 2 kk += 1 visibility_flags = np.where(distsuns > distmin_sun, visibility_flags, visibility_flags+4) visibility_flags = np.where(distmoons > distmin_moon, visibility_flags, visibility_flags+8) -- libgit2 0.21.2