From 4438b92a3cd5904a9d3ca480f7f5e993de3376be Mon Sep 17 00:00:00 2001 From: Geoffrey Woollard Date: Wed, 10 Jul 2024 10:46:18 -0400 Subject: [PATCH] remove old reference to l2, corr, and bioem3d --- .../_map_to_map/map_to_map_distance_matrix.py | 40 +------------------ .../data/_validation/output_validators.py | 6 --- .../config_files/test_config_map_to_map.yaml | 3 -- 3 files changed, 1 insertion(+), 48 deletions(-) diff --git a/src/cryo_challenge/_map_to_map/map_to_map_distance_matrix.py b/src/cryo_challenge/_map_to_map/map_to_map_distance_matrix.py index 9964069..426dedf 100644 --- a/src/cryo_challenge/_map_to_map/map_to_map_distance_matrix.py +++ b/src/cryo_challenge/_map_to_map/map_to_map_distance_matrix.py @@ -12,22 +12,6 @@ from ..data._validation.output_validators import MapToMapResultsValidator -def vmap_distance( - maps_gt, - maps_submission, - map_to_map_distance, - chunk_size_gt=None, - chunk_size_submission=None, -): - return torch.vmap( - lambda maps_gt: torch.vmap( - lambda maps_submission: map_to_map_distance(maps_gt, maps_submission), - chunk_size=chunk_size_submission, - )(maps_submission), - chunk_size=chunk_size_gt, - )(maps_gt) - - class MapToMapDistance: def __init__(self, config): self.config = config @@ -99,11 +83,8 @@ def run(config): cost_funcs_d = { "fsc": compute_cost_fsc_chunk, - "corrold": compute_cost_corr, "corr": Correlation(config).get_distance_matrix, - "l2old": compute_cost_l2, "l2": L2DistanceSum(config).get_distance_matrix, - "bioemold": compute_bioem3d_cost, "bioem": BioEM3dDistance(config).get_distance_matrix, } @@ -149,29 +130,10 @@ def run(config): ) cost_matrix = cost_matrix.numpy() computed_assets["fsc_matrix"] = fsc_matrix - elif cost_label == "l2": + else: cost_matrix = cost_func( maps_gt_flat, maps_user_flat ).numpy() - elif cost_label == "corr": - corr_map2map_distance = Correlation(config) - cost_matrix = corr_map2map_distance.get_distance_matrix( - maps_gt_flat, maps_user_flat - ).numpy() - elif cost_label == "bioem": - bioem_map2map_distance = BioEM3dDistance(config) - cost_matrix = bioem_map2map_distance.get_distance_matrix( - maps_gt_flat, maps_user_flat - ).numpy() - - else: - cost_matrix = vmap_distance( - maps_gt_flat, - maps_user_flat, - cost_func, - chunk_size_gt=config["analysis"]["chunk_size_gt"], - chunk_size_submission=config["analysis"]["chunk_size_submission"], - ).numpy() cost_matrix_df = pd.DataFrame( cost_matrix, columns=None, index=metadata_gt.populations.tolist() diff --git a/src/cryo_challenge/data/_validation/output_validators.py b/src/cryo_challenge/data/_validation/output_validators.py index 5a853a5..35d9791 100644 --- a/src/cryo_challenge/data/_validation/output_validators.py +++ b/src/cryo_challenge/data/_validation/output_validators.py @@ -26,11 +26,8 @@ class MapToMapResultsValidator: config: dict user_submitted_populations: torch.Tensor corr: Optional[dict] = None - corrold: Optional[dict] = None l2: Optional[dict] = None - l2old: Optional[dict] = None bioem: Optional[dict] = None - bioemold: Optional[dict] = None fsc: Optional[dict] = None def __post_init__(self): @@ -145,11 +142,8 @@ class DistributionToDistributionResultsValidator: id: str fsc: Optional[dict] = None bioem: Optional[dict] = None - bioemold: Optional[dict] = None l2: Optional[dict] = None - l2old: Optional[dict] = None corr: Optional[dict] = None - corrold: Optional[dict] = None def __post_init__(self): validate_input_config_disttodist(self.config) diff --git a/tests/config_files/test_config_map_to_map.yaml b/tests/config_files/test_config_map_to_map.yaml index 17a2223..b2f74bb 100644 --- a/tests/config_files/test_config_map_to_map.yaml +++ b/tests/config_files/test_config_map_to_map.yaml @@ -15,11 +15,8 @@ data: analysis: metrics: - l2 - - l2old - corr - - corrold - bioem - - bioemold chunk_size_submission: 80 chunk_size_gt: 190 normalize: