Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NaNs were messing up phase_change #98

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion meteor/scripts/compute_iterative_tv_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def main(command_line_arguments: list[str] | None = None) -> None:

log.info(
"Optimal TV weight found",
weight=final_tv_metadata.optimal_tv_weight,
weight=f"{final_tv_metadata.optimal_tv_weight:.2e}",
final_negentropy=round(final_tv_metadata.optimal_negentropy, 4),
)

Expand Down
1 change: 1 addition & 0 deletions meteor/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def average_phase_diff_in_degrees(

diff = phase2 - phase1
diff = (diff + 180) % 360 - 180
diff = diff[~np.isnan(diff)]
tjlane marked this conversation as resolved.
Show resolved Hide resolved

return float(np.sum(np.abs(diff)) / float(np.prod(array1.shape)))

Expand Down
3 changes: 3 additions & 0 deletions test/functional/test_compute_iterative_tv_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,6 @@ def test_script_produces_consistent_results(
)
rho = np.corrcoef(result_amplitudes.to_numpy(), reference_amplitudes.to_numpy())[0, 1]
assert rho > 0.95

# 4. regression, make sure no NaNs creep into metadata
assert not np.any(np.isnan(iterative_tv_metadata))
Loading