Skip to content

Commit

Permalink
Refactor TOD base class to not provide implementations for internal m…
Browse files Browse the repository at this point in the history
…ethods. Split that functionality out into a TODCache class. Also add position and velocity methods to the TOD API. Closes #28 and #32.
  • Loading branch information
tskisner committed May 3, 2016
1 parent f979063 commit 3279ef6
Show file tree
Hide file tree
Showing 3 changed files with 350 additions and 82 deletions.
2 changes: 1 addition & 1 deletion tests/test_tod.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def setUp(self):
self.mynsamp = 10
self.myoff = self.mynsamp * self.comm.rank
self.totsamp = self.mynsamp * self.comm.size
self.tod = TOD(mpicomm=self.comm, timedist=True, detectors=self.dets, samples=self.totsamp)
self.tod = TODCache(mpicomm=self.comm, timedist=True, detectors=self.dets, samples=self.totsamp)
self.rms = 10.0
self.pntgvec = np.ravel(np.random.random((self.mynsamp, 4))).reshape(-1,4)
self.pflagvec = np.random.uniform(low=0, high=1, size=self.mynsamp).astype(np.uint8, copy=True)
Expand Down
38 changes: 38 additions & 0 deletions toast/tod/sim_tod.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,25 @@ def _put_pntg(self, detector, start, data):
return


def _get_position(self, start, n):
return np.zeros((n,3), dtype=np.float64)


def _put_position(self, start, pos):
raise RuntimeError('cannot write data to simulated position')
return


def _get_velocity(self, start, n):
return np.zeros((n,3), dtype=np.float64)


def _put_velocity(self, start, vel):
raise RuntimeError('cannot write data to simulated velocity')
return



class TODSatellite(TOD):
"""
Provide a simple generator of satellite detector pointing.
Expand Down Expand Up @@ -459,3 +478,22 @@ def _put_pntg(self, detector, start, data):
raise RuntimeError('cannot write data to simulated pointing')
return


def _get_position(self, start, n):
return np.zeros((n,3), dtype=np.float64)


def _put_position(self, start, pos):
raise RuntimeError('cannot write data to simulated position')
return


def _get_velocity(self, start, n):
return np.zeros((n,3), dtype=np.float64)


def _put_velocity(self, start, vel):
raise RuntimeError('cannot write data to simulated velocity')
return


Loading

0 comments on commit 3279ef6

Please sign in to comment.