Skip to content

Commit

Permalink
fix: Fixed typo in 2D ctf
Browse files Browse the repository at this point in the history
  • Loading branch information
jdickerson95 committed Nov 27, 2024
1 parent 48c3e42 commit 300372c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@ And for development and testing use
```zsh
pip install -e ".[dev,test]"
```

Make sure to run tests before any commits:
```zsh
python -m pytest
```

5 changes: 3 additions & 2 deletions src/torch_fourier_filter/ctf.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ def calculate_ctf_2d(
image_shape=image_shape,
rfft=rfft,
fftshift=fftshift,
norm=True,
norm=False,
)

fft_freq_grid = fft_freq_grid / einops.rearrange(pixel_size, "b -> b 1 1 1")
fftfreq_grid_squared = fft_freq_grid**2

Expand All @@ -148,7 +149,7 @@ def calculate_ctf_2d(
s2 = s**2

yy2, xx2 = einops.rearrange(fftfreq_grid_squared, "b h w freq -> freq b h w")
xy = einops.reduce(fftfreq_grid, "b h w freq -> b h w", reduction="prod")
xy = einops.reduce(fft_freq_grid, "b h w freq -> b h w", reduction="prod")
n4 = (
einops.reduce(fftfreq_grid_squared, "b h w freq -> b h w", reduction="sum") ** 2
)
Expand Down
2 changes: 0 additions & 2 deletions src/torch_fourier_filter/dose_weight.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ def cumulative_dose_filter_3d(
The dose weighting filter.
"""
end_exposure = start_exposure + num_frames * flux
print(f"End exposure: {end_exposure}")
# Get the frequency grid for 1 frame
fft_freq_px = (
fftfreq_grid(
Expand All @@ -103,7 +102,6 @@ def cumulative_dose_filter_3d(
# Add small epsilon to prevent division by zero
eps = 1e-10
Ne = Ne.clamp(min=eps)
print(f"Ne min: {Ne.min()}, max: {Ne.max()}")

return (
2
Expand Down

0 comments on commit 300372c

Please sign in to comment.