aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcrystfel/src/spectrum.c11
-rw-r--r--libcrystfel/src/spectrum.h6
2 files changed, 8 insertions, 9 deletions
diff --git a/libcrystfel/src/spectrum.c b/libcrystfel/src/spectrum.c
index 21b21f80..f1ada734 100644
--- a/libcrystfel/src/spectrum.c
+++ b/libcrystfel/src/spectrum.c
@@ -313,7 +313,7 @@ void spectrum_set_gaussians(Spectrum *s, struct gaussian *gs, int n_gauss)
/* Samples must already have been sorted */
-static void normalise_histogram(double *k, double *pdf, int n)
+static void normalise_pdf(double *k, double *pdf, int n)
{
int i;
double total_area = 0.0;
@@ -325,7 +325,7 @@ static void normalise_histogram(double *k, double *pdf, int n)
old_pdf = pdf[i];
}
- printf("total area under histogram = %f\n", total_area);
+ printf("total area under PDF = %f\n", total_area);
for ( i=0; i<n; i++ ) {
pdf[i] /= total_area;
@@ -348,8 +348,7 @@ static void normalise_histogram(double *k, double *pdf, int n)
* The input arrays will be copied, so you can safely free them after calling
* this function.
*/
-void spectrum_set_histogram(Spectrum *s, double *kvals, double *heights,
- int n)
+void spectrum_set_pdf(Spectrum *s, double *kvals, double *heights, int n)
{
/* Free old contents (if any - may be NULL) */
free(s->gaussians);
@@ -368,7 +367,7 @@ void spectrum_set_histogram(Spectrum *s, double *kvals, double *heights,
s->rep = SPEC_HISTOGRAM;
gsl_sort2(s->k, 1, s->pdf, 1, n);
- normalise_histogram(s->k, s->pdf, s->n_samples);
+ normalise_pdf(s->k, s->pdf, s->n_samples);
}
@@ -397,7 +396,7 @@ static int read_esrf_spectrum(FILE *fh, Spectrum *s)
}
- spectrum_set_histogram(s, k, samp, n_bins);
+ spectrum_set_pdf(s, k, samp, n_bins);
free(k);
free(samp);
diff --git a/libcrystfel/src/spectrum.h b/libcrystfel/src/spectrum.h
index b3786c53..d31318fd 100644
--- a/libcrystfel/src/spectrum.h
+++ b/libcrystfel/src/spectrum.h
@@ -72,9 +72,9 @@ extern void spectrum_set_gaussians(Spectrum *s, struct gaussian *gs,
extern int spectrum_get_num_gaussians(Spectrum *s);
extern struct gaussian spectrum_get_gaussian(Spectrum *s, int n);
-/* Representation as histogram */
-extern void spectrum_set_histogram(Spectrum *s, double *kcens, double *heights,
- int nbins);
+/* Representation as PDF */
+extern void spectrum_set_pdf(Spectrum *s, double *kcens, double *heights,
+ int nbins);
extern void spectrum_get_range(Spectrum *s, double *kmin, double *kmax);
extern double spectrum_get_density_at_k(Spectrum *s, double k);