39 giraffe_integrate_flux(GiImage *spectrum, GiRange *limits)
58 cpl_image *_flux = NULL;
63 if (properties == NULL || _spectrum == NULL) {
68 if (!cpl_propertylist_has(properties, GIALIAS_BINWLMIN)) {
72 wmin = cpl_propertylist_get_double(properties, GIALIAS_BINWLMIN);
75 if (!cpl_propertylist_has(properties, GIALIAS_BINWLMAX)) {
79 wmax = cpl_propertylist_get_double(properties, GIALIAS_BINWLMAX);
82 if (!cpl_propertylist_has(properties, GIALIAS_BINSTEP)) {
86 wstep = cpl_propertylist_get_double(properties, GIALIAS_BINSTEP);
94 last = cpl_image_get_size_y(_spectrum) - 1;
101 fstart = pixel - first;
118 nx = cpl_image_get_size_x(_spectrum);
120 _flux = cpl_image_new(nx, 1, CPL_TYPE_DOUBLE);
127 cxdouble *data = cpl_image_get_data(_spectrum);
128 cxdouble *fx = cpl_image_get_data(_flux);
130 for (k = first; k < last; ++k) {
132 for (i = 0; i < nx; i++) {
133 fx[i] += data[k * nx + i];
146 if ((first - 1) >= 0) {
148 cxint j = (first - 1) * nx;
150 cxdouble *data = cpl_image_get_data(_spectrum);
151 cxdouble *fx = cpl_image_get_data(_flux);
154 for (i = 0; i < nx; i++) {
155 fx[i] += data[j + i] * fstart;
160 if ((last + 1 ) < cpl_image_get_size_y(_spectrum)) {
164 cxdouble *data = cpl_image_get_data(_spectrum);
165 cxdouble *fx = cpl_image_get_data(_flux);
168 for (i = 0; i < nx; i++) {
169 fx[i] += data[j + i] * fend;
176 cpl_image_delete(_flux);
void giraffe_image_delete(GiImage *self)
Destroys an image.
cpl_propertylist * giraffe_image_get_properties(const GiImage *self)
Get the properties of an image.
cpl_image * giraffe_image_get(const GiImage *self)
Gets the image data.
GiImage * giraffe_image_new(cpl_type type)
Creates an empty image container.
cxint giraffe_image_set(GiImage *self, cpl_image *image)
Sets the image data.
cxint giraffe_image_set_properties(GiImage *self, cpl_propertylist *properties)
Attaches a property list to an image.
cxdouble giraffe_range_get_min(const GiRange *const self)
Get the minimum of a range.
cxdouble giraffe_range_get_max(const GiRange *const self)
Get the maximum of a range.