From d7b326f4e75cf6bda8c1a097a92923820aa4b6e3 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sun, 1 Mar 2015 13:49:30 +0100 Subject: partialator: Add B-factor scaling and rejection --- src/rejection.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 src/rejection.c (limited to 'src/rejection.c') diff --git a/src/rejection.c b/src/rejection.c new file mode 100644 index 00000000..d413666f --- /dev/null +++ b/src/rejection.c @@ -0,0 +1,83 @@ +/* + * rejection.c + * + * Crystal rejection for scaling + * + * Copyright © 2012-2015 Deutsches Elektronen-Synchrotron DESY, + * a research centre of the Helmholtz Association. + * + * Authors: + * 2010-2015 Thomas White + * + * 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 . + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + + +#include +#include + +#include "crystal.h" +#include "reflist.h" + + +static double mean_intensity(RefList *list) +{ + Reflection *refl; + RefListIterator *iter; + double total = 0.0; + int n = 0; + + for ( refl = first_refl(list, &iter); + refl != NULL; + refl = next_refl(refl, iter) ) + { + total += get_intensity(refl); + n++; + } + + return total/n; +} + + +/* Reject really obvious outliers */ +void early_rejection(Crystal **crystals, int n) +{ + int i; + double m = 0.0; + FILE *fh = fopen("reject.dat", "w"); + int n_flag = 0; + + for ( i=0; i