Skip to content

Commit

Permalink
High cadence scans (#316)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
keskitalo committed Apr 8, 2020
1 parent 537475c commit 65fb59e
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/toast/todmap/sim_tod.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 65fb59e

Please sign in to comment.