TEMPy.map_process package

Submodules

TEMPy.map_process.map_filters module

Module with the Filter class.

Filter: Object pointing to map data and holds

a set of methods for filtering MRC format maps.

class Filter(MapInst, copy_=False)

Bases: TEMPy.map_process.process.MapEdit

static apply_filter(ftmap, ftfilter, inplace=False)
butterworth_lowpass(pass_freq)

Lowpass filter with a gaussian function pass_freq : low-pass cutoff frequency [0:0.5]

copy(deep=True)

Copy contents to a new object

fourier_filter(ftfilter, inplace=False, plot=False, plotfile='plot')

Apply lowpass/highpass/bandpass filters in fourier space

ftfilter: filter applied on the fourier grid

fourier_transform()

pythonic FFTs for maps

gauss_bandpass(sigma, center=0.0)

Bandpass filter with a gaussian function sigma : cutoff frequency [0:0.5]

gauss_lowpass(sigma)

Bandpass filter with a gaussian function sigma : cutoff frequency [0:0.5]

get_raps(ftmap, step=0.02)

Get rotationally averaged power spectra from fourier (filtered) map ftmap : fourier map (e.g. with any filter appied) step : frequency shell width [0:0.5]

inv_fourier_transform(ftmap, output_dtype=None, output_shape=None)

Calculate inverse fourier transform

label_patches(contour, prob=0.1, inplace=False)

Remove small isolated densities Arguments:

contour

map threshold

prob

fraction of a size (+-) among all sizes

make_fourier_shell()

For a given grid, make a grid with sampling frequencies in the range (0:0.5) Return:

grid with sampling frequencies

plot_raps(dict_plot, plotfile='plot')
tanh_bandpass(low_cutoff=0.0, high_cutoff=0.5, low_fall=0.1, high_fall=0.1)

Bandpass filter with a hyperbolic tangent function low_cutoff: low frequency cutoff [0:0.5] high-cutoff : high frequency cutoff [0:0.5] fall: determines smoothness of falloff [0-> tophat,1.0-> gaussian] Return:

tanh lowpass filter to apply on fourier map

tanh_lowpass(cutoff, fall=0.5)

Lowpass filter with a hyperbolic tangent function

cutoff: high frequency cutoff [0:0.5] fall: smoothness of falloff [0-> tophat,1.0-> gaussian] Return:

tanh lowpass filter to apply on fourier map

TEMPy.map_process.process module

class MapEdit(mapobject)

Bases: object

apply_mask(mask_array=None, inplace=False)

Mask map with a binary mask.

box_size()

size of the map array, in ZYX format.

box_transform(mat)

Calculate box dimensions after rotation

Arguments:
mat

Input rotation matrix

Return:

new box shape

calculate_map_contour(sigma_factor=1.5)
close()
static compare_tuple(tuple1, tuple2)
copy(deep=True)

Copy contents to a new object

crop_box(contour=None, factor_sigma=0.0, ext=None, inplace=False, nd=3)

Crop a map based on a threshold Arguments:

contour

map threshold

factor_sigma

factor to relax threshold

ext

padding to keep

data_copy()

Copy data (not to modify inplace)

downsample_apix(new_spacing, inplace=False)

Downsample map based on voxel size

static fancy_index_as_slices(values, indices)
find_level(vol)

Get the level corresponding to volume. Arguments:

vol

volume within the contour

Return:

level corresponding to volume

get_sigma_map(window=5)
grid_footprint()

Generate a footprint array for local neighborhood (6 faces)

interpolate_to_grid(new_gridshape, new_spacing, new_origin, inplace=False)

Interpolate to a new map grid given new shape, spacing and origin

make_spherical_footprint(diameter)

Get spherical footprint of a given diameter

map_digitize(contour=None, nbins=10, right=False, inplace=False)
Divide density into bins (store bin indices in grid)
Arguments:
contour

map threshold None by default

nbins

number of bins

right

right closed? False by default

max()
min()
pad_map(nx, ny, nz, inplace=False)

Pad a map (in place) with specified increments along each dimension. Arguments:

nx,ny,nz

Number of slices to pad in each dimension.

Return:

new Map instance

peak_density()

Find background peak and sigma (for values beyond the peak)

Return:

peak, average and sigma (beyond peak)

reinitialize(inplace=False)

Initialize/re-initialize data/header

reinitialize_data(inplace=False)

Initialize or re-initialize data

reinitialize_header()

Initialize or re-initialize header

set_apix_as_tuple()
set_apix_dim(dim)

Set voxel size given dimensions (Angstroms) of Grid

set_apix_tempy()

Set apix to single float value for using TEMPy functions

set_data_header()

Update data and header with current values

set_dim_apix(apix)

Set dimensions (Angstroms) given voxel size

set_newmap_data_header(newmap)

Update data and header with current values

shift_density(offset, inplace=False)

Shift density given an offset

size_patches(contour)
Get sizes or size distribution of isolated densities
Arguments:
contour

map threshold

Return:

array of sizes

std()
threshold_map(contour=0.0, inplace=False)

Threshold map at a given contour.

update_data()

Update data array

update_header()

Update map header records to current values

update_newmap_data(newmap)

Update new map data array

update_newmap_header(newmap)

Update newmap header to current values

x_origin()

x-coordinate of the origin.

x_size()

size of the map array in x direction.

y_origin()

y-coordinate of the origin.

y_size()

size of the map array in y direction.

z_origin()

z-coordinate of the origin.

z_size()

size of the map array in z direction.

exception TEMPyException

Bases: Exception

Custom Exception for TEMPy import

TEMPycheck(func)

Module contents