Closed mfitzp closed 9 years ago
I have implemented this in proc_base
because that is where the ps
function is. However, it may make sense to move this into a separate module (as with the baseline, etc.) for clarity. The existing ps
functions could be imported back into proc_base
for compatibility with existing code.
Suggestions for improvements, additional algorithms to implement, etc. are most welcome.
@mfitzp This is a great addition to nmrglue, thanks for making it available. A few comments:
ps_acme
and ps_peak_minima
function could have better names to reflect that they are calculating a score I think making them private would be prudent, _ps_acme_score and ps_peak_minima_score sound good to be.@jjhelmus Thanks for the feedback (and apologies for the coveralls update spam; I got caught rebasing down to a single commit). In the update to the PR I've moved the autophase code into proc_autophase
as autops
and renamed the score functions as suggested _ps_acme_score
etc.
I've fixed the PEP8 issues, though there is some white-space left in calculations for clarity.
At present the algorithms are only tested for 1D spectra but should be possible to adapt for 2D with some thought. Unfortunately I don't have any unphased 2D data (or any, actually) to test with. If you're able to provide some I'll see what I can do!
@mfitzp There are a few examples of 2D data at the nmrglue Google code download page that could be used to develop a 2D version of the autophasing algorithm. In particular the data from the process_pipe_2d example might be a good choice.
I merged in this branch as is, made some minor style changes and added the module to the documentation. Feel free to open a new PR for the 2D work. Thanks again for the contribution.
An initial implementation of automatic phase correction for consideration. This adds a new function to
proc_base
ofautops
, alongside two example phase optimisation (scoring) algorithms: ACME and a naive peak minima approach.Standard algorithms can be selected by name ('acme', 'peak_minima') while custom algorithms can be provided as a function.
A demo notebook is available.