core_match_template
Pure PyTorch implementation of whole orientation search backend.
construct_multi_gpu_match_template_kwargs(image_dft, template_dft, euler_angles, projective_filters, defocus_values, pixel_values, orientation_batch_size, num_cuda_streams, devices)
Split orientations between requested devices.
See the core_match_template
function for further descriptions of the
input parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image_dft
|
Tensor
|
dft of image |
required |
template_dft
|
Tensor
|
dft of template |
required |
euler_angles
|
Tensor
|
euler angles to search |
required |
projective_filters
|
Tensor
|
filters to apply to each projection |
required |
defocus_values
|
Tensor
|
corresponding defocus values for each filter |
required |
pixel_values
|
Tensor
|
corresponding pixel size values for each filter |
required |
orientation_batch_size
|
int
|
number of projections to calculate at once |
required |
num_cuda_streams
|
int
|
number of CUDA streams to use for parallelizing cross-correlation computation |
required |
devices
|
list[device]
|
list of devices to split the orientations across |
required |
Returns:
Type | Description |
---|---|
list[dict[str, Tensor | int]]
|
List of dictionaries containing the kwargs to call the single-GPU function. Each index in the list corresponds to a different device, and all tensors in the dictionary have been allocated to that device. |
Source code in src/leopard_em/backend/core_match_template.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
|
core_match_template(image_dft, template_dft, ctf_filters, whitening_filter_template, defocus_values, pixel_values, euler_angles, device, orientation_batch_size=1, num_cuda_streams=1)
Core function for performing the whole-orientation search.
With the RFFT, the last dimension (fastest dimension) is half the width of the input, hence the shape of W // 2 + 1 instead of W for some of the input parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image_dft
|
Tensor
|
Real-fourier transform (RFFT) of the image with large image filters already applied. Has shape (H, W // 2 + 1). |
required |
template_dft
|
Tensor
|
Real-fourier transform (RFFT) of the template volume to take Fourier slices from. Has shape (l, h, w // 2 + 1) with the last dimension being the half-dimension for real-FFT transformation. NOTE: The original template volume should be a cubic volume, i.e. h == w == l. |
required |
ctf_filters
|
Tensor
|
Stack of CTF filters at different pixel size (Cs) and defocus values to use in the search. Has shape (num_Cs, num_defocus, h, w // 2 + 1) where num_Cs are the number of pixel sizes searched over, and num_defocus are the number of defocus values searched over. |
required |
whitening_filter_template
|
Tensor
|
Whitening filter for the template volume. Has shape (h, w // 2 + 1). Gets multiplied with the ctf filters to create a filter stack applied to each orientation projection. |
required |
euler_angles
|
Tensor
|
Euler angles (in 'ZYZ' convention) to search over. Has shape (num_orientations, 3). |
required |
defocus_values
|
Tensor
|
What defoucs values correspond with the CTF filters, in units of Angstroms. Has shape (num_defocus,). |
required |
pixel_values
|
Tensor
|
What pixel size values correspond with the CTF filters, in units of Angstroms. Has shape (num_Cs,). |
required |
device
|
device | list[device]
|
Device or devices to split computation across. |
required |
orientation_batch_size
|
int
|
Number of projections, at different orientations, to calculate simultaneously. Larger values will use more memory, but can help amortize the cost of Fourier slice extraction. The default is 1, but generally values larger than 1 should be used for performance. |
1
|
num_cuda_streams
|
int
|
Number of CUDA streams to use for parallelizing cross-correlation computation. More streams can lead to better performance, especially for high-end GPUs, but the performance will degrade if too many streams are used. The default is 1 which performs well in most cases, but high-end GPUs can benefit from increasing this value. NOTE: If the number of streams is greater than the number of cross-correlations to compute per batch, then the number of streams will be reduced to the number of cross-correlations per batch. This is done to avoid unnecessary overhead and performance degradation. |
1
|
Returns:
Type | Description |
---|---|
dict[str, Tensor]
|
Dictionary containing the following key, value pairs:
|
Source code in src/leopard_em/backend/core_match_template.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
|