Analysis of calculations — bornprofiler.analysis

Functions and classes to process the output from the APBS calculations.

class bornprofiler.analysis.AnalyzeElec(*args, **kwargs)[source]

analyze APBS energy profiling results

plot(filename=None, plotter='matplotlib', **kwargs)[source]

Plot Born profile.

plot([filename[,plotter[,kwargs …]]])

Keywords:
filename

name of image file to save the plot in; with plotter = ‘Gnuplot’ only eps files are supported (I think…)

kwargs

other keyword arguments that are passed on to pylab.plot()

class bornprofiler.analysis.AnalyzeElec3D(*args, **kwargs)[source]

analyze APBS energy profiling results

With create=True (default), reads position data from samplepoints file and energies from APBS output files.

With create=False, reads positions and energies from a previous output file.

Grid(delta, **kwargs)[source]

Package the PMF as a gridData.Grid object.

delta should be the original spacing of the points in angstroem.

With a resample_factor, the data are interpolated on a new grid with resample_factor times as many bins as in the original histogram (See gridData.Grid.resample_factor()).

interpolation_order sets the interpolation order for the resampling procedure.

Warning

Interpolating can lead to artifacts in the 3D PMF. If in doubt, do not resample.

histogramdd(delta, fillfac=5)[source]

Histogram PMF on a regular grid.

The spacing delta must be the same or larger than used in Hollow; to be on the safe side, just use the value of grid_spacing (e.g. 2.0 for 2 A). The histogram grid is chosen large enough to encompass all data points.

If delta is bigger than grid_spacing or points are not on a regular grid the values are averaged over each bin.

Points without data are filled with fillfac * max(histogram).

Returns:histogram, edges (same as numpy.histogramdd())
ranges(padding=0)[source]

Returns the range of values in each dimension.

Returns:Array r of shape (2,3): r[0] contains the smallest and r[1] the largest values.
class bornprofiler.analysis.Analyzer(*args, **kwargs)[source]

Base class for analysis

  1. read points
  2. read energy for each point
  3. write data file(s)
  4. optional: plot

Developer note: exporters contains the logic for exporting to various other formats besides plain column/text such as PDB. For additional exporters, add the entries in the local __init__ after calling super(name, self).__init__(*args,**kwargs).

The Born energy W at each point (x,y,z) is stored in data, a (4,N) numpy array:

X,Y,Z,W = data
accumulate()[source]

Read the energy from each datafile and store with the coordinates.

Populates AnalyzeElec.data, a (4,N) array where N is the number of windows.

export(filename=None, format='dx', **kwargs)[source]

Export data to different file format.

The format is deduced from the filename suffix or format. kwargs are set according to the exporter.

dx
histogram on a grid; must provide kwarg delta for the grid spacing.
pdb
write PDB file with an ion for each sample point and the energy as the B-factor. The kwarg ion can be used to set the name/resName in the file (ION is the default).
find_missing_windows()[source]

Return a list of job numbers that have no data corresponding to a point.

read(filename=None)[source]

Read datafile filename (format: x,y,z,W or z,W).

The data are stored in data, a (4,N) array. If only z coordinates are provided then the x and y columns(data[0] and data[1]) are set to 0.

bornprofiler.analysis.get_files(runfile, basedir='.')[source]

Read runfile and return dict with input files and names.