diff options
author | Thomas White <taw@physics.org> | 2019-05-10 13:59:38 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2019-05-14 10:02:50 +0200 |
commit | d88e1e65f971e19c6a66155bf67776fe3875098d (patch) | |
tree | d423174ff8fc9c147889fb1df7b9181b1cbbf55c /libcrystfel/src/spectrum.h | |
parent | 2c31a5060a7f522e6facece025af90a29e154f27 (diff) |
Sketch out Spectrum API
Diffstat (limited to 'libcrystfel/src/spectrum.h')
-rw-r--r-- | libcrystfel/src/spectrum.h | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/libcrystfel/src/spectrum.h b/libcrystfel/src/spectrum.h new file mode 100644 index 00000000..abce55a2 --- /dev/null +++ b/libcrystfel/src/spectrum.h @@ -0,0 +1,87 @@ +/* + * spectrum.h + * + * A class representing a radiation spectrum + * + * Copyright © 2019 Deutsches Elektronen-Synchrotron DESY, + * a research centre of the Helmholtz Association. + * + * Authors: + * 2019 Thomas White <taw@physics.org> + * + * 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 <http://www.gnu.org/licenses/>. + * + */ + +#ifndef SPECTRUM_H +#define SPECTRUM_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + + +/** + * \file spectrum.h + * Data structure representing a radiation spectrum + */ + +/** + * This data structure is opaque. You must use the available accessor functions + * to read and write its contents. + **/ +typedef struct _spectrum Spectrum; + + +/** + * Structure representing a Gaussian distribution of spectral density. + */ +struct gaussian +{ + double kcen; + double sigma; + double height; +}; + + +#ifdef __cplusplus +extern "C" { +#endif + +extern Spectrum *spectrum_new(void); + +extern void spectrum_free(Spectrum *s); + +extern int spectrum_get_num_gaussians(Spectrum *s, double tol); + +extern struct gaussian spectrum_get_gaussian(Spectrum *s, int n); + +extern double spectrum_get_density_at_k(Spectrum *s, double k); + +extern void spectrum_get_range(Spectrum *s, double tol, + double *kmin, double *kmax); + +extern void spectrum_set_gaussians(Spectrum *s, struct gaussian *gs, + int n_gauss); + +extern void spectrum_set_histogram(Spectrum *s, double *kcens, double *heights, + int nbins); + +#ifdef __cplusplus +} +#endif + +#endif /* SPECTRUM_H */ |