-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use CxoTime.linspace on get_aca_images for > 3hour range #181
Conversation
chandra_aca/maude_decom.py
Outdated
return get_aca_packets(start, stop, level0=True, **maude_kwargs) | ||
if CxoTime(stop) - CxoTime(start) > 1 * u.day: | ||
raise ValueError("stop - start cannot be greater than 1 day") | ||
maude_fetch_times = CxoTime.linspace(start, stop, step_max=3.0 * u.hour) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this default configurable by a module constant (equal to 3.0 * u.hour
). Then the test can temporarily set that constant to something short in a little try / finally
context manager.
maude_fetch_times = CxoTime.linspace(start, stop, step_max=3.0 * u.hour) | |
maude_fetch_times = CxoTime.linspace(start, stop, step_max=None) | |
if step_max is None: | |
step_max = MAUDE_FETCH_STEP_MAX |
@@ -1209,24 +1211,36 @@ def _get_aca_packets( | |||
return table | |||
|
|||
|
|||
def get_aca_images(start, stop, **maude_kwargs): | |||
def get_aca_images(start: CxoTimeLike, stop: CxoTimeLike, **kwargs): | |||
""" | |||
Fetch ACA image telemetry | |||
|
|||
Parameters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add documentation about the fetch intervals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't actually know that that meant so I just fluffed out the docstring a bit.
chandra_aca/maude_decom.py
Outdated
) | ||
for i in range(len(maude_fetch_times) - 1) | ||
] | ||
return vstack(packet_stack) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing to confirm is that get_aca_packets
is strict in the output to return items with start <= TIME < stop
. I suspect that is the case but need to be sure.
assert abs(imgs[0]["TIME"] - CxoTime(start).secs) < 2 | ||
assert abs(imgs[-1]["TIME"] - CxoTime(stop).secs) < 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to the previous comment, my understanding is that the TIME
of returned images should be strictly between start
and stop
. Then TIME[0] - start
should be between 0 and 4.1, and similar for TIME[1]
. At least if my understanding is right, but if these tests are passing then I'm not sure.
imgs_start = maude_decom.get_aca_images(start, CxoTime(start) + 60 * u.s) | ||
imgs_stop = maude_decom.get_aca_images(CxoTime(stop) - 60 * u.s, stop) | ||
assert np.all(imgs[0] == imgs_start[0]) | ||
assert np.all(imgs[-1] == imgs_stop[-1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I simplified the PR and removed the code I had to fetch extra time and re-filter the images by TIME. And now this isn't passing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this suggest an upstream sort fix in get_aca_images?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The upstream fix would be to sort by time and slot. That's a question of API / expectations. In the current release the output is (empirically) sorted by [IMGNUM, TIME], so all the slot=0 are first and slot=7 are last. For chunked data this pattern is repeated for each chunk.
Overall I think we don't care as long as the images are sorted by TIME for a given IMGNUM. That is the only ordering that is currently guaranteed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right - though we added sorting on the mica side to be out.sort(keys=["TIME", "IMGNUM"]), so maybe maude_decom.get_aca_images should just do the same for consistency.
Description
Use CxoTime.linspace on get_aca_images for > 3hour range
This is a possible and trivial implementation of @taldcroft 's thought at #174 (comment)
Interface impacts
This allows stop - start > 3 hours for the get_aca_images method.
Testing
This requires cxotime sot/cxotime#44
Unit tests
Independent check of unit tests by [REVIEWER NAME]
Functional tests
Needs more functional testing.