Structure.to_volume#
- Structure.to_volume(shape=None, sampling_rate=None, origin=None, chain=None, weight_type='atomic_weight', weight_type_args={})[source]#
Maps class instance to a volume.
- Parameters:
- shapetuple of ints, optional
Output array shape in (z,y,x) form.
- sampling_ratetuple of float, optional
Sampling rate of the output array in units of
Structure.atom_coordinate
- origintuple of floats, optional
Origin of the coordinate system in (z,y,x) form.
- chainstr, optional
Chains to be included. Either single or comma separated string of chains. Defaults to None which returns all chains.
- weight_typestr, optional
Weight given to individual atoms. Supported weights are:
atomic_weight
Using element weight point mass
atomic_number
Using atomic number point mass
gaussian
Using element weighted Gaussian mass
van_der_waals_radius
Using binary van der waal spheres
scattering_factors
Using experimental scattering factors
lowpass_scattering_factors
Lowpass filtered scattering_factors
- weight_type_argsdict, optional
Additional arguments used for individual weight_types. gaussian accepts
resolution
, scattering acceptsmethod
.
- Returns:
- Tuple[NDArray, NDArray, NDArray]
Volume, origin and sampling_rate.
Examples
>>> from importlib_resources import files >>> from tme import Structure >>> fname = str(files("tests.data").joinpath("Structures/5khe.cif")) >>> structure = Structure.from_file(filename=fname) >>> vol, origin, sampling = structure.to_volume() >>> vol.shape, origin, sampling ((59, 35, 53), array([-30.71, 12.42, -27.15]), array([1., 1., 1.])) >>> vol, origin, sampling = structure.to_volume(sampling_rate=(2.2,1,3)) ((27, 35, 18), array([-30.71, 12.42, -27.15]), array([2.2, 1. , 3. ]))
sampling_rate
andorigin
can be set to ensure correct alignment with corresponding density maps such as the ones at EMDB. Analogous toStructure.subset_by_chain()
only parts of the structure can be mapped onto grids using a variety of weighting schemes>>> structure.to_volume(weight_type="van_der_waals_radius") >>> structure.to_volume( >>> weight_type="lowpass_scattering_factors", >>> method_args={"source" : "dt1969", "downsampling_factor" : 1.35}, >>> )