public software.psfex

[/] [branches/] [rhl/] [src/] [field_utils.c] - Blame information for rev 191

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 191 rhl
/*
2
*                               field.c
3
*
4
* Manage multiple PSFs.
5
*
6
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7
*
8
*       This file part of:      PSFEx
9
*
10
*       Copyright:              (C) 2007-2012 Emmanuel Bertin -- IAP/CNRS/UPMC
11
*
12
*       License:                GNU General Public License
13
*
14
*       PSFEx is free software: you can redistribute it and/or modify
15
*       it under the terms of the GNU General Public License as published by
16
*       the Free Software Foundation, either version 3 of the License, or
17
*       (at your option) any later version.
18
*       PSFEx is distributed in the hope that it will be useful,
19
*       but WITHOUT ANY WARRANTY; without even the implied warranty of
20
*       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
*       GNU General Public License for more details.
22
*       You should have received a copy of the GNU General Public License
23
*       along with PSFEx.  If not, see <http://www.gnu.org/licenses/>.
24
*
25
*       Last modified:          25/06/2012
26
*
27
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
28
 
29
#ifdef HAVE_CONFIG_H
30
#include        "config.h"
31
#endif
32
 
33
#include        <math.h>
34
#include        <stdio.h>
35
#include        <stdlib.h>
36
#include        <string.h>
37
 
38
#include        "define.h"
39
#include        "types.h"
40
#include        "globals.h"
41
#include        "fits/fitscat.h"
42
#include        "check.h"
43
#include        "fitswcs.h"
44
#include        "misc.h"
45
#include        "prefs.h"
46
#include        "psf.h"
47
#include        "field.h"
48
 
49
 
50
/****** field_init_finalize ************************************************************
51
PROTO   void field_init(fieldstruct *)
52
PURPOSE Finish allocating and initializing a PSF MEF structure (groups of PSFs).
53
INPUT   fieldstruct pointer
54
OUTPUT  -.
55
NOTES   .
56
AUTHOR  E. Bertin (IAP)
57
VERSION 08/04/2010
58
 ***/
59
void
60
field_init_finalize(fieldstruct *field)
61
{
62
  int countsize = prefs.context_nsnap*prefs.context_nsnap;
63
  int e, next0 = field->next;
64
 
65
  field_locate(field);
66
  QCALLOC(field->ccat, catstruct *, MAXCHECK);
67
  countsize = prefs.context_nsnap*prefs.context_nsnap;
68
  QMALLOC(field->lcount, int *, next0);
69
  QMALLOC(field->acount, int *, next0);
70
  QMALLOC(field->count, int *, next0);
71
  QMALLOC(field->modchi2, double *, next0);
72
  QMALLOC(field->modresi, double *, next0);
73
  for (e=0; e<next0; e++)
74
    {
75
    QCALLOC(field->lcount[e], int, countsize);
76
    QCALLOC(field->acount[e], int, countsize);
77
    QCALLOC(field->count[e], int, countsize);
78
    QCALLOC(field->modchi2[e], double, countsize);
79
    QCALLOC(field->modresi[e], double, countsize);
80
    }
81
  }