Skip to content

Commit

Permalink
Expt. filter for nobs and resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
David Moreau committed Jan 9, 2025
1 parent f2ccb73 commit 5a94912
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
11 changes: 6 additions & 5 deletions xfel/merging/application/filter/experiment_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand Down Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions xfel/merging/application/phil/phil.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 5a94912

Please sign in to comment.