From eb6644de1abd7b187638d31a203dbf94db4f6bdc Mon Sep 17 00:00:00 2001 From: dpesce Date: Mon, 11 Mar 2024 17:12:44 -0400 Subject: [PATCH] fix bug with space dish and nighttime obs --- ngehtsim/obs/obs_generator.py | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/ngehtsim/obs/obs_generator.py b/ngehtsim/obs/obs_generator.py index dc05346e5..4051c2610 100755 --- a/ngehtsim/obs/obs_generator.py +++ b/ngehtsim/obs/obs_generator.py @@ -687,23 +687,24 @@ def observe(self, input_model, addnoise=True, addgains=True, gainamp=0.04, opaci # flag the daytime observations, if desired if flagday: - - # get location of this site - lon = const.known_longitudes[site] - lat = const.known_latitudes[site] - elev = const.known_elevations[site] - location = EarthLocation.from_geodetic(lon,lat,height=elev) - - # get the altitude of the Sun over time - jd = obs.mjd + 2400000.5 + (times/24.0) - timehere = Time(jd, format='jd') - altazframe = AltAz(obstime=timehere, location=location) - sun_altaz = get_sun(timehere).transform_to(altazframe) - alt = sun_altaz.alt.value - - # mark as to-be-flagged all times for which the Sun is above the horizon - ind_daytime = (((t1 == site) | (t2 == site)) & (sun_altaz.alt.value > 0.0)) - uptime_mask[ind_daytime] = False + if site != 'space': + + # get location of this site + lon = const.known_longitudes[site] + lat = const.known_latitudes[site] + elev = const.known_elevations[site] + location = EarthLocation.from_geodetic(lon,lat,height=elev) + + # get the altitude of the Sun over time + jd = obs.mjd + 2400000.5 + (times/24.0) + timehere = Time(jd, format='jd') + altazframe = AltAz(obstime=timehere, location=location) + sun_altaz = get_sun(timehere).transform_to(altazframe) + alt = sun_altaz.alt.value + + # mark as to-be-flagged all times for which the Sun is above the horizon + ind_daytime = (((t1 == site) | (t2 == site)) & (sun_altaz.alt.value > 0.0)) + uptime_mask[ind_daytime] = False # flag the times that fall outside of the specified station uptime window if site in list(self.station_uptimes.keys()):