aboutsummaryrefslogtreecommitdiff
path: root/src/likelihood.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2010-05-04 07:38:31 -0700
committerThomas White <taw@bitwiz.org.uk>2010-05-04 08:56:17 -0700
commite447c2efb128823c93358c51a7d8f23636740f68 (patch)
tree68fb800a56d2e06cc6f3610b58a26ecc9bb6cb57 /src/likelihood.c
parent07d406ce05760f633f72c2c3683dd3466423321a (diff)
process_hkl: Implement --scale option
Diffstat (limited to 'src/likelihood.c')
-rw-r--r--src/likelihood.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/likelihood.c b/src/likelihood.c
new file mode 100644
index 00000000..e8c62010
--- /dev/null
+++ b/src/likelihood.c
@@ -0,0 +1,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 s;
+ unsigned int i;
+
+ s = stat_scale_intensity(model, model_counts, new_pattern, new_counts);
+ printf("%f\n", s);
+
+ /* NaN -> abort */
+ if ( isnan(s) ) return;
+
+ /* Multiply the new pattern up by "s" */
+ for ( i=0; i<LIST_SIZE; i++ ) {
+ new_counts[i] *= s;
+ }
+}