Changeset 38292
- Timestamp:
- May 19, 2015, 7:46:25 AM (11 years ago)
- Location:
- branches/eam_branches/ipp-20150419/Ohana/src/relphot
- Files:
-
- 3 edited
-
include/relphot.h (modified) (2 diffs)
-
src/StarOps.c (modified) (6 diffs)
-
src/setMrelCatalog.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20150419/Ohana/src/relphot/include/relphot.h
r38062 r38292 96 96 97 97 typedef struct { 98 double *flxlist; // list of measure.mag values for a given star 99 double *errlist; // mag errors for a star 100 double *wgtlist; // weights to use for mean mags 101 } StatDataSet; 102 103 typedef struct { 98 104 int Nfew; 99 105 int Ncode; … … 105 111 106 112 // NOTE: the following arrays are (possibly) pre-allocated and carried down to each 107 // thread. The first 3 (list, dlist, wlist) are used in all relphot analyses; the 108 // others are only used on the final output steps. 109 110 double *Mpsflist; // list of measure.mag values for a given star 111 double *dpsflist; // mag errors for a star 112 double *wpsflist; // weights to use for mean mags 113 114 double *Maplist; // ap mags for a star 115 double *daplist; // ap mags for a star 116 double *waplist; // ap mags for a star 117 118 double *Mkronlist; // kron mags for a star 119 double *dkronlist; // kron mag errors 120 double *wkronlist; // kron mag errors 113 // thread. The psfData are used in all relphot analyses; the others are only used on 114 // the final output steps. 115 116 StatDataSet *psfData; // one is allocated for each primary (average) photcode 117 StatDataSet *aperData; 118 StatDataSet *kronData; 121 119 122 120 double *psfqf_list; // psfqf for all filters -
branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/StarOps.c
r37116 r38292 1 1 # include "relphot.h" 2 3 static int Nmax;4 2 5 3 enum {THREAD_RUN, THREAD_DONE}; … … 20 18 int print_measure_set (Average *average, SecFilt *secfilt, Measure *measure); 21 19 22 // we want to allocate the stats list,dlist arrays only once (or once per thread). 23 // this function finds the largest array so we can allocate that max size when needed 20 // we want to allocate the StatDataSet arrays only once (or once per thread). this 21 // function finds the largest value of Nmeasure so we can allocate that max size when 22 // needed 23 static int Nmax; 24 24 void initMrel (Catalog *catalog, int Ncatalog) { 25 25 … … 54 54 } 55 55 56 void SetMrelInfoInit (SetMrelInfo *results, int allocLists) { 56 StatDataSet *StatDataSetAlloc (int Nsecfilt, int Nmax) { 57 58 int i; 59 60 StatDataSet *dataset = NULL; 61 ALLOCATE (dataset, StatDataSet, Nsecfilt); 62 for (i = 0; i < Nsecfilt; i++) { 63 ALLOCATE (dataset[i].flxlist, double, Nmax); 64 ALLOCATE (dataset[i].wgtlist, double, Nmax); 65 ALLOCATE (dataset[i].errlist, double, Nmax); 66 } 67 return dataset; 68 } 69 70 void StatDataSetFree (StatDataSet *, int Nsecfilt) { 71 72 int i; 73 74 for (i = 0; i < Nsecfilt; i++) { 75 FREE (dataset[i].flxlist); 76 FREE (dataset[i].wgtlist); 77 FREE (dataset[i].errlist); 78 } 79 FREE (dataset); 80 } 81 82 void SetMrelInfoReset (SetMrelInfo *results) { 57 83 results->Nfew = 0; 58 84 results->Ncode = 0; … … 62 88 results->Nmos = 0; 63 89 results->Ngrid = 0; 90 } 91 92 void SetMrelInfoInit (SetMrelInfo *results, int allocLists) { 93 SetMrelInfoReset (results); 64 94 if (allocLists) { 65 ALLOCATE (results->Mpsflist, double, Nmax); 66 ALLOCATE (results->dpsflist, double, Nmax); 67 ALLOCATE (results->wpsflist, double, Nmax); 95 results->Nsecfilt = GetPhotcodeNsecfilt (); 96 results->psfData = StatDataSetAlloc (results->Nsecfilt, Nmax); 97 results->aperData = StatDataSetAlloc (results->Nsecfilt, Nmax); 98 results->kronData = StatDataSetAlloc (results->Nsecfilt, Nmax); 99 ALLOCATE (results->psfqf_list, double, Nmax); 100 ALLOCATE (results->psfqfperf_list, double, Nmax); 101 ALLOCATE (results->stargal_list, double, Nmax); 102 } else { 103 results->Nsecfilt = 0; 104 results->psfData = NULL; 105 results->aperData = NULL; 106 results->kronData = NULL; 107 results->psfqf_list = NULL; 108 results->psfqfperf_list = NULL; 109 results->stargal_list = NULL; 68 110 } 69 111 } 70 112 71 113 void SetMrelInfoFree (SetMrelInfo *results) { 72 free (results->Mpsflist); 73 free (results->dpsflist); 74 free (results->wpsflist); 114 StatDataSetFree (results->psfdata, results->Nsecfilt); 115 StatDataSetFree (results->aperdata, results->Nsecfilt); 116 StatDataSetFree (results->krondata, results->Nsecfilt); 117 FREE (results.psfqf_list); 118 FREE (results.psfqfperf_list); 119 FREE (results.stargal_list); 75 120 } 76 121 … … 162 207 SetMrelInfoInit (&results, TRUE); // allocates results->list,dlist,wlist 163 208 164 ALLOCATE (results.Maplist, double, Nmax);165 ALLOCATE (results.daplist, double, Nmax);166 ALLOCATE (results.waplist, double, Nmax);167 168 ALLOCATE (results.Mkronlist, double, Nmax);169 ALLOCATE (results.dkronlist, double, Nmax);170 ALLOCATE (results.wkronlist, double, Nmax);171 172 ALLOCATE (results.psfqf_list, double, Nmax);173 ALLOCATE (results.psfqfperf_list, double, Nmax);174 ALLOCATE (results.stargal_list, double, Nmax);175 176 209 for (i = 0; i < Ncatalog; i++) { 177 210 switch (SET_MREL_VERSION) { … … 191 224 192 225 SetMrelInfoFree (&results); 193 free (results.Maplist);194 free (results.daplist);195 free (results.waplist);196 197 free (results.Mkronlist);198 free (results.dkronlist);199 free (results.wkronlist);200 201 free (results.psfqf_list);202 free (results.psfqfperf_list);203 free (results.stargal_list);204 226 return (TRUE); 205 227 } -
branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/setMrelCatalog.c
r38289 r38292 40 40 off_t j; 41 41 42 liststats_setmode (&results->psfstats, STATMODE);43 liststats_setmode (&results->apstats, STATMODE);42 liststats_setmode (&results->psfstats, STATMODE); 43 liststats_setmode (&results->apstats, STATMODE); 44 44 liststats_setmode (&results->kronstats, STATMODE); 45 45 46 SetMrelInfo Init (results, FALSE); // do not allocate list,dlist,wlist arrays46 SetMrelInfoReset (results); // reset the countesrs 47 47 48 48 int isSetMrelFinal = (pass >= 0); 49 50 // XX char *primaryCell = NULL;51 // XX if (isSetMrelFinal) {52 // XX ALLOCATE (primaryCell, char, DVO_MAX_PATH);53 // XX }54 49 55 50 for (j = 0; j < catalog[Nc].Naverage; j++) {
Note:
See TracChangeset
for help on using the changeset viewer.
