-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e244aa
commit abd0f6e
Showing
10 changed files
with
772 additions
and
499 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,42 @@ | ||
import random | ||
|
||
from astropy.time import Time | ||
import astropy.units as u | ||
|
||
__all__ = [ | ||
"IncrementObstime", | ||
"ObstimeIterator", | ||
] | ||
|
||
|
||
class IncrementObstime: | ||
default_unit = "day" | ||
def __init__(self, start, dt): | ||
self.start = start | ||
self.start = Time(start) | ||
if not isinstance(dt, u.Quantity): | ||
dt = dt * getattr(u, self.default_unit) | ||
self.dt = dt | ||
|
||
def __call__(self, mut_val): | ||
def __call__(self, header_val): | ||
curr = self.start | ||
self.start += self.dt | ||
return curr | ||
return curr.fits | ||
|
||
|
||
class ObstimeIterator: | ||
def __init__(self, obstimes): | ||
self.obstimes = obstimes | ||
def __init__(self, obstimes, **kwargs): | ||
self.obstimes = Time(obstimes, **kwargs) | ||
self.generator = (t for t in obstimes) | ||
|
||
def __call__(self, mut_val): | ||
return next(self.generator) | ||
def __call__(self, header_val): | ||
return Time(next(self.generator)).fits | ||
|
||
|
||
class DitherValue: | ||
def __init__(self, value, dither_range): | ||
self.value = value | ||
self.dither_range = dither_range | ||
|
||
def __call__(self, header_val): | ||
return self.value + random.uniform(self.dither_range) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.