Split up refine_time into two functions so the calculation can be called separately
This is mainly a copy/paste to split the refine.py function refine_time into two functions:
- refine_time Does the job of the old refine_time function but calls new function refine_calculate to do the actual refinement calculation.
- refine_calculate Takes an input of the time window and dictionary containing information about the channel needed for refinement (channel, std, min); then outputs the threshold used and refined time.
The reason for this change is that in the future I would like add a plugin to look at speed or order of light falling off PDs. This plugin could then call the function refine_calculate rather than copy/pasting refinement code.
Only change made to logic is on lines 58-60, where now if the refinement has already been done, the previously refined time will be used to center the search window rather than the transition_gps. This will not make a difference for the normal refinement but should speed up future plugins that use the refinement calculation as the search window could be smaller.
Closes #159 (closed)
Other things to consider:
- I don't understand why the threshold would ever be set to the max/ min value of the data if it doesn't cross the threshold as in lines 77-82, would it make more sense to fail the refinement in those cases?
Edited by Camilla Compton