aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2012-03-07 17:50:06 +0100
committerThomas White <taw@physics.org>2012-03-07 17:50:06 +0100
commit0014a606ed074e7438c6536cf0fc5a7d5bd790c9 (patch)
treecfb431919e77d279d657bbdc50096e03db5da3f0
parenta16291dd7c0826428b4d3d3b2ba3f48540f3c1c7 (diff)
indexamajig: Remove polarization correction
It was totally broken and wrong, and just added noise to the data, and it should be done at the scaling stage instead of now.
-rw-r--r--doc/man/indexamajig.15
-rw-r--r--libcrystfel/src/peaks.c26
-rw-r--r--libcrystfel/src/peaks.h5
-rw-r--r--src/indexamajig.c8
-rw-r--r--tests/integration_check.c12
5 files changed, 14 insertions, 42 deletions
diff --git a/doc/man/indexamajig.1 b/doc/man/indexamajig.1
index cab1df9d..4160d25c 100644
--- a/doc/man/indexamajig.1
+++ b/doc/man/indexamajig.1
@@ -218,11 +218,6 @@ Attempt to subtract common-mode noise from the image. The filtered image will b
Apply a noise filter to the image with checks 3x3 squares of pixels and sets all of them to zero if any of the nine pixels have a negative value. This filter may help with peak detection under certain circumstances, and the \fIunfiltered\fR image will be used for the final integration of the peaks. It is usually better to do a careful job of cleaning the images up before using indexamajig, so this option should not normally be used.
.PD 0
-.IP \fB--unpolarized\fR
-.PD
-Do not correct the integrated peaks for the polarisation of the X-rays.
-
-.PD 0
.IP \fB--no-sat-corr\fR
.PD
This option is here for historical purposes only, to disable a correction which is done if certain extra information is included in the HDF5 file.
diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c
index d0183371..66907298 100644
--- a/libcrystfel/src/peaks.c
+++ b/libcrystfel/src/peaks.c
@@ -153,7 +153,7 @@ static int cull_peaks(struct image *image)
int integrate_peak(struct image *image, int cfs, int css,
double *pfs, double *pss, double *intensity,
double *pbg, double *pmax, double *sigma,
- int do_polar, int centroid, int bgsub)
+ int centroid, int bgsub)
{
signed int fs, ss;
double lim, out_lim, mid_lim;
@@ -227,21 +227,6 @@ int integrate_peak(struct image *image, int cfs, int css,
val = image->data[idx];
- if ( do_polar ) {
-
- int err;
-
- tt = get_tt(image, fs+cfs, ss+css, &err);
-
- phi = atan2(ss+css, fs+cfs);
- pa = pow(sin(phi)*sin(tt), 2.0);
- pb = pow(cos(tt), 2.0);
- pol = 1.0 - 2.0*POL*(1-pa) + POL*(1.0+pb);
-
- val /= pol;
-
- }
-
if ( val > max ) max = val;
/* If outside inner mask, estimate noise from this region */
@@ -416,7 +401,7 @@ static void search_peaks_in_panel(struct image *image, float threshold,
* intensity of this peak is only an estimate at this stage. */
r = integrate_peak(image, mask_fs, mask_ss,
&f_fs, &f_ss, &intensity,
- &pbg, &pmax, &sigma, 0, 1, 1);
+ &pbg, &pmax, &sigma, 1, 1);
if ( r ) {
/* Bad region - don't detect peak */
@@ -619,8 +604,8 @@ static struct integr_ind *sort_reflections(RefList *list, UnitCell *cell,
/* Integrate the list of predicted reflections in "image" */
-void integrate_reflections(struct image *image, int polar, int use_closer,
- int bgsub, double min_snr)
+void integrate_reflections(struct image *image, int use_closer, int bgsub,
+ double min_snr)
{
struct integr_ind *il;
int n, i;
@@ -669,8 +654,7 @@ void integrate_reflections(struct image *image, int polar, int use_closer,
}
r = integrate_peak(image, pfs, pss, &fs, &ss,
- &intensity, &bg, &max, &sigma, polar, 0,
- bgsub);
+ &intensity, &bg, &max, &sigma, 0, bgsub);
/* Record intensity and set redundancy to 1 on success */
if ( r == 0 ) {
diff --git a/libcrystfel/src/peaks.h b/libcrystfel/src/peaks.h
index 2360dc42..8b64a081 100644
--- a/libcrystfel/src/peaks.h
+++ b/libcrystfel/src/peaks.h
@@ -37,8 +37,7 @@ extern void search_peaks(struct image *image, float threshold,
float min_gradient, float min_snr);
extern void integrate_reflections(struct image *image,
- int polar, int use_closer, int bgsub,
- double min_snr);
+ int use_closer, int bgsub, double min_snr);
extern double peak_lattice_agreement(struct image *image, UnitCell *cell,
double *pst);
@@ -49,7 +48,7 @@ extern int peak_sanity_check(struct image *image);
extern int integrate_peak(struct image *image, int cfs, int css,
double *pfs, double *pss, double *intensity,
double *pbg, double *pmax, double *sigma,
- int do_polar, int centroid, int bgsub);
+ int centroid, int bgsub);
extern void estimate_resolution(RefList *list, UnitCell *cell,
double *min, double *max);
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 714c4947..b5bf5e8a 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -74,7 +74,6 @@ struct static_index_args
int config_noisefilter;
int config_verbose;
int stream_flags; /* What goes into the output? */
- int config_polar;
int config_satcorr;
int config_closer;
int config_insane;
@@ -195,7 +194,6 @@ static void show_help(const char *s)
" pixels in each 3x3 region to zero if any of them\n"
" have negative values. Intensity measurement will\n"
" be performed on the image as it was before this.\n"
-" --unpolarized Don't correct for the polarisation of the X-rays.\n"
" --no-sat-corr Don't correct values of saturated peaks using a\n"
" table included in the HDF5 file.\n"
" --threshold=<n> Only accept peaks above <n> ADU. Default: 800.\n"
@@ -249,7 +247,6 @@ static void process_image(void *pp, int cookie)
int config_cmfilter = pargs->static_args.config_cmfilter;
int config_noisefilter = pargs->static_args.config_noisefilter;
int config_verbose = pargs->static_args.config_verbose;
- int config_polar = pargs->static_args.config_polar;
IndexingMethod *indm = pargs->static_args.indm;
struct beam_params *beam = pargs->static_args.beam;
@@ -382,7 +379,7 @@ static void process_image(void *pp, int cookie)
if ( image.reflections != NULL ) {
- integrate_reflections(&image, config_polar,
+ integrate_reflections(&image,
pargs->static_args.config_closer,
pargs->static_args.config_bgsub,
pargs->static_args.min_int_snr);
@@ -549,7 +546,6 @@ int main(int argc, char *argv[])
int config_cmfilter = 0;
int config_noisefilter = 0;
int config_verbose = 0;
- int config_polar = 1;
int config_satcorr = 1;
int config_checkprefix = 1;
int config_closer = 1;
@@ -615,7 +611,6 @@ int main(int argc, char *argv[])
{"verbose", 0, &config_verbose, 1},
{"pdb", 1, NULL, 'p'},
{"prefix", 1, NULL, 'x'},
- {"unpolarized", 0, &config_polar, 0},
{"no-sat-corr", 0, &config_satcorr, 0},
{"sat-corr", 0, &config_satcorr, 1}, /* Compat */
{"threshold", 1, NULL, 't'},
@@ -972,7 +967,6 @@ int main(int argc, char *argv[])
qargs.static_args.config_cmfilter = config_cmfilter;
qargs.static_args.config_noisefilter = config_noisefilter;
qargs.static_args.config_verbose = config_verbose;
- qargs.static_args.config_polar = config_polar;
qargs.static_args.config_satcorr = config_satcorr;
qargs.static_args.config_closer = config_closer;
qargs.static_args.config_insane = config_insane;
diff --git a/tests/integration_check.c b/tests/integration_check.c
index a73026f9..aa9e2705 100644
--- a/tests/integration_check.c
+++ b/tests/integration_check.c
@@ -60,7 +60,7 @@ static void third_integration_check(struct image *image, int n_trials,
}
}
integrate_peak(image, 64, 64, &fsp, &ssp, &intensity,
- &bg, &max, &sigma, 0, 1, 1);
+ &bg, &max, &sigma, 1, 1);
mean_intensity += intensity;
mean_bg += bg;
@@ -123,7 +123,7 @@ static void fourth_integration_check(struct image *image, int n_trials,
}
}
integrate_peak(image, 64, 64, &fsp, &ssp, &intensity,
- &bg, &max, &sigma, 0, 1, 1);
+ &bg, &max, &sigma, 1, 1);
mean_intensity += intensity;
mean_bg += bg;
@@ -183,7 +183,7 @@ static void fifth_integration_check(struct image *image, int n_trials,
}
}
integrate_peak(image, 64, 64, &fsp, &ssp, &intensity,
- &bg, &max, &sigma, 0, 1, 0);
+ &bg, &max, &sigma, 1, 0);
mean_intensity += intensity;
mean_bg += bg;
@@ -245,7 +245,7 @@ static void sixth_integration_check(struct image *image, int n_trials,
}
}
integrate_peak(image, 64, 64, &fsp, &ssp, &intensity,
- &bg, &max, &sigma, 0, 1, 0);
+ &bg, &max, &sigma, 1, 0);
mean_intensity += intensity;
mean_bg += bg;
@@ -327,7 +327,7 @@ int main(int argc, char *argv[])
/* First check: no intensity -> zero intensity and bg */
integrate_peak(&image, 64, 64, &fsp, &ssp, &intensity,
- &bg, &max, &sigma, 0, 1, 1);
+ &bg, &max, &sigma, 1, 1);
STATUS(" First check: intensity = %.2f, bg = %.2f, max = %.2f,"
" sigma = %.2f\n", intensity, bg, max, sigma);
if ( intensity != 0.0 ) {
@@ -347,7 +347,7 @@ int main(int argc, char *argv[])
}
}
integrate_peak(&image, 64, 64, &fsp, &ssp, &intensity,
- &bg, &max, &sigma, 0, 1, 1);
+ &bg, &max, &sigma, 1, 1);
STATUS(" Second check: intensity = %.2f, bg = %.2f, max = %.2f,"
" sigma = %.2f\n", intensity, bg, max, sigma);
if ( fabs(intensity - M_PI*9.0*9.0*1000.0) > 4000.0 ) {