From 28f36a3aef472d0fed3781fb795a6cd644a16f7f Mon Sep 17 00:00:00 2001 From: Reijo Keskitalo Date: Fri, 3 Jan 2020 15:16:25 -0800 Subject: [PATCH] High cadence scans (#316) * Rewrite CES scanning simulation to support sinc-modulated scanning. FIX a bug in turnaround acceleration. * Update data commit hash * add command line options to enable sinc modulation --- src/toast/todmap/sim_tod.py | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/toast/todmap/sim_tod.py b/src/toast/todmap/sim_tod.py index dc716907c..cad3d766a 100644 --- a/src/toast/todmap/sim_tod.py +++ b/src/toast/todmap/sim_tod.py @@ -789,7 +789,11 @@ def __init__( hwprpm=None, hwpstep=None, hwpsteptime=None, +<<<<<<< HEAD cosecant_modulation=False, +======= + sinc_modulation=False, +>>>>>>> High cadence scans (#316) **kwargs ): if samples < 1: @@ -845,7 +849,11 @@ def __init__( raise RuntimeError("Unknown coordinate system: {}".format(coord)) self._coord = coord self._report_timing = report_timing +<<<<<<< HEAD self._cosecant_modulation = cosecant_modulation +======= + self._sinc_modulation = sinc_modulation +>>>>>>> High cadence scans (#316) self._observer = ephem.Observer() self._observer.lon = self._site_lon @@ -1035,14 +1043,23 @@ def simulate_scan(self, samples): nstep = 10000 azmin, azmax = [self._azmin, self._azmax] +<<<<<<< HEAD if self._cosecant_modulation: # We always simulate a rising cosecant scan and then +======= + if self._sinc_modulation: + # We always simulate a rising sinc scan and then +>>>>>>> High cadence scans (#316) # mirror it if necessary azmin %= np.pi azmax %= np.pi if azmin > azmax: raise RuntimeError( +<<<<<<< HEAD "Cannot scan across zero meridian with cosecant-modulated scan" +======= + "Cannot scan across zero meridian with sinc-modulated scan" +>>>>>>> High cadence scans (#316) ) elif azmax < azmin: azmax += 2 * np.pi @@ -1060,7 +1077,11 @@ def simulate_scan(self, samples): tvec = [] azvec = [] t0 = t +<<<<<<< HEAD if self._cosecant_modulation: +======= + if self._sinc_modulation: +>>>>>>> High cadence scans (#316) t1 = t0 + (np.cos(azmin) - np.cos(azmax)) / base_rate tvec = np.linspace(t0, t1, nstep, endpoint=True) azvec = np.arccos(np.cos(azmin) + base_rate * t0 - base_rate * tvec) @@ -1077,7 +1098,11 @@ def simulate_scan(self, samples): # turnaround t0 = t +<<<<<<< HEAD if self._cosecant_modulation: +======= + if self._sinc_modulation: +>>>>>>> High cadence scans (#316) dazdt = base_rate / np.abs(np.sin(azmax)) else: dazdt = base_rate @@ -1096,7 +1121,11 @@ def simulate_scan(self, samples): tvec = [] azvec = [] t0 = t +<<<<<<< HEAD if self._cosecant_modulation: +======= + if self._sinc_modulation: +>>>>>>> High cadence scans (#316) t1 = t0 + (np.cos(azmin) - np.cos(azmax)) / base_rate tvec = np.linspace(t0, t1, nstep, endpoint=True) azvec = np.arccos(np.cos(azmax) - base_rate * t0 + base_rate * tvec) @@ -1113,7 +1142,11 @@ def simulate_scan(self, samples): # turnaround t0 = t +<<<<<<< HEAD if self._cosecant_modulation: +======= + if self._sinc_modulation: +>>>>>>> High cadence scans (#316) dazdt = base_rate / np.abs(np.sin(azmin)) else: dazdt = base_rate @@ -1138,8 +1171,13 @@ def simulate_scan(self, samples): tmin, tmax = tvec[0], tvec[-1] tdelta = tmax - tmin self._az = np.interp((times - tmin) % tdelta, tvec - tmin, azvec) +<<<<<<< HEAD if self._cosecant_modulation and self._azmin > np.pi: # We always simulate a rising cosecant scan and then +======= + if self._sinc_modulation and self._azmin > np.pi: + # We always simulate a rising sinc scan and then +>>>>>>> High cadence scans (#316) # mirror it if necessary self._az += np.pi ind = np.searchsorted(tvec - tmin, (times - tmin) % tdelta)