aboutsummaryrefslogtreecommitdiff
path: root/src/likelihood.c
blob: 95f005c74c3ed2c1825e07119abbe47b432ca863 (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
/*
 * likelihood.c
 *
 * Likelihood maximisation
 *
 * (c) 2006-2010 Thomas White <taw@physics.org>
 *
 * Part of CrystFEL - crystallography with a FEL
 *
 */


#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include "statistics.h"
#include "utils.h"

void detwin_intensities(const double *model, double *new_pattern,
                        const unsigned int *model_counts,
                        unsigned int *new_counts)
{
	/* Placeholder... */
}

void scale_intensities(const double *model, double *new_pattern,
                       const unsigned int *model_counts,
                       unsigned int *new_counts, double f0, int f0_valid)
{
	double s;
	unsigned int i;

	s = stat_scale_intensity(model, model_counts, new_pattern, new_counts);
	if ( f0_valid ) printf("%f %f\n", s, f0);

	/* NaN -> abort */
	if ( isnan(s) ) return;

	/* Multiply the new pattern up by "s" */
	for ( i=0; i<LIST_SIZE; i++ ) {
		new_counts[i] *= s;
	}
}