/* * prof2d_check.c * * Check 2D profile fitting * * Copyright © 2013-2020 Deutsches Elektronen-Synchrotron DESY, * a research centre of the Helmholtz Association. * * Authors: * 2013-2020 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 . * */ #include #include #include #include #include #include #include #include #include "histogram.h" void integrate_prof2d(IntegrationMethod meth, Crystal *cr, RefList *list, struct image *image, IntDiag int_diag, signed int idh, signed int idk, signed int idl, double ir_inn, double ir_mid, double ir_out, pthread_mutex_t *term_lock, int **masks); #define ADD_PX(fs, ss, val) \ if ( ((fs)>0) && ((ss)>0) && ((fs)n_panels = 1; image.detgeom->panels = calloc(1, sizeof(struct detgeom_panel)); image.dp = calloc(1, sizeof(float *)); image.bad = calloc(1, sizeof(int *)); image.detgeom->panels[0].w = w; image.detgeom->panels[0].h = h; image.detgeom->panels[0].fsx = 1.0; image.detgeom->panels[0].fsy = 0.0; image.detgeom->panels[0].ssx = 0.0; image.detgeom->panels[0].ssy = 1.0; image.detgeom->panels[0].cnx = -w/2; image.detgeom->panels[0].cny = -h/2; image.detgeom->panels[0].cnz = 60.0e-3 / 100e-6; image.detgeom->panels[0].pixel_pitch = 100e-6; /* 10 px per mm */ image.detgeom->panels[0].adu_per_photon = 10.0; image.detgeom->panels[0].max_adu = +INFINITY; /* No cutoff */ image.dp[0] = malloc(w*h*sizeof(float)); memset(image.dp[0], 0, w*h*sizeof(float)); image.bad[0] = malloc(w*h*sizeof(int)); memset(image.bad[0], 0, w*h*sizeof(int)); image.sat = NULL; cell = cell_new(); cell_set_lattice_type(cell, L_CUBIC); cell_set_centering(cell, 'P'); cell_set_parameters(cell, 200.0e-10, 200.0e-10, 200.0e-10, deg2rad(90.0), deg2rad(90.0), deg2rad(90.0)); cell = cell_rotate(cell, random_quaternion(rng)); cr = crystal_new(); crystal_set_profile_radius(cr, 0.001e9); crystal_set_mosaicity(cr, 0.0); /* radians */ crystal_set_cell(cr, cell); image.crystals = NULL; image.n_crystals = 0; list = predict_to_res(cr, &image, detgeom_max_resolution(image.detgeom, image.lambda)); image_add_crystal_refls(&image, cr, list); for ( fs=0; fs