aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-03-10 17:11:21 +0100
committerThomas White <taw@physics.org>2010-03-10 17:11:21 +0100
commit7afb2efc35a34075daba73b24c4d8cac0d1838a5 (patch)
treea7475051c3834531006c8f990e0cd43901c0939a /src
parentd16eca68707f92cf0dcc939d2e97603d2681f129 (diff)
Make alternate CCD configuration optional
Diffstat (limited to 'src')
-rw-r--r--src/indexamajig.c66
1 files changed, 38 insertions, 28 deletions
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 5cd93c42..f3cb05fc 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -67,7 +67,7 @@ static void show_help(const char *s)
}
-static struct image *get_simage(struct image *template)
+static struct image *get_simage(struct image *template, int alternate)
{
struct image *image;
struct panel panels[2];
@@ -91,27 +91,35 @@ static struct image *get_simage(struct image *template)
image->height = 1024;
image->det.n_panels = 2;
- /* Upper */
- panels[0].min_x = 0;
- panels[0].max_x = 1023;
- panels[0].min_y = 512;
- panels[0].max_y = 1023;
- panels[0].cx = 523.6;
- panels[0].cy = 502.5;
- panels[0].clen = 56.4e-2; /* 56.4 cm */
- panels[0].res = 13333.3; /* 75 microns/pixel */
-
- /* Lower */
- panels[1].min_x = 0;
- panels[1].max_x = 1023;
- panels[1].min_y = 0;
- panels[1].max_y = 511;
- panels[1].cx = 520.8;
- panels[1].cy = 772.1;
- panels[1].clen = 56.7e-2; /* 56.7 cm */
- panels[1].res = 13333.3; /* 75 microns/pixel */
-
- image->det.panels = panels;
+ if ( alternate ) {
+
+ /* Upper */
+ panels[0].min_x = 0;
+ panels[0].max_x = 1023;
+ panels[0].min_y = 512;
+ panels[0].max_y = 1023;
+ panels[0].cx = 523.6;
+ panels[0].cy = 502.5;
+ panels[0].clen = 56.4e-2; /* 56.4 cm */
+ panels[0].res = 13333.3; /* 75 microns/pixel */
+
+ /* Lower */
+ panels[1].min_x = 0;
+ panels[1].max_x = 1023;
+ panels[1].min_y = 0;
+ panels[1].max_y = 511;
+ panels[1].cx = 520.8;
+ panels[1].cy = 772.1;
+ panels[1].clen = 56.7e-2; /* 56.7 cm */
+ panels[1].res = 13333.3; /* 75 microns/pixel */
+
+ image->det.panels = panels;
+ } else {
+
+ /* Copy pointer to old geometry */
+ image->det.panels = template->det.panels;
+
+ }
image->lambda = ph_en_to_lambda(eV_to_J(1.8e3));
@@ -164,6 +172,7 @@ int main(int argc, char *argv[])
int config_nomatch = 0;
int config_gpu = 0;
int config_verbose = 0;
+ int config_alternate = 0;
IndexingMethod indm;
char *indm_str = NULL;
struct image image;
@@ -182,6 +191,7 @@ int main(int argc, char *argv[])
{"clean-image", 0, &config_clean, 1},
{"no-match", 0, &config_nomatch, 1},
{"verbose", 0, &config_verbose, 1},
+ {"alternate", 0, &config_alternate, 1},
{0, 0, NULL, 0}
};
@@ -310,7 +320,7 @@ int main(int argc, char *argv[])
n_hits++;
- simage = get_simage(&image);
+ simage = get_simage(&image, config_alternate);
/* Measure intensities if requested */
if ( config_nearbragg ) {
@@ -329,14 +339,14 @@ int main(int argc, char *argv[])
}
}
- if ( simage != NULL ) {
- if ( simage->data != NULL ) free(simage->data);
- if ( simage->twotheta != NULL ) free(simage->twotheta);
- free(simage);
- }
+ /* Finished with alternate image */
+ if ( simage->twotheta != NULL ) free(simage->twotheta);
+ if ( simage->data != NULL ) free(simage->data);
+ free(simage);
done:
free(image.data);
+ free(image.det.panels);
image_feature_list_free(image.features);
hdfile_close(hdfile);
H5close();