From 5a949124da16c03e2b04305188d761d7585e8cb1 Mon Sep 17 00:00:00 2001 From: David Moreau Date: Thu, 9 Jan 2025 04:03:34 -0800 Subject: [PATCH] Expt. filter for nobs and resolution --- xfel/merging/application/filter/experiment_filter.py | 11 ++++++----- xfel/merging/application/phil/phil.py | 7 +++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/xfel/merging/application/filter/experiment_filter.py b/xfel/merging/application/filter/experiment_filter.py index ee229d08a1..2afaa2990d 100644 --- a/xfel/merging/application/filter/experiment_filter.py +++ b/xfel/merging/application/filter/experiment_filter.py @@ -10,9 +10,9 @@ def __init__(self, params, mpi_helper=None, mpi_logger=None): super(experiment_filter, self).__init__(params=params, mpi_helper=mpi_helper, mpi_logger=mpi_logger) def validate(self): - filter_by_unit_cell = 'unit_cell' in self.params.filter.algorithm[0] - filter_by_n_obs = 'n_obs' in self.params.filter.algorithm[0] - filter_by_resolution = 'resolution' in self.params.filter.algorithm[0] + filter_by_unit_cell = 'unit_cell' in self.params.filter.algorithm + filter_by_n_obs = 'n_obs' in self.params.filter.algorithm + filter_by_resolution = 'resolution' in self.params.filter.algorithm if filter_by_unit_cell: assert self.params.filter.unit_cell.value.target_space_group is not None, \ 'Space group is required for unit cell filtering' @@ -27,7 +27,6 @@ def validate(self): if filter_by_resolution: assert self.params.filter.resolution.d_min is not None, \ 'd_min is required for resolution filtering' - return filter_by_unit_cell, filter_by_n_obs, filter_by_resolution def __repr__(self): return 'Filter experiments' @@ -80,7 +79,9 @@ def check_cluster(self, experiment): return m_distance < self.params.filter.unit_cell.cluster.covariance.mahalanobis def run(self, experiments, reflections): - filter_by_unit_cell, filter_by_n_obs, filter_by_resolution = self.validate() + filter_by_unit_cell = 'unit_cell' in self.params.filter.algorithm + filter_by_n_obs = 'n_obs' in self.params.filter.algorithm + filter_by_resolution = 'resolution' in self.params.filter.algorithm # only "unit_cell" "n_obs" and "resolution" algorithms are supported if (not filter_by_unit_cell) and (not filter_by_n_obs) and (not filter_by_resolution): return experiments, reflections diff --git a/xfel/merging/application/phil/phil.py b/xfel/merging/application/phil/phil.py index 0716c5ecb4..4abffd7194 100644 --- a/xfel/merging/application/phil/phil.py +++ b/xfel/merging/application/phil/phil.py @@ -131,8 +131,7 @@ .help = refer to the select section for filtering of individual reflections { algorithm = n_obs resolution unit_cell - .type = strings - .multiple = True + .type = choice(multi=True) n_obs { min = None .type = int @@ -541,6 +540,10 @@ .help = If True - use correlation coefficient determined after post-refinement.\ If False - use correlation coefficient determined before. \ If post-refinement is not performed, must be False. + constant_sadd = False + .type = bool + .help = If False, parameterize sadd with the correlation coefficient.\ + If True, use a constant sadd. do_diagnostics = False .type = bool .help = Make diagnostic plots.