47 giraffe_integrate_flux(GiImage *spectrum, GiRange *limits)
66 cpl_image *_flux = NULL;
71 if (properties == NULL || _spectrum == NULL) {
76 if (!cpl_propertylist_has(properties, GIALIAS_BINWLMIN)) {
80 wmin = cpl_propertylist_get_double(properties, GIALIAS_BINWLMIN);
83 if (!cpl_propertylist_has(properties, GIALIAS_BINWLMAX)) {
87 wmax = cpl_propertylist_get_double(properties, GIALIAS_BINWLMAX);
90 if (!cpl_propertylist_has(properties, GIALIAS_BINSTEP)) {
94 wstep = cpl_propertylist_get_double(properties, GIALIAS_BINSTEP);
102 last = cpl_image_get_size_y(_spectrum) - 1;
109 fstart = pixel - first;
126 nx = cpl_image_get_size_x(_spectrum);
128 _flux = cpl_image_new(nx, 1, CPL_TYPE_DOUBLE);
135 cxdouble *data = cpl_image_get_data(_spectrum);
136 cxdouble *fx = cpl_image_get_data(_flux);
138 for (k = first; k < last; ++k) {
140 for (i = 0; i < nx; i++) {
141 fx[i] += data[k * nx + i];
154 if ((first - 1) >= 0) {
156 cxint j = (first - 1) * nx;
158 cxdouble *data = cpl_image_get_data(_spectrum);
159 cxdouble *fx = cpl_image_get_data(_flux);
162 for (i = 0; i < nx; i++) {
163 fx[i] += data[j + i] * fstart;
168 if ((last + 1 ) < cpl_image_get_size_y(_spectrum)) {
172 cxdouble *data = cpl_image_get_data(_spectrum);
173 cxdouble *fx = cpl_image_get_data(_flux);
176 for (i = 0; i < nx; i++) {
177 fx[i] += data[j + i] * fend;
184 cpl_image_delete(_flux);