GIRAFFE Pipeline Reference Manual

gimodel.c
1 /* $Id$
2  *
3  * This file is part of the GIRAFFE Pipeline
4  * Copyright (C) 2002-2006 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /*
22  * $Author$
23  * $Date$
24  * $Revision$
25  * $Name$
26  */
27 
28 #ifdef HAVE_CONFIG_H
29 # include <config.h>
30 #endif
31 
32 #include <math.h>
33 #include <string.h>
34 
35 #include <cxtypes.h>
36 #include <cxmemory.h>
37 #include <cxmessages.h>
38 #include <cxstrutils.h>
39 
40 #include <cpl_error.h>
41 
42 #include "gierror.h"
43 #include "gimodels.h"
44 
45 
54 inline static void
55 _giraffe_model_set_flag(GiModel *self, cxint idx, cxbool value)
56 {
57 
58  cx_assert(self != NULL);
59 
60  if (self->parameters.flags == NULL) {
61  self->parameters.flags = cx_calloc(self->parameters.count,
62  sizeof(cxint));
63  }
64 
65  if (value == TRUE) {
66  if (self->parameters.flags[idx] == 0) {
67  self->parameters.flags[idx] = 1;
68  self->fit.nfree += 1;
69  }
70  }
71  else {
72  if (self->parameters.flags[idx] == 1) {
73  self->parameters.flags[idx] = 0;
74  self->fit.nfree -= 1;
75  }
76  }
77 
78  return;
79 
80 }
81 
82 
83 inline static cxbool
84 _giraffe_model_get_flag(const GiModel *self, cxint idx)
85 {
86 
87  cx_assert(self != NULL);
88 
89  if (self->parameters.flags == NULL) {
90  return FALSE;
91  }
92 
93  return self->parameters.flags[idx] == 0 ? FALSE : TRUE;
94 
95 }
96 
97 
98 inline static cxdouble
99 _giraffe_compute_rsquare(cxdouble rss, cpl_matrix *y, cxint n)
100 {
101 
102  register cxint i;
103 
104  register cxdouble my = 0.;
105  register cxdouble sy = 0.;
106  register cxdouble ss = 0.;
107 
108  cxdouble r = 0.;
109  cxdouble *_y = cpl_matrix_get_data(y);
110 
111 
112  if (n < 1) {
113  return 0.;
114  }
115 
116  for (i = 0; i < n; i++) {
117  my += _y[i];
118  }
119  my /= n;
120 
121 
122  for (i = 0; i < n; i++) {
123  sy = _y[i] - my;
124  ss += sy * sy;
125  }
126 
127  r = rss / ss;
128 
129  if (isnan(r)) {
130  return 0.;
131  }
132 
133  return 1. - r;
134 
135 }
136 
137 
138 inline static cxint
139 _giraffe_model_fit(GiModel *self, cpl_matrix *x, cpl_matrix *y,
140  cpl_matrix *sigma, cxint ndata, cxint start,
141  cxint stride)
142 {
143 
144  cxint status = 0;
145 
146  cxdouble _chisq = 0.;
147 
148  GiFitParams setup;
149 
150 
151  if ((cpl_matrix_get_nrow(x) != cpl_matrix_get_nrow(y)) ||
152  (cpl_matrix_get_nrow(x) != cpl_matrix_get_nrow(sigma))) {
153  return -128;
154  }
155 
156  if (cpl_matrix_get_ncol(x) != self->arguments.count) {
157  return -128;
158  }
159 
160 
161  /*
162  * Check data selection range
163  */
164 
165  if (cpl_matrix_get_nrow(y) <= start + stride * (ndata - 1)) {
166  return -255;
167  }
168 
169 
170  /*
171  * Setup the fit
172  */
173 
174  setup.iterations = self->fit.setup.iterations;
175  setup.tests = self->fit.setup.tests;
176  setup.dchisq = self->fit.setup.delta;
177 
178  if (self->fit.covariance != NULL) {
179  cpl_matrix_set_size(self->fit.covariance, self->parameters.count,
180  self->parameters.count);
181  cpl_matrix_fill(self->fit.covariance, 0.);
182  }
183  else {
184  self->fit.covariance = cpl_matrix_new(self->parameters.count,
185  self->parameters.count);
186  }
187 
188 
189  /*
190  * Fit the data
191  */
192 
193  giraffe_error_push();
194 
195  status = giraffe_nlfit(x, y, sigma, ndata, self->parameters.values,
196  self->parameters.limits, self->parameters.flags,
197  self->parameters.count, self->fit.covariance,
198  &_chisq, self->model, &setup);
199 
200  if (status < 0) {
201 
202  if (cpl_error_get_code() == CPL_ERROR_NONE) {
203  giraffe_error_pop();
204  }
205 
206  return status;
207 
208  }
209 
210  if (cpl_error_get_code() != CPL_ERROR_NONE) {
211  return -255;
212  }
213 
214  giraffe_error_pop();
215 
216  self->fit.df = ndata - self->fit.nfree;
217  self->fit.iterations = status;
218  self->fit.chisq = _chisq;
219  self->fit.rsquare = _giraffe_compute_rsquare(self->fit.chisq, y, ndata);
220 
221  return 0;
222 
223 }
224 
225 
226 GiModel *
227 giraffe_model_new(const cxchar *name)
228 {
229 
230  register cxint i = 0;
231 
232  GiModel *self = NULL;
233 
234 
235  if (name == NULL) {
236  return NULL;
237  }
238 
239  while (giraffe_models[i].name != NULL) {
240 
241  if (strcmp(name, giraffe_models[i].name) == 0) {
242 
243  self = cx_calloc(1, sizeof(GiModel));
244 
245  giraffe_error_push();
246 
247  giraffe_models[i].ctor(self, &giraffe_models[i]);
248 
249  if (cpl_error_get_code() != CPL_ERROR_NONE) {
250 
251  giraffe_model_delete(self);
252  self = NULL;
253 
254  break;
255 
256  }
257 
258  break;
259 
260  }
261 
262  ++i;
263 
264  }
265 
266  self->fit.setup.iterations = 0;
267  self->fit.setup.tests = 0;
268  self->fit.setup.delta = 0.;
269 
270  self->fit.iterations = 0;
271  self->fit.nfree = 0;
272  self->fit.df = 0;
273  self->fit.covariance = NULL;
274 
275  return self;
276 
277 }
278 
279 
280 GiModel *
281 giraffe_model_clone(const GiModel *other)
282 {
283 
284  GiModel *self = NULL;
285 
286 
287  if (other != NULL) {
288 
289  self = giraffe_model_new(other->name);
290 
291  /*
292  * The model constructor creates already an a property list and
293  * a matrix as container for the argument and parameter names and
294  * values. We get rid of them here before we create the copies.
295  * This way is simpler than copying each argument and parameter
296  * individually.
297  */
298 
299  cpl_propertylist_delete(self->arguments.names);
300  self->arguments.names =
301  cpl_propertylist_duplicate(other->arguments.names);
302 
303  cpl_matrix_delete(self->arguments.values);
304  self->arguments.values =
305  cpl_matrix_duplicate(other->arguments.values);
306 
307  self->arguments.count = other->arguments.count;
308 
309  cx_assert(cpl_propertylist_get_size(self->arguments.names) ==
310  self->arguments.count);
311  cx_assert(cpl_matrix_get_nrow(self->arguments.values) *
312  cpl_matrix_get_ncol(self->arguments.values) ==
313  self->arguments.count);
314 
315 
316  cpl_propertylist_delete(self->parameters.names);
317  self->parameters.names =
318  cpl_propertylist_duplicate(other->parameters.names);
319 
320  cpl_matrix_delete(self->parameters.values);
321  self->parameters.values =
322  cpl_matrix_duplicate(other->parameters.values);
323 
324  self->parameters.count = other->parameters.count;
325 
326  cx_assert(cpl_propertylist_get_size(self->parameters.names) ==
327  self->parameters.count);
328  cx_assert(cpl_matrix_get_nrow(self->parameters.values) *
329  cpl_matrix_get_ncol(self->parameters.values) ==
330  self->parameters.count);
331 
332  self->fit.setup = other->fit.setup;
333  self->fit.iterations = other->fit.iterations;
334  self->fit.nfree = other->fit.nfree;
335  self->fit.df = other->fit.df;
336 
337  if (other->fit.covariance == NULL) {
338  self->fit.covariance = NULL;
339  }
340  else {
341  self->fit.covariance =
342  cpl_matrix_duplicate(other->fit.covariance);
343  }
344 
345  }
346 
347  return self;
348 
349 }
350 
351 void
352 giraffe_model_delete(GiModel *self)
353 {
354 
355  if (self) {
356 
357  register cxint i = 0;
358 
359  while (giraffe_models[i].name != NULL) {
360 
361  if (strcmp(self->name, giraffe_models[i].name) == 0) {
362  giraffe_models[i].dtor(self);
363  cx_free(self);
364 
365  break;
366  }
367 
368  ++i;
369 
370  }
371 
372  }
373 
374  return;
375 
376 }
377 
378 
379 const cxchar *
380 giraffe_model_get_name(const GiModel *self)
381 {
382 
383  cx_assert(self != NULL);
384  return self->name;
385 
386 }
387 
388 
389 GiModelType
390 giraffe_model_get_type(const GiModel *self)
391 {
392 
393  cx_assert(self != NULL);
394  return self->type;
395 
396 }
397 
398 
399 cxsize
400 giraffe_model_count_arguments(const GiModel *self)
401 {
402 
403  cx_assert(self != NULL);
404  return self->arguments.count;
405 
406 }
407 
408 
409 cxsize
410 giraffe_model_count_parameters(const GiModel *self)
411 {
412 
413  cx_assert(self != NULL);
414  return self->parameters.count;
415 
416 }
417 
418 
419 const cxchar*
420 giraffe_model_argument_name(const GiModel* self, cxsize position)
421 {
422 
423  const cpl_property* p = NULL;
424 
425 
426  cx_assert(self != NULL);
427 
428  p = cpl_propertylist_get(self->arguments.names, position);
429  if (p == NULL) {
430  return NULL;
431  }
432 
433  return cpl_property_get_name(p);
434 
435 }
436 
437 
438 const cxchar*
439 giraffe_model_parameter_name(const GiModel* self, cxsize position)
440 {
441 
442  const cpl_property* p = NULL;
443 
444 
445  cx_assert(self != NULL);
446 
447  p = cpl_propertylist_get(self->parameters.names, position);
448  if (p == NULL) {
449  return NULL;
450  }
451 
452  return cpl_property_get_name(p);
453 
454 }
455 
456 
457 cxint
458 giraffe_model_set_argument(GiModel *self, const cxchar *name, cxdouble value)
459 {
460 
461  const cxchar *const fctid = "giraffe_model_set_argument";
462 
463 
464  cx_assert(self != NULL);
465 
466  if (name == NULL) {
467  cpl_error_set(fctid, CPL_ERROR_NULL_INPUT);
468  return 1;
469  }
470 
471  if (!cpl_propertylist_has(self->arguments.names, name)) {
472  cpl_error_set(fctid, CPL_ERROR_ILLEGAL_INPUT);
473  return 1;
474  }
475  else {
476 
477  register cxint idx = cpl_propertylist_get_int(self->arguments.names,
478  name);
479 
480  cpl_matrix_set(self->arguments.values, idx, 0, value);
481 
482  }
483 
484  return 0;
485 
486 }
487 
488 
489 cxdouble
490 giraffe_model_get_argument(const GiModel *self, const cxchar *name)
491 {
492 
493  const cxchar *const fctid = "giraffe_model_get_argument";
494 
495  register cxint idx;
496 
497 
498  cx_assert(self != NULL);
499 
500  if (name == NULL) {
501  cpl_error_set(fctid, CPL_ERROR_NULL_INPUT);
502  return 0.;
503  }
504 
505  if (!cpl_propertylist_has(self->arguments.names, name)) {
506  cpl_error_set(fctid, CPL_ERROR_ILLEGAL_INPUT);
507  return 0.;
508  }
509 
510 
511  idx = cpl_propertylist_get_int(self->arguments.names, name);
512 
513  return cpl_matrix_get(self->arguments.values, idx, 0);
514 
515 }
516 
517 
518 cxint
519 giraffe_model_set_parameter(GiModel *self, const cxchar *name,
520  cxdouble value)
521 {
522 
523  const cxchar *const fctid = "giraffe_model_set_parameter";
524 
525 
526  cx_assert(self != NULL);
527 
528  if (name == NULL) {
529  cpl_error_set(fctid, CPL_ERROR_NULL_INPUT);
530  return 1;
531  }
532 
533  if (!cpl_propertylist_has(self->parameters.names, name)) {
534  cpl_error_set(fctid, CPL_ERROR_ILLEGAL_INPUT);
535  return 1;
536  }
537  else {
538 
539  register cxint idx = cpl_propertylist_get_int(self->parameters.names,
540  name);
541 
542  cpl_matrix_set(self->parameters.values, idx, 0, value);
543 
544  }
545 
546  return 0;
547 
548 }
549 
550 
551 cxdouble
552 giraffe_model_get_parameter(const GiModel *self, const cxchar *name)
553 {
554 
555  const cxchar *const fctid = "giraffe_model_get_parameter";
556 
557  register cxint idx;
558 
559 
560  cx_assert(self != NULL);
561 
562  if (name == NULL) {
563  cpl_error_set(fctid, CPL_ERROR_NULL_INPUT);
564  return 0.;
565  }
566 
567  if (!cpl_propertylist_has(self->parameters.names, name)) {
568  cpl_error_set(fctid, CPL_ERROR_ILLEGAL_INPUT);
569  return 0.;
570  }
571 
572 
573  idx = cpl_propertylist_get_int(self->parameters.names, name);
574 
575  return cpl_matrix_get(self->parameters.values, idx, 0);
576 
577 }
578 
579 
580 cxint
581 giraffe_model_freeze_parameter(GiModel *self, const cxchar *name)
582 {
583 
584  const cxchar *const fctid = "giraffe_model_freeze_parameter";
585 
586 
587  if (self == NULL) {
588  cpl_error_set(fctid, CPL_ERROR_NULL_INPUT);
589  return 1;
590  }
591 
592  if (name == NULL) {
593  cpl_error_set(fctid, CPL_ERROR_NULL_INPUT);
594  return 1;
595  }
596 
597  if (!cpl_propertylist_has(self->parameters.names, name)) {
598  cpl_error_set(fctid, CPL_ERROR_ILLEGAL_INPUT);
599  return 1;
600  }
601  else {
602 
603  register cxint idx = cpl_propertylist_get_int(self->parameters.names,
604  name);
605 
606  _giraffe_model_set_flag(self, idx, FALSE);
607 
608  }
609 
610  return 0;
611 
612 }
613 
614 
615 cxint
616 giraffe_model_thaw_parameter(GiModel *self, const cxchar *name)
617 {
618 
619  const cxchar *const fctid = "giraffe_model_thaw_parameter";
620 
621 
622  cx_assert(self != NULL);
623 
624  if (name == NULL) {
625  cpl_error_set(fctid, CPL_ERROR_NULL_INPUT);
626  return 1;
627  }
628 
629  if (!cpl_propertylist_has(self->parameters.names, name)) {
630  cpl_error_set(fctid, CPL_ERROR_ILLEGAL_INPUT);
631  return 1;
632  }
633  else {
634 
635  register cxint idx = cpl_propertylist_get_int(self->parameters.names,
636  name);
637 
638  _giraffe_model_set_flag(self, idx, TRUE);
639 
640  }
641 
642  return 0;
643 
644 }
645 
646 
647 cxbool
648 giraffe_model_frozen_parameter(const GiModel *self, const cxchar *name)
649 {
650 
651  const cxchar *const fctid = "giraffe_model_frozen_parameter";
652 
653  register cxint idx;
654 
655 
656  cx_assert(self != NULL);
657 
658  if (name == NULL) {
659  cpl_error_set(fctid, CPL_ERROR_NULL_INPUT);
660  return FALSE;
661  }
662 
663  if (!cpl_propertylist_has(self->parameters.names, name)) {
664  cpl_error_set(fctid, CPL_ERROR_ILLEGAL_INPUT);
665  return FALSE;
666  }
667 
668 
669  idx = cpl_propertylist_get_int(self->parameters.names, name);
670 
671  return _giraffe_model_get_flag(self, idx) == FALSE;
672 
673 }
674 
675 
676 cxint
677 giraffe_model_freeze(GiModel *self)
678 {
679 
680  register cxint i;
681 
682 
683  cx_assert(self != NULL);
684 
685  for (i = 0; i < cpl_propertylist_get_size(self->parameters.names); i++) {
686 
687  const cpl_property *p = cpl_propertylist_get(self->parameters.names,
688  i);
689 
690  if (p == NULL) {
691  return 1;
692  }
693 
694  _giraffe_model_set_flag(self, cpl_property_get_int(p), FALSE);
695 
696  }
697 
698  return 0;
699 
700 }
701 
702 
703 cxint
704 giraffe_model_thaw(GiModel *self)
705 {
706 
707  register cxint i;
708 
709 
710  cx_assert(self != NULL);
711 
712  for (i = 0; i < cpl_propertylist_get_size(self->parameters.names); i++) {
713 
714  const cpl_property *p = cpl_propertylist_get(self->parameters.names,
715  i);
716 
717  if (p == NULL) {
718  return 1;
719  }
720 
721  _giraffe_model_set_flag(self, cpl_property_get_int(p), TRUE);
722 
723  }
724 
725  return 0;
726 
727 }
728 
729 
730 cxint
731 giraffe_model_evaluate(const GiModel *self, cxdouble *result, cxint *status)
732 {
733 
734  const cxchar *const fctid = "giraffe_model_evaluate";
735 
736  cxdouble _result = 0.;
737  cxdouble *arg = NULL;
738  cxdouble *par = NULL;
739 
740 
741  cx_assert(self != NULL);
742 
743  arg = cpl_matrix_get_data(self->arguments.values);
744 
745  if (arg == NULL) {
746  cpl_error_set(fctid, CPL_ERROR_ILLEGAL_INPUT);
747  return 2;
748  }
749 
750  par = cpl_matrix_get_data(self->parameters.values);
751 
752  if (par == NULL) {
753  cpl_error_set(fctid, CPL_ERROR_ILLEGAL_INPUT);
754  return 3;
755  }
756 
757  giraffe_error_push();
758 
759  self->model(&_result, arg, par, self->parameters.count, NULL, NULL);
760 
761  if (cpl_error_get_code() != CPL_ERROR_NONE) {
762 
763  if (status) {
764  *status = 1;
765  }
766 
767  return 4;
768 
769  }
770 
771  giraffe_error_pop();
772 
773  *result = _result;
774  *status = 0;
775 
776  return 0;
777 
778 }
779 
780 
781 cxint
782 giraffe_model_set_iterations(GiModel *self, cxint iterations)
783 {
784 
785  cx_assert(self != NULL);
786 
787  if (iterations < 1) {
788  return 1;
789  }
790 
791  self->fit.setup.iterations = iterations;
792 
793  return 0;
794 
795 }
796 
797 
798 cxint
799 giraffe_model_get_iterations(const GiModel *self)
800 {
801 
802  cx_assert(self != NULL);
803 
804  return self->fit.setup.iterations;
805 
806 }
807 
808 
809 cxint
810 giraffe_model_set_tests(GiModel *self, cxint tests)
811 {
812 
813  cx_assert(self != NULL);
814 
815  if (tests < 1) {
816  return 1;
817  }
818 
819  self->fit.setup.tests = tests;
820 
821  return 0;
822 
823 }
824 
825 
826 cxint
827 giraffe_model_get_tests(const GiModel *self)
828 {
829 
830  cx_assert(self != NULL);
831 
832  return self->fit.setup.tests;
833 
834 }
835 
836 
837 cxint
838 giraffe_model_set_delta(GiModel *self, cxdouble delta)
839 {
840 
841  cx_assert(self != NULL);
842 
843  if (delta < 0.) {
844  return 1;
845  }
846 
847  self->fit.setup.delta = delta;
848 
849  return 0;
850 
851 }
852 
853 
854 cxdouble
855 giraffe_model_get_delta(const GiModel *self)
856 {
857 
858  cx_assert(self != NULL);
859 
860  return self->fit.setup.delta;
861 
862 }
863 
864 
865 cxint
866 giraffe_model_get_position(const GiModel *self)
867 {
868 
869  cx_assert(self != NULL);
870 
871  if (self->fit.iterations <= 0) {
872  return -1;
873  }
874 
875  return self->fit.iterations;
876 
877 }
878 
879 
880 cxdouble
881 giraffe_model_get_variance(const GiModel *self, const cxchar *name)
882 {
883 
884  const cxchar *const fctid = "giraffe_model_get_variance";
885 
886 
887  cxdouble variance = 0.;
888 
889 
890  cx_assert(self != NULL);
891 
892  if (name == NULL) {
893  cpl_error_set(fctid, CPL_ERROR_NULL_INPUT);
894  return variance;
895  }
896 
897  if (!cpl_propertylist_has(self->parameters.names, name)) {
898  cpl_error_set(fctid, CPL_ERROR_ILLEGAL_INPUT);
899  return variance;
900  }
901  else {
902 
903  if (self->fit.covariance == NULL) {
904  cpl_error_set(fctid, CPL_ERROR_DATA_NOT_FOUND);
905  return variance;
906  }
907  else {
908 
909  register cxint idx =
910  cpl_propertylist_get_int(self->parameters.names, name);
911 
912  variance = cpl_matrix_get(self->fit.covariance, idx, idx);
913 
914  }
915 
916  }
917 
918  return variance;
919 
920 }
921 
922 
923 cxdouble
924 giraffe_model_get_sigma(const GiModel *self, const cxchar *name)
925 {
926 
927  const cxchar *const fctid = "giraffe_model_get_sigma";
928 
929 
930  cxdouble sigma = 0.;
931 
932 
933  cx_assert(self != NULL);
934 
935  if (name == NULL) {
936  cpl_error_set(fctid, CPL_ERROR_NULL_INPUT);
937  return sigma;
938  }
939 
940  if (!cpl_propertylist_has(self->parameters.names, name)) {
941  cpl_error_set(fctid, CPL_ERROR_ILLEGAL_INPUT);
942  return sigma;
943  }
944  else {
945 
946  if (self->fit.covariance == NULL) {
947  cpl_error_set(fctid, CPL_ERROR_DATA_NOT_FOUND);
948  return sigma;
949  }
950  else {
951 
952  register cxint idx =
953  cpl_propertylist_get_int(self->parameters.names, name);
954 
955  sigma = cpl_matrix_get(self->fit.covariance, idx, idx);
956 
957  if (isnan(sigma) || sigma < 0.) {
958  sigma = 0.;
959  }
960  else {
961  sigma = sqrt(sigma);
962  }
963 
964  }
965 
966  }
967 
968  return sigma;
969 
970 }
971 
972 
973 cxint
974 giraffe_model_get_df(const GiModel *self)
975 {
976 
977  cx_assert(self != NULL);
978 
979  return self->fit.df;
980 
981 }
982 
983 
984 cxdouble
985 giraffe_model_get_chisq(const GiModel *self)
986 {
987 
988  cx_assert(self != NULL);
989 
990  return self->fit.chisq;
991 
992 }
993 
994 
995 cxdouble
996 giraffe_model_get_rsquare(const GiModel *self)
997 {
998 
999  cx_assert(self != NULL);
1000 
1001  return self->fit.rsquare;
1002 
1003 }
1004 
1005 
1006 cxint
1007 giraffe_model_fit(GiModel *self, cpl_matrix *x, cpl_matrix *y,
1008  cpl_matrix *sigma)
1009 {
1010 
1011  cxint ndata = 0;
1012 
1013 
1014  cx_assert(self != NULL);
1015 
1016  if (x == NULL || y == NULL) {
1017  return -128;
1018  }
1019 
1020  if (sigma == NULL) {
1021  return -128;
1022  }
1023 
1024  ndata = cpl_matrix_get_nrow(y);
1025 
1026  return _giraffe_model_fit(self, x, y, sigma, ndata, 0, 1);
1027 
1028 }
1029 
1030 
1031 cxint
1032 giraffe_model_fit_sequence(GiModel *self, cpl_matrix *x, cpl_matrix *y,
1033  cpl_matrix *sigma, cxint ndata, cxint start,
1034  cxint stride)
1035 {
1036 
1037  cx_assert(self != NULL);
1038 
1039  /* FIXME: Currently only (start == 0 && stride == 1) is supported! */
1040  cx_assert((start == 0) || (stride == 1));
1041 
1042 
1043  if (x == NULL || y == NULL) {
1044  return -128;
1045  }
1046 
1047  if (sigma == NULL) {
1048  return -128;
1049  }
1050 
1051  if ((start < 0) || (stride < 0)) {
1052  return -128;
1053  }
1054 
1055  return _giraffe_model_fit(self, x, y, sigma, ndata, 0, 1);
1056 
1057 }

This file is part of the GIRAFFE Pipeline Reference Manual 2.12.
Documentation copyright © 2002-2006 European Southern Observatory.
Generated on Mon Mar 24 2014 11:43:52 by doxygen 1.8.2 written by Dimitri van Heesch, © 1997-2004