aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/fom.h
blob: fae8748de6cf8c3584210ec54969b47d1e54c8d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
 * fom.h
 *
 * Figure of merit calculation
 *
 * Copyright © 2012-2021 Deutsches Elektronen-Synchrotron DESY,
 *                       a research centre of the Helmholtz Association.
 *
 * Authors:
 *   2010-2021 Thomas White <taw@physics.org>
 *   2013      Lorenzo Galli <lorenzo.galli@desy.de>
 *
 * This file is part of CrystFEL.
 *
 * CrystFEL is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * CrystFEL is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with CrystFEL.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef FOM_H
#define FOM_H

/**
 * \file fom.h
 * Figure of merit calculation
 */

#include <reflist.h>
#include <symmetry.h>

struct fom_rejections
{
	int common;
	int low_snr;
	int negative_deleted;
	int negative_zeroed;
	int few_measurements;
	int outside_resolution_range;
	int no_bijvoet;
	int centric;
	int nan_inf_value;
};

enum fom_type
{
	FOM_R1I,
	FOM_R1F,
	FOM_R2,
	FOM_RSPLIT,
	FOM_CC,
	FOM_CCSTAR,
	FOM_CCANO,
	FOM_CRDANO,
	FOM_RANO,
	FOM_RANORSPLIT,
	FOM_D1SIG,
	FOM_D2SIG,
	FOM_NUM_MEASUREMENTS,
	FOM_REDUNDANCY,
	FOM_SNR,
	FOM_MEAN_INTENSITY,
	FOM_COMPLETENESS,
};

struct fom_shells
{
	int nshells;
	double *rmins;
	double *rmaxs;
};

struct fom_context;

extern struct fom_rejections fom_select_reflection_pairs(RefList *list1,
                                                         RefList *list2,
                                                         RefList **plist1_acc,
                                                         RefList **plist2_acc,
                                                         UnitCell *cell,
                                                         SymOpList *sym,
                                                         int anom,
                                                         double rmin_fix,
                                                         double rmax_fix,
                                                         double sigma_cutoff,
                                                         int ignore_negs,
                                                         int zero_negs,
                                                         int mul_cutoff);

extern struct fom_rejections fom_select_reflections(RefList *list,
                                                    RefList **plist_acc,
                                                    UnitCell *cell,
                                                    SymOpList *sym,
                                                    double rmin_fix,
                                                    double rmax_fix,
                                                    double sigma_cutoff,
                                                    int ignore_negs,
                                                    int zero_negs,
                                                    int mul_cutoff);


extern struct fom_context *fom_calculate(RefList *list1, RefList *list2,
                                         UnitCell *cell,
                                         struct fom_shells *shells,
                                         enum fom_type fom, int noscale,
                                         const SymOpList *sym);

extern struct fom_shells *fom_make_resolution_shells(double rmin, double rmax,
                                                     int nshells);

extern double fom_shell_centre(struct fom_shells *s, int i);

extern double fom_overall_value(struct fom_context *fctx);
extern double fom_shell_value(struct fom_context *fctx, int i);

extern int fom_overall_num_reflections(struct fom_context *fctx);
extern int fom_shell_num_reflections(struct fom_context *fctx, int i);

extern int fom_overall_num_possible(struct fom_context *fctx);
extern int fom_shell_num_possible(struct fom_context *fctx, int i);

#endif	/* FOM */