Added extractDX to convert Born output to DX#15
Conversation
orbeckst
left a comment
There was a problem hiding this comment.
I have some code comments. But the main point is that we still have old functionality for this behavior in apbs-bornprofile-analyze3D.py which called the AnalyzeElec3D class
BornProfiler/bornprofiler/analysis.py
Line 278 in 1869d7e
Can you update the old code to use the new approach? This would be the cleanest way to update, especially as we are conceptually not changing the approach — mainly you are increasing the grid size slightly for the loose grid. See if this can be done with the old code or what needs to be changed to accomplish this.
|
|
||
| coord = data[:, 0:3].T | ||
| weight = data[:,3] | ||
| weight = weight |
| # Edge offset for Grid | ||
| offset = grid_int/2.0 | ||
|
|
||
| # For losse edge |
| df = pd.read_csv(filename,delim_whitespace=True) | ||
| df = df.to_numpy() |
There was a problem hiding this comment.
Instead of using pandas, just use the numpy function; pandas isn't a dependency.
(However, if integrated with existing code, you'll already have the data.)
There was a problem hiding this comment.
Also, calling a nump array df is confusing.
| for i, c in enumerate(coord.T): | ||
| xind = get_ind(c[0], xmin, grid_int) | ||
| yind = get_ind(c[1], ymin, grid_int) | ||
| zind = get_ind(c[2], zmin, grid_int) | ||
| grid[xind, yind, zind] = weight[i] |
There was a problem hiding this comment.
You should be able to use np.histogramdd here — this looks very slow.
| def get_ind(x, xmin, xint): | ||
| ind = int((x-xmin)/xint) | ||
| return ind |
There was a problem hiding this comment.
Should not be necessary with histogramdd (or if you really need to this stuff, look at numpy digitize).
| edges_L = [xedge_L, yedge_L, zedge_L] | ||
|
|
||
| # Filling empty points with high value | ||
| filling_value = 2* weight.max() |
There was a problem hiding this comment.
fill_factor should be configurable, default can be fill_factor = 2
| filling_value = 2* weight.max() | |
| filling_value = fill_factor * weight.max() |
Added an analysis script to convert BornProfiler PMF output from dat to DX by filling empty grid with high values and using spline interpolation 3D. The spline interpolation requires GridDataFormats 0.6 or higher, see MDAnalysis/GridDataFormats#84
Example usage:
python apbs-bornprofiler-extractDX.py --input welec_PaNhaP_fine.dat --output PaNhaP_fine 0.5 0.6