-
Notifications
You must be signed in to change notification settings - Fork 14
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
Generalize the search strategy to use a candidate generator #485
Conversation
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 like this, I've requested changes, but I'm not requiring them. I'm willing to approve pending hearing your thoughts on the proposed changes.
src/kbmod/run_search.py
Outdated
@@ -41,7 +42,7 @@ def get_angle_limits(self, config): | |||
ang_max = config["average_angle"] + config["ang_arr"][1] | |||
return [ang_min, ang_max] | |||
|
|||
def do_gpu_search(self, config, search): | |||
def do_gpu_search(self, config, search, strategy): |
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'd also just name this trajectory_generator
, since a user could make a run method (eventually) be a logical loop like:
- sample a grid based generator
- run search, get results
- find most likely velocities/pixels/angles
- resample with a finer grid generator
and now "strategy" becomes an overloaded term.
src/kbmod/run_search.py
Outdated
print(f"Average Angle = {config['average_angle']}") | ||
print(f"Search Angle Limits = {ang_lim}") | ||
print(f"Velocity Limits = {config['v_arr']}") | ||
print(strategy.debug_string()) |
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.
with str
this becomes print(strategy)
. Nothing shameful about using dunder methods in Python.
src/kbmod/run_search.py
Outdated
) | ||
|
||
# Do the actual search. | ||
candidates = strategy.get_candidate_trajectories() |
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.
This, I agree will become a problem in the future where we can't, at least at the moment, be nearly as flexible on the CPP and CUDA side as we'd want. I don't have a good solution for that in my mind yet. We definitely can wrap at least this function in the near future to have a Python-binding that can leverage this flexibility:
https://github.com/dirac-institute/kbmod/blob/main/src/kbmod/search/stack_search.cpp#L193
but we definitely rely on having the Trajectories
realized on the GPU to do the search:
https://github.com/dirac-institute/kbmod/blob/main/src/kbmod/search/kernels.cu#L272
The current proposal is not stopping us here I don't think, it just replaces a method with a list comprehension expression.
We have talked about doing "batch-like" searches before. We just need to figure out how do we create a batch of trajectories, do search, create new batch of traj's, do more search (what happens to results?) and then do that in for loop until the generator says stop. Easy peasy no?
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.
This is where we still need the list generation step. I don't have a good solution for it yet either.
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Remove the hard coded search strategy from C++ and replace it with a generator class in Python that creates a list of trajectories to search out of each pixel.