backend
Submodule for computationally intensive backend functions.
cross_correlate_particle_stack(particle_stack_dft, template_dft, rotation_matrices, projective_filters, mode='valid', batch_size=1024)
Cross-correlate a stack of particle images against a template.
Here, the argument 'particle_stack_dft' is a set of RFFT-ed particle images with necessary filtering already applied. The zeroth dimension corresponds to unique particles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
particle_stack_dft
|
Tensor
|
The stack of particle real-Fourier transformed and un-fftshifted images. Shape of (N, H, W). |
required |
template_dft
|
Tensor
|
The template volume to extract central slices from. Real-Fourier transformed and fftshifted. |
required |
rotation_matrices
|
Tensor
|
The orientations of the particles to take the Fourier slices of, as a long list of rotation matrices. Shape of (N, 3, 3). |
required |
projective_filters
|
Tensor
|
Projective filters to apply to each Fourier slice particle. Shape of (N, h, w). |
required |
mode
|
Literal['valid', 'same']
|
Correlation mode to use, by default "valid". If "valid", the output will be the valid cross-correlation of the inputs. If "same", the output will be the same shape as the input particle stack. |
'valid'
|
batch_size
|
int
|
The number of particle images to cross-correlate at once. Default is 1024. Larger sizes will consume more memory. If -1, then the entire stack will be cross-correlated at once. |
1024
|
Returns:
| Type | Description |
|---|---|
Tensor
|
The cross-correlation of the particle stack with the template. Shape will depend on the mode used. If "valid", the output will be (N, H-h+1, W-w+1). If "same", the output will be (N, H, W). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the mode is not "valid" or "same". |
Source code in src/leopard_em/backend/core_refine_template.py
763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 | |