aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2023-06-20 11:21:23 +0200
committerThomas White <taw@physics.org>2023-07-28 13:22:05 +0200
commit5d52dae0bdd7012246528cb94146d28668779949 (patch)
tree58b7be6ab9ce36d29417734f92ce0f1c363ce7cf /libcrystfel/src
parent538e990e4667c45e537755799d82ab8a56fdd1f4 (diff)
Reduce scope of rv[]
Diffstat (limited to 'libcrystfel/src')
-rw-r--r--libcrystfel/src/predict-refine.c44
1 files changed, 16 insertions, 28 deletions
diff --git a/libcrystfel/src/predict-refine.c b/libcrystfel/src/predict-refine.c
index 27f97700..ca47ba0c 100644
--- a/libcrystfel/src/predict-refine.c
+++ b/libcrystfel/src/predict-refine.c
@@ -51,22 +51,6 @@
/* Weighting of excitation error term (m^-1) compared to position term (m) */
#define EXC_WEIGHT (4e-20)
-/* Parameters to refine */
-static const enum gparam rv[] =
-{
- GPARAM_ASX,
- GPARAM_ASY,
- GPARAM_ASZ,
- GPARAM_BSX,
- GPARAM_BSY,
- GPARAM_BSZ,
- GPARAM_CSX,
- GPARAM_CSY,
- GPARAM_CSZ,
- GPARAM_DETX,
- GPARAM_DETY,
-};
-
double r_dev(struct reflpeak *rp)
{
@@ -511,8 +495,7 @@ int refine_radius(Crystal *cr, struct image *image)
static int iterate(struct reflpeak *rps, int n, UnitCell *cell,
- struct image *image, int num_params,
- double *total_x, double *total_y)
+ struct image *image, double *total_x, double *total_y)
{
int i;
gsl_matrix *M;
@@ -522,6 +505,20 @@ static int iterate(struct reflpeak *rps, int n, UnitCell *cell,
double bsx, bsy, bsz;
double csx, csy, csz;
+ const enum gparam rv[] =
+ {
+ GPARAM_ASX,
+ GPARAM_ASY,
+ GPARAM_ASZ,
+ GPARAM_BSX,
+ GPARAM_BSY,
+ GPARAM_BSZ,
+ GPARAM_CSX,
+ GPARAM_CSY,
+ GPARAM_CSZ,
+ };
+ int num_params = 9;
+
/* Number of parameters to refine */
M = gsl_matrix_calloc(num_params, num_params);
v = gsl_vector_calloc(num_params);
@@ -747,7 +744,6 @@ int refine_prediction(struct image *image, Crystal *cr, Mille *mille)
double total_y = 0.0;
double orig_shift_x, orig_shift_y;
char tmp[256];
- int num_params;
rps = malloc(image_feature_count(image->features)
* sizeof(struct reflpeak));
@@ -786,21 +782,13 @@ int refine_prediction(struct image *image, Crystal *cr, Mille *mille)
}
}
- if ( mille == NULL ) {
- /* Without Millepede, we refine beam center as well */
- num_params = 11;
- } else {
- /* With Millepede, leave all global parameters for later */
- num_params = 9;
- }
-
//STATUS("Initial residual = %e\n",
// pred_residual(rps, n, image->detgeom));
/* Refine */
for ( i=0; i<MAX_CYCLES; i++ ) {
update_predictions(cr);
- if ( iterate(rps, n, crystal_get_cell(cr), image, num_params,
+ if ( iterate(rps, n, crystal_get_cell(cr), image,
&total_x, &total_y) )
{
crystal_set_reflections(cr, NULL);