From ddb19f94639be19e518b0756c8a67cde2ced45ce Mon Sep 17 00:00:00 2001 From: DSilva27 Date: Thu, 15 Aug 2024 10:23:37 -0400 Subject: [PATCH] remove old powerspectrum normalization --- src/cryo_challenge/_preprocessing/__init__.py | 4 ---- src/cryo_challenge/_svd/svd_pipeline.py | 24 ------------------- src/cryo_challenge/data/_io/svd_io_utils.py | 15 ------------ 3 files changed, 43 deletions(-) diff --git a/src/cryo_challenge/_preprocessing/__init__.py b/src/cryo_challenge/_preprocessing/__init__.py index 9f703a2..3a00dd9 100644 --- a/src/cryo_challenge/_preprocessing/__init__.py +++ b/src/cryo_challenge/_preprocessing/__init__.py @@ -3,7 +3,3 @@ downsample_volume as downsample_volume, downsample_submission as downsample_submission, ) -from .normalize import ( - compute_power_spectrum as compute_power_spectrum, - normalize_power_spectrum as normalize_power_spectrum, -) diff --git a/src/cryo_challenge/_svd/svd_pipeline.py b/src/cryo_challenge/_svd/svd_pipeline.py index 5ec0d0e..50a04d8 100644 --- a/src/cryo_challenge/_svd/svd_pipeline.py +++ b/src/cryo_challenge/_svd/svd_pipeline.py @@ -8,10 +8,8 @@ load_volumes, load_ref_vols, remove_mean_volumes, - normalize_power_spectrum_sub, ) from ..data._validation.config_validators import validate_config_svd -from .._preprocessing.normalize import compute_power_spectrum, normalize_power_spectrum def run_svd_with_ref( @@ -127,13 +125,6 @@ def run_all_vs_all_pipeline(config: dict): dtype=dtype, ) - volumes = normalize_power_spectrum_sub( - volumes, - metadata, - config["power_spectrum_normalization"]["ref_vol_key"], - config["power_spectrum_normalization"]["ref_vol_index"], - ) - volumes, mean_volumes = remove_mean_volumes(volumes, metadata) U, S, V, coeffs = run_svd_all_vs_all(volumes=volumes) @@ -203,21 +194,6 @@ def run_all_vs_ref_pipeline(config: dict): dtype=dtype, ) - # Normalize Power spectrums - idx_ref_vol = ( - metadata[config["power_spectrum_normalization"]["ref_vol_key"]]["indices"][0] - + config["power_spectrum_normalization"]["ref_vol_index"] - ) - ref_power_spectrum = compute_power_spectrum(volumes[idx_ref_vol]) - ref_volumes = normalize_power_spectrum(ref_volumes, ref_power_spectrum) - - volumes = normalize_power_spectrum_sub( - volumes, - metadata, - config["power_spectrum_normalization"]["ref_vol_key"], - config["power_spectrum_normalization"]["ref_vol_index"], - ) - # Remove mean volumes volumes, mean_volumes = remove_mean_volumes(volumes, metadata) ref_volumes, mean_volume = remove_mean_volumes(ref_volumes) diff --git a/src/cryo_challenge/data/_io/svd_io_utils.py b/src/cryo_challenge/data/_io/svd_io_utils.py index 666c1b7..24b44cc 100644 --- a/src/cryo_challenge/data/_io/svd_io_utils.py +++ b/src/cryo_challenge/data/_io/svd_io_utils.py @@ -2,7 +2,6 @@ from typing import Tuple from ..._preprocessing.fourier_utils import downsample_volume -from ..._preprocessing.normalize import compute_power_spectrum, normalize_power_spectrum def _remove_mean_volumes_sub(volumes, metadata): @@ -33,20 +32,6 @@ def remove_mean_volumes(volumes, metadata=None): return volumes, mean_volumes -def normalize_power_spectrum_sub(volumes, metadata, ref_vol_key, ref_vol_index): - volumes = volumes.clone() - idx_ref_vol = metadata[ref_vol_key]["indices"][0] + ref_vol_index - ref_power_spectrum = compute_power_spectrum(volumes[idx_ref_vol]) - - for key in metadata.keys(): - indices = metadata[key]["indices"] - volumes[indices[0] : indices[1]] = normalize_power_spectrum( - volumes[indices[0] : indices[1]], ref_power_spectrum - ) - - return volumes - - def load_volumes( box_size_ds: float, submission_list: list,