Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalo committed Oct 4, 2024
1 parent 8784569 commit e5be45e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/patch_denoise/space_time/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,5 @@ def estimate_noise(noise_sequence, block_size=1):
)
# Set the value of the voxel in the center of the patch to the SD of
# the patch
patch_data = noise_sequence[patch_slice]
print(patch_data.shape)
noise_map[patch_center_img] = np.std(noise_sequence[patch_slice])
return noise_map
8 changes: 5 additions & 3 deletions tests/test_spacetime_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ def test_noise_estimation(medium_random_matrix, block_dim):
The mean patch-wise standard deviation should be close to the overall
standard deviation.
"""
print(f"Max of raw: {np.nanmax(medium_random_matrix)}")
print(f"Min of raw: {np.nanmin(medium_random_matrix)}")
noise_map = estimate_noise(medium_random_matrix, block_dim)
print(np.nanmean(noise_map))
print(f"Mean of noise map: {np.nanmean(noise_map)}")
real_std = np.nanstd(medium_random_matrix)
print(real_std)
print(f"SD of raw: {real_std}")
err = np.nanmean(noise_map - real_std)
print(err)
print(f"Err: {err}")
assert err <= 0.1 * real_std


Expand Down

0 comments on commit e5be45e

Please sign in to comment.