Changeset 5451 for trunk/Ohana/src/opihi
- Timestamp:
- Oct 27, 2005, 7:10:17 PM (21 years ago)
- Location:
- trunk/Ohana/src/opihi
- Files:
-
- 1 added
- 28 edited
-
dvo/ImageSelection.c (modified) (2 diffs)
-
dvo/Makefile (modified) (7 diffs)
-
dvo/avextract.c (modified) (6 diffs)
-
dvo/calextract.c (modified) (5 diffs)
-
dvo/calmextract.c (modified) (5 diffs)
-
dvo/catdir.c (added)
-
dvo/ccd.c (modified) (6 diffs)
-
dvo/cmatch.c (modified) (2 diffs)
-
dvo/cmd.c (modified) (6 diffs)
-
dvo/ddmags.c (modified) (6 diffs)
-
dvo/dmagaves.c (modified) (6 diffs)
-
dvo/dmagmeas.c (modified) (6 diffs)
-
dvo/dmags.c (modified) (6 diffs)
-
dvo/dmt.c (modified) (4 diffs)
-
dvo/dvo.c (modified) (1 diff)
-
dvo/fitcolors.c (modified) (8 diffs)
-
dvo/gcat.c (modified) (3 diffs)
-
dvo/gstar.c (modified) (4 diffs)
-
dvo/imdata.c (modified) (4 diffs)
-
dvo/init.c (modified) (1 diff)
-
dvo/lcat.c (modified) (4 diffs)
-
dvo/lcurve.c (modified) (5 diffs)
-
dvo/lightcurve.c (modified) (5 diffs)
-
dvo/mextract.c (modified) (6 diffs)
-
dvo/pmeasure.c (modified) (4 diffs)
-
dvo/region_list.c (modified) (7 diffs)
-
dvo/skycat.c (modified) (5 diffs)
-
dvo/subpix.c (modified) (6 diffs)
-
include/dvo1.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/dvo/ImageSelection.c
r4585 r5451 9 9 10 10 /* load images based on parameters and region, etc */ 11 int SetImageSelection (int mode ) {11 int SetImageSelection (int mode, int RegionSelect) { 12 12 13 13 int Ngraph; 14 14 Graphdata graphsky; 15 int RegionSelect,TimeSelect;15 int TimeSelect; 16 16 time_t tzero, tend; 17 17 … … 19 19 subset = NULL; 20 20 21 RegionSelect = GetRegionSelection();22 21 if (RegionSelect) { 23 22 Ngraph = 0; -
trunk/Ohana/src/opihi/dvo/Makefile
r5442 r5451 29 29 $(SDIR)/LoadImages.$(ARCH).o \ 30 30 $(SDIR)/cmpRead.$(ARCH).o \ 31 $(SDIR)/aregion.$(ARCH).o \32 31 $(SDIR)/compare.$(ARCH).o \ 33 $(SDIR)/find_regions.$(ARCH).o \34 $(SDIR)/get_regions.$(ARCH).o \35 32 $(SDIR)/match_image.$(ARCH).o \ 36 33 $(SDIR)/photometry.$(ARCH).o \ … … 39 36 $(SDIR)/dvo.$(ARCH).o 40 37 38 # $(SDIR)/aregion.$(ARCH).o \ 39 # $(SDIR)/find_regions.$(ARCH).o \ 40 # $(SDIR)/get_regions.$(ARCH).o \ 41 41 42 cmds = \ 42 43 $(SDIR)/avextract.$(ARCH).o \ … … 44 45 $(SDIR)/calextract.$(ARCH).o \ 45 46 $(SDIR)/calmextract.$(ARCH).o \ 46 $(SDIR)/catalog.$(ARCH).o \47 47 $(SDIR)/ccd.$(ARCH).o \ 48 48 $(SDIR)/cmatch.$(ARCH).o \ … … 75 75 $(SDIR)/lightcurve.$(ARCH).o \ 76 76 $(SDIR)/mextract.$(ARCH).o \ 77 $(SDIR)/pcat.$(ARCH).o \78 77 $(SDIR)/photcodes.$(ARCH).o \ 79 78 $(SDIR)/pmeasure.$(ARCH).o \ … … 101 100 help: cmd.basic.help cmd.data.help cmd.astro.help dvo.help 102 101 102 $(funcs) $(cmds) $(libs) : $(INC)/dvo1.h 103 103 104 .PHONY: dvo 104 105 … … 106 107 107 108 # deprecated functions: verify & delete 109 #$(SDIR)/catalog.$(ARCH).o \ 108 110 #$(SDIR)/abszero.$(ARCH).o \ 109 111 #$(SDIR)/cals.$(ARCH).o \ … … 119 121 #$(SDIR)/dmagextract.$(ARCH).o \ 120 122 #$(SDIR)/ddmagextract.$(ARCH).o \ 123 #$(SDIR)/pcat.$(ARCH).o \ 121 124 122 125 # future functions, not fully implemented -
trunk/Ohana/src/opihi/dvo/avextract.c
r5320 r5451 4 4 5 5 int i, j, m, N, NPTS, param; 6 int Nsec, Nregions,mode;7 char filename[256], catdir[256],*RegionName, *RegionList, *p;6 int Nsec, mode; 7 char *RegionName, *RegionList, *p; 8 8 9 9 Catalog catalog; 10 RegionFile *regions;10 SkyList *skylist; 11 11 PhotCode *code; 12 12 Vector *vec; 13 13 14 14 /* defaults */ 15 regions = NULL;16 15 catalog.average = NULL; 17 16 catalog.secfilt = NULL; … … 25 24 if (!InitPhotcodes ()) goto escape; 26 25 Nsec = GetPhotcodeNsecfilt (); 27 28 /* find CATDIR in config system */29 if (VarConfig ("CATDIR", "%s", catdir) == NULL) goto escape;30 26 31 27 /* interpret command-line options */ … … 50 46 51 47 /* load region corresponding to selection above */ 52 if (( regions = SelectRegions (RegionName, RegionList, &Nregions)) == NULL) goto escape;48 if ((skylist = SelectRegions (RegionName, RegionList)) == NULL) goto escape; 53 49 54 50 /* create storage vector */ … … 57 53 if ((vec = SelectVector (argv[1], ANYVECTOR, TRUE)) == NULL) goto escape; 58 54 59 for (i = 0; i < Nregions; i++) {55 for (i = 0; i < skylist[0].Nregions; i++) { 60 56 /* lock, load, unlock catalog */ 61 sprintf (filename, "%s/%s", catdir, regions[i].name); 62 catalog.filename = filename; 57 catalog.filename = (char *) skylist[0].regions[i][0].filename; 63 58 switch (lock_catalog (&catalog, LCK_SOFT)) { 64 59 case 2: … … 90 85 REALLOCATE (vec[0].elements, float, MAX(1,N)); 91 86 92 if (regions != NULL) free (regions);87 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); 93 88 return (TRUE); 94 89 … … 98 93 99 94 escape: 100 if (regions != NULL) free (regions);95 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); 101 96 if (catalog.average != NULL) free (catalog.average); 102 97 if (catalog.secfilt != NULL) free (catalog.secfilt); -
trunk/Ohana/src/opihi/dvo/calextract.c
r5320 r5451 5 5 int calextract (int argc, char **argv) { 6 6 7 int i, j, m, N, Nr, Nregions,mode[2];7 int i, j, m, N, Nr, mode[2]; 8 8 int Nsec, NSTAR; 9 char filename[256], catdir[256],*RegionName, *RegionList;9 char *RegionName, *RegionList; 10 10 double M1, M2, dM2, color; 11 11 12 PhotCode *code[2]; 12 13 Catalog catalog; 13 RegionFile *regions; 14 PhotCode *code[2]; 14 SkyList *skylist; 15 15 Vector **vec; 16 16 17 17 /* these need to be freed in the end */ 18 regions = NULL;19 18 catalog.average = NULL; 20 19 catalog.secfilt = NULL; … … 27 26 if (!InitPhotcodes ()) return (FALSE); 28 27 Nsec = GetPhotcodeNsecfilt (); 29 30 /* find CATDIR in config system */31 if (VarConfig ("CATDIR", "%s", catdir) == NULL) goto escape;32 28 33 29 /* command line arguments */ … … 59 55 60 56 /* load region corresponding to selection above */ 61 if (( regions = SelectRegions (RegionName, RegionList, &Nregions)) == NULL) goto escape;57 if ((skylist = SelectRegions (RegionName, RegionList)) == NULL) goto escape; 62 58 63 for (Nr = 0; Nr < Nregions; Nr++) {59 for (Nr = 0; Nr < skylist[0].Nregions; Nr++) { 64 60 if (Nr && !(Nr % 500)) { fprintf (stderr, "."); } 65 61 66 62 /* lock, load, unlock catalog */ 67 sprintf (filename, "%s/%s", catdir, regions[Nr].name); 68 catalog.filename = filename; 63 catalog.filename = (char *) skylist[0].regions[Nr][0].filename; 69 64 switch (lock_catalog (&catalog, LCK_SOFT)) { 70 65 case 2: … … 127 122 catalog.measure = (Measure *) NULL; 128 123 } 129 if (regions != NULL) free (regions); 124 125 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); 130 126 for (i = 0; i < NVEC; i++) { 131 127 vec[i][0].Nelements = N; … … 141 137 if (RegionName != NULL) free (RegionName); 142 138 if (RegionList != NULL) free (RegionList); 143 if (regions != NULL) free (regions);139 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); 144 140 for (i = 0; i < NVEC; i++) { 145 141 DeleteVector (vec[i]); -
trunk/Ohana/src/opihi/dvo/calmextract.c
r5320 r5451 7 7 8 8 int i, j, k, m, N, N1, Nr, mode[2]; 9 int NSTAR, Nstar, Nsec , Nregions;10 char filename[256], catdir[256],*RegionName, *RegionList;9 int NSTAR, Nstar, Nsec; 10 char *RegionName, *RegionList; 11 11 double *M1, M2, dM2, color; 12 12 13 13 Catalog catalog; 14 RegionFile *regions;15 14 PhotCode *code[2]; 15 SkyList *skylist; 16 16 Vector **vec; 17 17 18 18 /* these need to be freed in the end */ 19 regions = NULL;20 19 catalog.average = NULL; 21 20 catalog.secfilt = NULL; … … 28 27 if (!InitPhotcodes ()) goto escape; 29 28 Nsec = GetPhotcodeNsecfilt (); 30 31 /* find CATDIR in config system */32 if (VarConfig ("CATDIR", "%s", catdir) == NULL) goto escape;33 29 34 30 /* command line arguments */ … … 71 67 72 68 /* load region corresponding to selection above */ 73 if (( regions = SelectRegions (RegionName, RegionList, &Nregions)) == NULL) goto escape;74 if (!SetImageSelection (MEAS_XMOSAIC )) goto escape;69 if ((skylist = SelectRegions (RegionName, RegionList)) == NULL) goto escape; 70 if (!SetImageSelection (MEAS_XMOSAIC, ((RegionName == NULL) && (RegionList == NULL)))) goto escape; 75 71 76 for (Nr = 0; Nr < Nregions; Nr++) {72 for (Nr = 0; Nr < skylist[0].Nregions; Nr++) { 77 73 if (Nr && !(Nr % 500)) { fprintf (stderr, "."); } 78 74 79 75 /* lock, load, unlock catalog */ 80 sprintf (filename, "%s/%s", catdir, regions[Nr].name); 81 catalog.filename = filename; 76 catalog.filename = (char *) skylist[0].regions[Nr][0].filename; 82 77 switch (lock_catalog (&catalog, LCK_SOFT)) { 83 78 case 2: … … 153 148 catalog.measure = (Measure *) NULL; 154 149 } 155 if (regions != NULL) free (regions); 150 151 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); 156 152 for (i = 0; i < NVEC; i++) { 157 153 vec[i][0].Nelements = N; … … 167 163 168 164 FreeImageSelection (); 169 if (regions != NULL) free (regions);165 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); 170 166 for (i = 0; i < NVEC; i++) { 171 167 DeleteVector (vec[i]); -
trunk/Ohana/src/opihi/dvo/ccd.c
r5320 r5451 3 3 int ccd (int argc, char **argv) { 4 4 5 char filename[256], catdir[256],*RegionName, *RegionList;5 char *RegionName, *RegionList; 6 6 double *M1, *M2; 7 7 int i, m, k, Npts, NPTS, N; 8 8 int N1, N2, i1, i2, mode[4]; 9 int Nsec, Nregions,KeepNulls;9 int Nsec, KeepNulls; 10 10 11 11 Catalog catalog; 12 RegionFile *regions;13 12 PhotCode *code[4]; 13 SkyList *skylist; 14 14 Vector *xvec, *yvec; 15 15 16 16 /* defaults */ 17 regions = NULL;18 17 catalog.average = NULL; 19 18 catalog.secfilt = NULL; … … 25 24 if (!InitPhotcodes ()) goto escape; 26 25 Nsec = GetPhotcodeNsecfilt (); 27 28 /* find CATDIR in config system */29 if (VarConfig ("CATDIR", "%s", catdir) == NULL) goto escape;30 26 31 27 /* interpret command-line options */ … … 51 47 52 48 /* load region corresponding to selection above */ 53 if (( regions = SelectRegions (RegionName, RegionList, &Nregions)) == NULL) goto escape;49 if ((skylist = SelectRegions (RegionName, RegionList)) == NULL) goto escape; 54 50 55 51 /* init vectors to save data */ … … 60 56 61 57 /* loop over regions, extract data for each region */ 62 for (k = 0; k < Nregions; k++) {58 for (k = 0; k < skylist[0].Nregions; k++) { 63 59 /* lock, load, unlock catalog */ 64 sprintf (filename, "%s/%s", catdir, regions[k].name); 65 catalog.filename = filename; 60 catalog.filename = (char *) skylist[0].regions[k][0].filename; 66 61 switch (lock_catalog (&catalog, LCK_SOFT)) { 67 62 case 2: … … 121 116 catalog.measure = (Measure *) NULL; 122 117 } 123 if (regions != NULL) free (regions);118 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); 124 119 xvec[0].Nelements = yvec[0].Nelements = Npts; 125 120 return (TRUE); … … 130 125 131 126 escape: 132 if (regions != NULL) free (regions);127 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); 133 128 if (catalog.average != NULL) free (catalog.average); 134 129 if (catalog.secfilt != NULL) free (catalog.secfilt); -
trunk/Ohana/src/opihi/dvo/cmatch.c
r5320 r5451 6 6 char filename[128]; 7 7 double radius; 8 char catdir[256], gscdir[256];9 8 Vector *rvec, *dvec, *mvec, *drvec, *ddvec, *dmvec; 10 9 11 VarConfig ("GSCDIR", "%s", gscdir);12 VarConfig ("CATDIR", "%s", catdir);13 14 10 if (argc != 9) { 15 11 fprintf (stderr, "USAGE: cmatch file radius (RA) (DEC) (Mag) (dRA) (dDEC) (dMag)\n"); … … 32 28 33 29 /* load data from the photometry database file */ 34 sprintf (filename, "%s/%s", catdir, argv[1]);35 30 catalog1.filename = filename; 36 31 switch (lock_catalog (&catalog1, LCK_SOFT)) { -
trunk/Ohana/src/opihi/dvo/cmd.c
r5320 r5451 3 3 int cmd (int argc, char **argv) { /* really need to think about upper limits & how to represent them */ 4 4 5 char filename[256], catdir[256],*RegionName, *RegionList;5 char *RegionName, *RegionList; 6 6 double *M1, *M3; 7 7 int i, j, m, i1, i3, N1, N3, N; 8 8 int Npts, NPTS, mode[3]; 9 int Nsec, Nregions,KeepNulls;9 int Nsec, KeepNulls; 10 10 11 PhotCode *code[3]; 11 12 Catalog catalog; 12 RegionFile *regions; 13 PhotCode *code[3]; 13 SkyList *skylist; 14 14 Vector *xvec, *yvec; 15 15 16 16 /* defaults */ 17 regions = NULL;18 17 catalog.average = NULL; 19 18 catalog.secfilt = NULL; … … 25 24 if (!InitPhotcodes ()) goto escape; 26 25 Nsec = GetPhotcodeNsecfilt (); 27 28 /* find CATDIR in config system */29 if (VarConfig ("CATDIR", "%s", catdir) == NULL) goto escape;30 26 31 27 /* interpret command-line options */ … … 49 45 50 46 /* load region corresponding to selection above */ 51 if (( regions = SelectRegions (RegionName, RegionList, &Nregions)) == NULL) goto escape;47 if ((skylist = SelectRegions (RegionName, RegionList)) == NULL) goto escape; 52 48 53 49 /* init vectors to save data */ … … 58 54 59 55 /* loop over regions, extract data for each region */ 60 for (j = 0; j < Nregions; j++) {56 for (j = 0; j < skylist[0].Nregions; j++) { 61 57 /* lock, load, unlock catalog */ 62 sprintf (filename, "%s/%s", catdir, regions[j].name); 63 catalog.filename = filename; 58 catalog.filename = (char *) skylist[0].regions[j][0].filename; 64 59 switch (lock_catalog (&catalog, LCK_SOFT)) { 65 60 case 2: … … 119 114 catalog.measure = (Measure *) NULL; 120 115 } 121 if (regions != NULL) free (regions);116 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); 122 117 xvec[0].Nelements = yvec[0].Nelements = Npts; 123 118 return (TRUE); … … 128 123 129 124 escape: 130 if (regions != NULL) free (regions);125 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); 131 126 if (catalog.average != NULL) free (catalog.average); 132 127 if (catalog.secfilt != NULL) free (catalog.secfilt); -
trunk/Ohana/src/opihi/dvo/ddmags.c
r5320 r5451 3 3 int ddmags (int argc, char **argv) { 4 4 5 char filename[256], catdir[256],*RegionName, *RegionList;5 char *RegionName, *RegionList; 6 6 double *M1, *M2; 7 7 int i, m, k, N, Npts, NPTS; 8 8 int N1, N2, i1, i2, mode[4]; 9 int Nsec, Nregions,KeepNulls;9 int Nsec, KeepNulls; 10 10 11 11 Catalog catalog; 12 RegionFile *regions;13 12 PhotCode *code[4]; 13 SkyList *skylist; 14 14 Vector *xvec, *yvec; 15 15 16 16 /* defaults */ 17 regions = NULL;18 17 catalog.average = NULL; 19 18 catalog.secfilt = NULL; … … 25 24 if (!InitPhotcodes ()) goto escape; 26 25 Nsec = GetPhotcodeNsecfilt (); 27 28 /* find CATDIR in config system */29 if (VarConfig ("CATDIR", "%s", catdir) == NULL) goto escape;30 26 31 27 /* interpret command-line options */ … … 51 47 52 48 /* load region corresponding to selection above */ 53 if (( regions = SelectRegions (RegionName, RegionList, &Nregions)) == NULL) goto escape;49 if ((skylist = SelectRegions (RegionName, RegionList)) == NULL) goto escape; 54 50 55 51 /* init vectors to save data */ … … 60 56 61 57 /* loop over regions, extract data for each region */ 62 for (k = 0; k < Nregions; k++) {58 for (k = 0; k < skylist[0].Nregions; k++) { 63 59 /* lock, load, unlock catalog */ 64 sprintf (filename, "%s/%s", catdir, regions[k].name); 65 catalog.filename = filename; 60 catalog.filename = (char *) skylist[0].regions[k][0].filename; 66 61 switch (lock_catalog (&catalog, LCK_SOFT)) { 67 62 case 2: … … 121 116 catalog.measure = (Measure *) NULL; 122 117 } 123 if (regions != NULL) free (regions);118 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); 124 119 xvec[0].Nelements = yvec[0].Nelements = Npts; 125 120 return (TRUE); … … 129 124 130 125 escape: 131 if (regions != NULL) free (regions);126 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); 132 127 if (catalog.average != NULL) free (catalog.average); 133 128 if (catalog.secfilt != NULL) free (catalog.secfilt); -
trunk/Ohana/src/opihi/dvo/dmagaves.c
r5320 r5451 3 3 int dmagaves (int argc, char **argv) { 4 4 5 char filename[256], catdir[256],*RegionName, *RegionList;5 char *RegionName, *RegionList; 6 6 double *M1, M2; 7 7 int i, j, k, m, N1; 8 8 int Npts, NPTS, param, mode[3]; 9 int Nsec , Nregions;9 int Nsec; 10 10 11 PhotCode *code[3]; 11 12 Catalog catalog; 12 RegionFile *regions; 13 PhotCode *code[3]; 13 SkyList *skylist; 14 14 Vector *xvec, *yvec; 15 15 16 16 /* defaults */ 17 regions = NULL;18 17 catalog.average = NULL; 19 18 catalog.secfilt = NULL; … … 26 25 if (!InitPhotcodes ()) goto escape; 27 26 Nsec = GetPhotcodeNsecfilt (); 28 29 /* find CATDIR in config system */30 if (VarConfig ("CATDIR", "%s", catdir) == NULL) goto escape;31 27 32 28 /* interpret command-line options */ … … 44 40 45 41 /* load region corresponding to selection above */ 46 if (( regions = SelectRegions (RegionName, RegionList, &Nregions)) == NULL) goto escape;42 if ((skylist = SelectRegions (RegionName, RegionList)) == NULL) goto escape; 47 43 48 44 /* init vectors to save data */ … … 52 48 if ((yvec = SelectVector ("yv", ANYVECTOR, TRUE)) == NULL) goto escape; 53 49 54 for (j = 0; j < Nregions; j++) {50 for (j = 0; j < skylist[0].Nregions; j++) { 55 51 /* lock, load, unlock catalog */ 56 sprintf (filename, "%s/%s", catdir, regions[j].name); 57 catalog.filename = filename; 52 catalog.filename = (char *) skylist[0].regions[j][0].filename; 58 53 switch (lock_catalog (&catalog, LCK_SOFT)) { 59 54 case 2: … … 101 96 catalog.measure = (Measure *) NULL; 102 97 } 103 if (regions != NULL) free (regions);98 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); 104 99 xvec[0].Nelements = yvec[0].Nelements = Npts; 105 100 return (TRUE); … … 110 105 111 106 escape: 112 if (regions != NULL) free (regions);107 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); 113 108 if (catalog.average != NULL) free (catalog.average); 114 109 if (catalog.secfilt != NULL) free (catalog.secfilt); -
trunk/Ohana/src/opihi/dvo/dmagmeas.c
r5320 r5451 3 3 int dmagmeas (int argc, char **argv) { 4 4 5 char filename[256], catdir[256],*RegionName, *RegionList;5 char *RegionName, *RegionList; 6 6 double *M1, *M3; 7 7 int i, j, m, i1, i3, N1, N3, N; 8 8 int Npts, NPTS, param, mode[3]; 9 int Nsec, Nregions,KeepNulls;9 int Nsec, KeepNulls; 10 10 11 11 Catalog catalog; 12 RegionFile *regions;13 12 PhotCode *code[3]; 13 SkyList *skylist; 14 14 Vector *xvec, *yvec; 15 15 16 16 /* defaults */ 17 regions = NULL;18 17 catalog.average = NULL; 19 18 catalog.secfilt = NULL; … … 26 25 if (!InitPhotcodes ()) goto escape; 27 26 Nsec = GetPhotcodeNsecfilt (); 28 29 /* find CATDIR in config system */30 if (VarConfig ("CATDIR", "%s", catdir) == NULL) goto escape;31 27 32 28 /* interpret command-line options */ … … 50 46 51 47 /* load region corresponding to selection above */ 52 if (( regions = SelectRegions (RegionName, RegionList, &Nregions)) == NULL) goto escape;53 if (!SetImageSelection (param )) goto escape;48 if ((skylist = SelectRegions (RegionName, RegionList)) == NULL) goto escape; 49 if (!SetImageSelection (param, ((RegionName == NULL) && (RegionList == NULL)))) goto escape; 54 50 55 51 /* init vectors to save data */ … … 60 56 61 57 /* loop over regions, extract data for each region */ 62 for (j = 0; j < Nregions; j++) {58 for (j = 0; j < skylist[0].Nregions; j++) { 63 59 /* lock, load, unlock catalog */ 64 sprintf (filename, "%s/%s", catdir, regions[j].name); 65 catalog.filename = filename; 60 catalog.filename = (char *) skylist[0].regions[j][0].filename; 66 61 switch (lock_catalog (&catalog, LCK_SOFT)) { 67 62 case 2: … … 122 117 } 123 118 FreeImageSelection (); 124 if (regions != NULL) free (regions);119 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); 125 120 xvec[0].Nelements = yvec[0].Nelements = Npts; 126 121 return (TRUE); … … 132 127 escape: 133 128 FreeImageSelection (); 134 if (regions != NULL) free (regions);129 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); 135 130 if (catalog.average != NULL) free (catalog.average); 136 131 if (catalog.secfilt != NULL) free (catalog.secfilt); -
trunk/Ohana/src/opihi/dvo/dmags.c
r5320 r5451 3 3 int dmags (int argc, char **argv) { 4 4 5 char filename[256], catdir[256],*RegionName, *RegionList;5 char *RegionName, *RegionList; 6 6 double *M1, *M3; 7 7 int i, j, m, i1, i3, N1, N3, N; 8 8 int Npts, NPTS, mode[3]; 9 int Nsec, Nregions,KeepNulls;9 int Nsec, KeepNulls; 10 10 11 11 PhotCode *code[3]; 12 12 Catalog catalog; 13 RegionFile *regions;13 SkyList *skylist; 14 14 Vector *xvec, *yvec; 15 15 16 16 /* defaults */ 17 regions = NULL;18 17 catalog.average = NULL; 19 18 catalog.secfilt = NULL; … … 25 24 if (!InitPhotcodes ()) goto escape; 26 25 Nsec = GetPhotcodeNsecfilt (); 27 28 /* find CATDIR in config system */29 if (VarConfig ("CATDIR", "%s", catdir) == NULL) goto escape;30 26 31 27 /* interpret command-line options */ … … 49 45 50 46 /* load region corresponding to selection above */ 51 if (( regions = SelectRegions (RegionName, RegionList, &Nregions)) == NULL) goto escape;47 if ((skylist = SelectRegions (RegionName, RegionList)) == NULL) goto escape; 52 48 53 49 /* init vectors to save data */ … … 58 54 59 55 /* loop over regions, extract data for each region */ 60 for (j = 0; j < Nregions; j++) {56 for (j = 0; j < skylist[0].Nregions; j++) { 61 57 /* lock, load, unlock catalog */ 62 sprintf (filename, "%s/%s", catdir, regions[j].name); 63 catalog.filename = filename; 58 catalog.filename = (char *) skylist[0].regions[j][0].filename; 64 59 switch (lock_catalog (&catalog, LCK_SOFT)) { 65 60 case 2: … … 119 114 catalog.measure = (Measure *) NULL; 120 115 } 121 if (regions != NULL) free (regions); 116 117 /* need to free SkyList / or free all regions as well */ 118 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); 122 119 xvec[0].Nelements = yvec[0].Nelements = Npts; 123 120 return (TRUE); … … 132 129 133 130 escape: 134 if (regions != NULL) free (regions);131 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); 135 132 if (catalog.average != NULL) free (catalog.average); 136 133 if (catalog.secfilt != NULL) free (catalog.secfilt); -
trunk/Ohana/src/opihi/dvo/dmt.c
r5448 r5451 6 6 int i, m, k, N, Ngraph, SaveVectors; 7 7 int Ns, Nsec, NPTS; 8 char catdir[256], filename[256];9 8 double Radius; 10 9 float dt1, dt2, dmt1, dmt2; … … 19 18 20 19 if (!InitPhotcodes ()) return (FALSE); 21 22 VarConfig ("CATDIR", "%s", catdir);23 20 24 21 vec1 = vec2 = vec3 = vec4 = vec5 = NULL; … … 54 51 Ns = GetPhotcodeNsec (code[0].code); 55 52 56 /* load sky from correct table */ 57 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE); 58 SkyTableSetFilenames (sky, CATDIR, "cpt"); 53 Radius = MAX (fabs(graphsky.xmax), fabs(graphsky.ymax)); 59 54 60 Radius = MAX (fabs(graphsky.xmax), fabs(graphsky.ymax));55 sky = GetSkyTable (); 61 56 skylist = SkyListByRadius (sky, -1, graphsky.coords.crval1, graphsky.coords.crval2, Radius); 62 57 … … 74 69 75 70 /* lock, load, unlock catalog */ 76 catalog.filename = skylist[0].regions[k][0].filename;71 catalog.filename = (char *) skylist[0].regions[k][0].filename; 77 72 switch (lock_catalog (&catalog, LCK_SOFT)) { 78 73 case 2: -
trunk/Ohana/src/opihi/dvo/dvo.c
r4714 r5451 17 17 InitAstro (); 18 18 InitDVO (); 19 20 if (SetCATDIR (NULL, TRUE)) { 21 fprintf (stderr, "CATDIR is not defined\n"); 22 } 19 23 20 24 rl_readline_name = opihi_name; -
trunk/Ohana/src/opihi/dvo/fitcolors.c
r5320 r5451 13 13 int i, k, m, NP1, NP2, NP, Np, Npts, NPTS; 14 14 int N1, N2, i1, i2, mode[4]; 15 int Nsec, Nregions,status;16 char catdir[256], filename[256],*RegionName, *RegionList;15 int Nsec, status; 16 char *RegionName, *RegionList; 17 17 char *cmd, *outcmd, *camera; 18 18 double *M1, *M2; … … 20 20 21 21 Catalog *catalog; 22 RegionFile *regions;23 22 PhotCode **codelist, *tcode, *code[4]; 23 SkyList *skylist; 24 24 Vector *xvec, *yvec; 25 25 Buffer *buf; 26 26 27 27 /* defaults */ 28 regions = NULL;29 28 catalog = NULL; 30 29 codelist = NULL; … … 34 33 if (!InitPhotcodes ()) goto escape; 35 34 Nsec = GetPhotcodeNsecfilt (); 36 37 /* find CATDIR in config system */38 if (VarConfig ("CATDIR", "%s", catdir) == NULL) goto escape;39 35 40 36 /* interpret command-line options */ … … 97 93 98 94 /* load region corresponding to selection above */ 99 if (( regions = SelectRegions (RegionName, RegionList, &Nregions)) == NULL) goto escape;95 if ((skylist = SelectRegions (RegionName, RegionList)) == NULL) goto escape; 100 96 101 97 /* loop over regions, extract data for each region */ 102 ALLOCATE (catalog, Catalog, Nregions);103 for (k = 0; k < Nregions; k++) {98 ALLOCATE (catalog, Catalog, skylist[0].Nregions); 99 for (k = 0; k < skylist[0].Nregions; k++) { 104 100 /* lock, load, unlock catalog */ 105 sprintf (filename, "%s/%s", catdir, regions[k].name); 106 catalog[k].filename = filename; 101 catalog[k].filename = (char *) skylist[0].regions[k][0].filename; 107 102 switch (lock_catalog (&catalog[k], LCK_SOFT)) { 108 103 case 2: … … 120 115 unlock_catalog (&catalog[k]); 121 116 } 122 fprintf (stderr, "using %d regions\n", Nregions);117 fprintf (stderr, "using %d regions\n", skylist[0].Nregions); 123 118 124 119 /* vectors to save data */ … … 137 132 /* extract all magnitude pairs from catalog tables */ 138 133 Npts = 0; 139 for (k = 0; k < Nregions; k++) {134 for (k = 0; k < skylist[0].Nregions; k++) { 140 135 if (catalog[k].Naverage == 0) continue; 141 136 … … 186 181 } 187 182 } 183 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); 184 if (RegionName != NULL) free (RegionName); 185 if (RegionList != NULL) free (RegionList); 188 186 return (TRUE); 189 187 … … 196 194 197 195 escape: 198 if (regions != NULL) free (regions); 196 free_catalog (catalog, skylist[0].Nregions); 197 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); 198 if (RegionName != NULL) free (RegionName); 199 if (RegionList != NULL) free (RegionList); 199 200 if (codelist != NULL) free (codelist); 200 201 DeleteVector (xvec); 201 202 DeleteVector (yvec); 202 free_catalog (catalog, Nregions);203 203 return (FALSE); 204 204 } -
trunk/Ohana/src/opihi/dvo/gcat.c
r5448 r5451 8 8 SkyTable *sky; 9 9 SkyList *skylist; 10 char catdir[256];11 12 VarConfig ("CATDIR", "%s", catdir);13 10 14 11 if ((argc != 3) && (argc != 4)) { … … 18 15 19 16 /* load sky from correct table */ 20 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);21 SkyTableSetFilenames (sky, CATDIR, "cpt");22 23 17 Ra = atof (argv[1]); 24 18 Dec = atof (argv[2]); … … 28 22 Radius = 0.0001; 29 23 24 sky = GetSkyTable (); 30 25 skylist = SkyListByRadius (sky, -1, Ra, Dec, Radius); 31 26 32 27 for (i = 0; i < skylist[0].Nregions; i++) { 33 if (stat ( skylist[0].regions[i][0].filename, &filestat) != -1) {34 fprintf (stderr, "%3d %s *\n", i, regions[i].name);28 if (stat ((char *) skylist[0].regions[i][0].filename, &filestat) != -1) { 29 fprintf (stderr, "%3d %s *\n", i, skylist[0].regions[i][0].name); 35 30 } else { 36 fprintf (stderr, "%3d %s\n", i, regions[i].name);31 fprintf (stderr, "%3d %s\n", i, skylist[0].regions[i][0].name); 37 32 } 38 set_str_variable ("CATNAME", regions[i].name);33 set_str_variable ("CATNAME", (char *) skylist[0].regions[i][0].filename); 39 34 } 40 35 41 36 return (TRUE); 42 SkyListFree ( regions);37 SkyListFree (skylist, FALSE); 43 38 } -
trunk/Ohana/src/opihi/dvo/gstar.c
r5448 r5451 5 5 int gstar (int argc, char **argv) { 6 6 7 char filename[128], catdir[256],*date;7 char *date; 8 8 double Ra, Dec, Radius, Radius2, r, dec0, dec1; 9 9 double Mcat, Mrel; … … 18 18 PhotCode *code; 19 19 20 if (VarConfig ("CATDIR", "%s", catdir) == NULL) return (FALSE);21 22 20 if (!InitPhotcodes ()) return (FALSE); 23 21 Nsec = GetPhotcodeNsecfilt (); … … 54 52 55 53 /* load sky from correct table */ 56 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE); 57 SkyTableSetFilenames (sky, CATDIR, "cpt"); 54 sky = GetSkyTable (); 58 55 skylist = SkyListByRadius (sky, -1, Ra, Dec, Radius); 59 56 … … 63 60 64 61 /* lock, load, unlock catalog */ 65 catalog.filename = skylist[0].regions[0][0].filename;62 catalog.filename = (char *) skylist[0].regions[0][0].filename; 66 63 switch (lock_catalog (&catalog, LCK_SOFT)) { 67 64 case 2: -
trunk/Ohana/src/opihi/dvo/imdata.c
r5448 r5451 4 4 5 5 int i, j, k, I; 6 int Nimage, N, NPTS, skip, mode, TimeSelect;7 int n, Nregion , Ntregion, TimeFormat;6 int Nimage, N, NPTS, found, mode, TimeSelect; 7 int n, Nregions, NREGIONS, TimeFormat; 8 8 int *subset, Nsubset; 9 char filename[256];10 9 double trange; 11 10 unsigned long tzero, start, stop, TimeReference; … … 81 80 82 81 /* load sky from correct table */ 83 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE); 84 SkyTableSetFilenames (sky, CATDIR, "cpt"); 82 sky = GetSkyTable (); 85 83 86 84 Nregions = 0; 87 85 NREGIONS = 10; 88 86 ALLOCATE (skylist, SkyList, 1); 89 ALLOCATE (skylist[0].regions, SkyRegion s*, NREGIONS);87 ALLOCATE (skylist[0].regions, SkyRegion *, NREGIONS); 90 88 91 89 /* for each image of interest, find the appropriate region files */ … … 94 92 95 93 if (!FindMosaicForImage (image, Nimage, I)) continue; 96 skyset = SkyListByImage ( table, -1, &image[I]);94 skyset = SkyListByImage (sky, -1, &image[I]); 97 95 98 96 for (j = 0; j < skyset[0].Nregions; j++) { 99 97 found = FALSE; 100 for (k = 0; (k < skylist[0].Nregion ) && !found; k++) {101 found = !strcmp (skylist[0].regions[k] .name, skyset[0].regions[j].name);98 for (k = 0; (k < skylist[0].Nregions) && !found; k++) { 99 found = !strcmp (skylist[0].regions[k][0].name, skyset[0].regions[j][0].name); 102 100 } 103 101 if (found) continue; 104 102 skylist[0].regions[Nregions] = skyset[0].regions[j]; 105 103 Nregions ++; 106 CHECK_REALLOCATE (skylist[0].regions, SkyRegion s*, NREGIONS, Nregions, 10);107 } 108 SkyListFree (skyset );104 CHECK_REALLOCATE (skylist[0].regions, SkyRegion *, NREGIONS, Nregions, 10); 105 } 106 SkyListFree (skyset, FALSE); 109 107 } 110 108 free (subset); … … 122 120 123 121 /* get file name and open */ 124 catalog.filename = skylist[0].regions[j][0].filename;122 catalog.filename = (char *) skylist[0].regions[j][0].filename; 125 123 switch (lock_catalog (&catalog, LCK_SOFT)) { 126 124 case 2: -
trunk/Ohana/src/opihi/dvo/init.c
r5448 r5451 112 112 AddCommand (&cmds[i]); 113 113 } 114 115 114 } -
trunk/Ohana/src/opihi/dvo/lcat.c
r5448 r5451 4 4 5 5 double Radius; 6 int i, N, Nregions,ShowAll;7 char filename[128],exists;6 int i, N, ShowAll; 7 char exists; 8 8 struct stat filestat; 9 char catdir[256];10 9 Graphdata graphmode; 11 10 int Ngraph; … … 15 14 Ngraph = 0; 16 15 if (!GetGraphData (&graphmode, NULL, &Ngraph)) return (FALSE); 17 18 VarConfig ("CATDIR", "%s", catdir);19 20 /* load sky from correct table */21 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);22 SkyTableSetFilenames (sky, CATDIR, "cpt");23 16 24 17 ShowAll = FALSE; … … 33 26 34 27 Radius = MAX (fabs(graphmode.xmax), fabs(graphmode.ymax)); 28 29 /* load sky from correct table */ 30 sky = GetSkyTable (); 35 31 skylist = SkyListByRadius (sky, -1, graphmode.coords.crval1, graphmode.coords.crval2, Radius); 36 32 37 33 for (i = 0; i < skylist[0].Nregions; i++) { 38 34 exists = 'Y'; 39 if (stat ( skylist[0].regions[i][0].filename, &filestat) == -1) exists = 'N';35 if (stat ((char *) skylist[0].regions[i][0].filename, &filestat) == -1) exists = 'N'; 40 36 if (ShowAll) { 41 37 fprintf (stderr, "%3d %s %c\n", i, skylist[0].regions[i][0].name, exists); … … 47 43 } 48 44 45 SkyListFree (skylist, FALSE); 49 46 return (TRUE); 50 SkyListFree (regions);51 47 } 52 48 -
trunk/Ohana/src/opihi/dvo/lcurve.c
r5448 r5451 3 3 int lcurve (int argc, char **argv) { 4 4 5 char filename[128], string[128], catdir[256], *p;5 char string[128], *p; 6 6 double Ra, Dec, Radius, Radius2, r; 7 7 float *RA, *DEC; … … 18 18 SkyList *skylist; 19 19 20 VarConfig ("CATDIR", "%s", catdir);21 22 20 if (!InitPhotcodes ()) return (FALSE); 23 21 … … 70 68 } 71 69 72 /* load sky from correct table */73 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);74 SkyTableSetFilenames (sky, CATDIR, "cpt");75 76 70 Ra = atof (argv[1]); 77 71 Dec = atof (argv[2]); 78 72 Radius = atof (argv[3]); 79 73 74 /* load sky from correct table */ 75 sky = GetSkyTable (); 80 76 skylist = SkyListByRadius (sky, -1, Ra, Dec, Radius); 81 77 … … 85 81 86 82 /* set filename, read in header */ 87 catalog.filename = skylist[0].regions[0][0].filename;83 catalog.filename = (char *) skylist[0].regions[0][0].filename; 88 84 switch (lock_catalog (&catalog, LCK_SOFT)) { 89 85 case 2: … … 202 198 if (catalog.measure != 0) free (catalog.measure); 203 199 204 SkyListFree (skylist );200 SkyListFree (skylist, FALSE); 205 201 return (TRUE); 206 202 } -
trunk/Ohana/src/opihi/dvo/lightcurve.c
r5448 r5451 3 3 int lightcurve (int argc, char **argv) { 4 4 5 char filename[128], catdir[256];6 5 double Ra, Dec, Radius, Radius2, r; 7 6 float *RA, *DEC; … … 9 8 int i, j, k, m, N, NPTS, Nsec, RELPHOT, *N1, TimeFormat; 10 9 time_t TimeReference; 10 11 PhotCode *code; 12 Catalog catalog; 13 SkyTable *sky; 14 SkyList *skylist; 11 15 Vector *tvec, *mvec, *dmvec; 12 Catalog catalog;13 PhotCode *code;14 15 VarConfig ("CATDIR", "%s", catdir);16 16 17 17 if (!InitPhotcodes ()) return (FALSE); … … 49 49 Radius = atof (argv[3]); 50 50 51 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE); 52 SkyTableSetFilenames (sky, CATDIR, "cpt"); 51 sky = GetSkyTable (); 53 52 skylist = SkyListByRadius (sky, -1, Ra, Dec, Radius); 54 53 … … 58 57 59 58 /* set filename, read in header */ 60 catalog.filename = skylist[0].regions[0][0].filename;59 catalog.filename = (char *) skylist[0].regions[0][0].filename; 61 60 switch (lock_catalog (&catalog, LCK_SOFT)) { 62 61 case 2: … … 148 147 if (catalog.secfilt != 0) free (catalog.secfilt); 149 148 150 SkyListFree (skylist );149 SkyListFree (skylist, FALSE); 151 150 return (TRUE); 152 151 } -
trunk/Ohana/src/opihi/dvo/mextract.c
r5320 r5451 4 4 5 5 int i, j, k, m, N, N1, NPTS; 6 int param, mode, N regions, Nsec;7 char filename[128], catdir[256],*RegionName, *RegionList, *p;6 int param, mode, Nsec; 7 char *RegionName, *RegionList, *p; 8 8 double *M1; 9 9 10 10 PhotCode *code; 11 11 Catalog catalog; 12 RegionFile *regions;12 SkyList *skylist; 13 13 Vector *vec; 14 14 15 15 /* defaults */ 16 regions = NULL;17 16 catalog.average = (Average *) NULL; 18 17 catalog.secfilt = (SecFilt *) NULL; … … 26 25 if (!InitPhotcodes ()) goto escape; 27 26 Nsec = GetPhotcodeNsecfilt (); 28 29 /* find CATDIR in config system */30 if (VarConfig ("CATDIR", "%s", catdir) == NULL) goto escape;31 27 32 28 /* interpret command-line options */ … … 51 47 52 48 /* load region corresponding to selection above */ 53 if (( regions = SelectRegions (RegionName, RegionList, &Nregions)) == NULL) goto escape;54 if (!SetImageSelection (param )) goto escape;49 if ((skylist = SelectRegions (RegionName, RegionList)) == NULL) goto escape; 50 if (!SetImageSelection (param, ((RegionName == NULL) && (RegionList == NULL)))) goto escape; 55 51 56 52 /* create storage vector */ … … 59 55 if ((vec = SelectVector (argv[1], ANYVECTOR, TRUE)) == NULL) goto escape; 60 56 61 for (i = 0; i < Nregions; i++) { 62 /* lock, load, unlock catalog */ 63 sprintf (filename, "%s/%s", catdir, regions[i].name); 64 catalog.filename = filename; 57 for (i = 0; i < skylist[0].Nregions; i++) { 58 catalog.filename = (char *) skylist[0].regions[i][0].filename; 65 59 switch (lock_catalog (&catalog, LCK_SOFT)) { 66 60 case 2: … … 97 91 REALLOCATE (vec[0].elements, float, MAX(1,N)); 98 92 99 if (regions != NULL) free (regions);100 93 FreeImageSelection (); 94 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); 95 if (RegionName != NULL) free (RegionName); 96 if (RegionList != NULL) free (RegionList); 101 97 return (TRUE); 102 98 … … 108 104 escape: 109 105 FreeImageSelection (); 110 if (regions != NULL) free (regions);106 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); 111 107 if (catalog.average != NULL) free (catalog.average); 112 108 if (catalog.secfilt != NULL) free (catalog.secfilt); -
trunk/Ohana/src/opihi/dvo/pmeasure.c
r5448 r5451 6 6 int i, j, k, m, N; 7 7 int Ngraph; 8 char filename[128], catdir[256];9 8 double Mz, Mr, mag; 10 9 double Radius, Rmin, Rmax; … … 22 21 if (!InitPhotcodes ()) return (FALSE); 23 22 if (!GetGraph (&graphmode, NULL, &Ngraph)) return (FALSE); 24 if (VarConfig ("CATDIR", "%s", catdir) == NULL) return (FALSE);25 23 26 24 f = (FILE *) NULL; … … 76 74 77 75 /* load sky from correct table */ 78 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE); 79 SkyTableSetFilenames (sky, CATDIR, "cpt"); 76 sky = GetSkyTable (); 80 77 skylist = SkyListByRadius (sky, -1, graphmode.coords.crval1, graphmode.coords.crval2, Radius); 81 78 … … 84 81 85 82 /* lock, load, unlock catalog */ 86 catalog.filename = skylist[0].regions[j][0].filename;83 catalog.filename = (char *) skylist[0].regions[j][0].filename; 87 84 switch (lock_catalog (&catalog, LCK_SOFT)) { 88 85 case 2: -
trunk/Ohana/src/opihi/dvo/region_list.c
r5448 r5451 5 5 information carried back up */ 6 6 7 static int RegionSelect; 7 static char *CATDIR = NULL; 8 static SkyTable *sky = NULL; 8 9 9 int GetRegionSelection () { 10 return (RegionSelect); 10 int SetCATDIR (char *path, int verbose) { 11 12 char *newpath; 13 char catdir[256]; 14 char gscfile[256]; 15 char skyfile[256]; 16 int skydepth; 17 18 /* find CATDIR in config system */ 19 if (path == NULL) { 20 if (VarConfig ("CATDIR", "%s", catdir) == NULL) return (FALSE); 21 newpath = catdir; 22 } else { 23 newpath = path; 24 } 25 26 if (CATDIR != NULL) free (CATDIR); 27 CATDIR = strcreate (newpath); 28 29 if (VarConfig ("GSCFILE", "%s", gscfile) == NULL) gscfile[0] = 0; 30 if (VarConfig ("SKYFILE", "%s", skyfile) == NULL) skyfile[0] = 0; 31 if (VarConfig ("SKYDEPTH", "%d", &skydepth) == NULL) skydepth = 2; 32 33 /* load the SkyTable at this point */ 34 /* set the image path as well */ 35 36 if (sky != NULL) SkyTableFree (sky); 37 sky = SkyTableLoadOptimal (catdir, skyfile, gscfile, skydepth, verbose); 38 SkyTableSetFilenames (sky, catdir, "cpt"); 39 40 return (TRUE); 41 } 42 43 SkyTable *GetSkyTable () { 44 return (sky); 11 45 } 12 46 … … 14 48 15 49 int N; 16 17 RegionSelect = FALSE;18 50 19 51 /* check for Region selection */ … … 33 65 return (TRUE); 34 66 } 35 if ((*RegionName == NULL) && (*RegionList == NULL)) { 36 RegionSelect = TRUE; 37 return (TRUE); 38 } 67 if ((*RegionName == NULL) && (*RegionList == NULL)) return (TRUE); 39 68 40 69 fprintf (stderr, "-cpt and -cptlist are incompatible\n"); … … 46 75 } 47 76 77 /* given possible options (by name, by list, by graph region), select SkyRegions */ 48 78 SkyList *SelectRegions (char *RegionName, char *RegionList) { 49 79 … … 53 83 SkyTable *sky; 54 84 SkyList *skylist; 85 char filename[256]; 55 86 56 87 /* determine region-file names */ 57 88 if (RegionName != NULL) { 58 89 ALLOCATE (skylist, SkyList, 1); 59 ALLOCATE (skylist[0].regions [0], SkyRegion *, 1);60 ALLOCATE (skylist[0].regions[0] [0], SkyRegion, 1);90 ALLOCATE (skylist[0].regions, SkyRegion *, 1); 91 ALLOCATE (skylist[0].regions[0], SkyRegion, 1); 61 92 strcpy (skylist[0].regions[0][0].name, RegionName); 62 93 sprintf (filename, "%s/%s.cpt", CATDIR, RegionName); 63 skylist[0].regions[0][0].filename = strcreate (filename);94 skylist[0].regions[0][0].filename = (e_void) strcreate (filename); 64 95 free (RegionName); 65 96 RegionName = NULL; … … 80 111 81 112 Radius = MAX (fabs(graphsky.xmax), fabs(graphsky.ymax)); 82 83 /* load sky from correct table */ 84 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE); 85 SkyTableSetFilenames (sky, CATDIR, "cpt"); 86 skylist = SkyListByRadius (sky, -1, graphmode.coords.crval1, graphmode.coords.crval2, Radius); 113 skylist = SkyListByRadius (sky, -1, graphsky.coords.crval1, graphsky.coords.crval2, Radius); 87 114 88 115 return (skylist); 89 116 } 90 117 91 /* XXX EAM this should perhaps return a skytable? */92 118 /* returns a list of region files names from file */ 93 SkyList *SkyList FromFile (char *filename) {119 SkyList *SkyListLoadFile (char *filename) { 94 120 95 121 FILE *f; 96 int NREGIONS, nregion;122 int NREGIONS, Nregions; 97 123 SkyList *skylist; 98 124 … … 115 141 strcpy (skylist[0].regions[Nregions][0].name, filename); 116 142 sprintf (filename, "%s/%s.cpt", CATDIR, skylist[0].regions[Nregions][0].name); 117 skylist[0].regions[Nregions][0].filename = strcreate (filename);143 skylist[0].regions[Nregions][0].filename = (e_void) strcreate (filename); 118 144 Nregions ++; 119 145 CHECK_REALLOCATE (skylist[0].regions, SkyRegion *, NREGIONS, Nregions, 50); 120 }121 146 } 122 123 *Nregions = nregion; 124 return (regions); 147 skylist[0].Nregions = Nregions; 148 return (skylist); 125 149 } 126 150 -
trunk/Ohana/src/opihi/dvo/skycat.c
r5442 r5451 1 1 # include "dvo1.h" 2 3 int RD_to_XYpic (double *x, double *y, double r, double d, Coords *coords, double Rmin, double Rmax, double Rmid, int *leftside); 2 4 3 5 int skycat (int argc, char **argv) { … … 5 7 double Radius; 6 8 int i, j, N, Nregions, ShowAll, NPTS, Npts, leftside, Depth, TableDepth; 7 char filename[128];8 9 struct stat filestat; 9 10 Vector Xvec, Yvec; 10 11 Graphdata graphmode; 11 12 double X[4], Y[4], Rmin, Rmax, Rmid; 12 char catdir[256], gscfile[256];13 13 int Ngraph, VERBOSE; 14 14 SkyTable *sky; 15 15 SkyList *skylist; 16 16 SkyRegion **regions; 17 18 VarConfig ("CATDIR", "%s", catdir);19 VarConfig ("GSCFILE", "%s", gscfile);20 17 21 18 VERBOSE = FALSE; … … 45 42 46 43 Radius = MAX (fabs(graphmode.xmax), fabs(graphmode.ymax)); 47 sky = SkyTableFromGSC (gscfile, TableDepth, VERBOSE); 48 if (sky == NULL) return (FALSE);44 45 sky = GetSkyTable (); 49 46 skylist = SkyListByRadius (sky, Depth, graphmode.coords.crval1, graphmode.coords.crval2, Radius); 50 47 … … 66 63 67 64 for (i = 0; i < Nregions; i++) { 68 sprintf (filename, "%s/%s", catdir, regions[i][0].name); 69 if (ShowAll || (stat (filename, &filestat) != -1)) { 65 if (ShowAll || (stat ((char *) regions[i][0].filename, &filestat) != -1)) { 70 66 if (VERBOSE) fprintf (stderr, "%3d %s %6.2f - %6.2f, %6.2f - %6.2f\n", i, regions[i][0].name, 71 67 regions[i][0].Rmin, regions[i][0].Rmax, regions[i][0].Dmin, regions[i][0].Dmax); … … 114 110 115 111 } 112 113 114 int RD_to_XYpic (double *x, double *y, double r, double d, Coords *coords, double Rmin, double Rmax, double Rmid, int *leftside) { 115 116 while (r < Rmin) { r += 360.0; } 117 while (r > Rmax) { r -= 360.0; } 118 119 if (*leftside == -1) { 120 *leftside = (r < Rmid); 121 } else { 122 if ( *leftside && (r > Rmid + 90)) { r -= 360.0; } 123 if (! *leftside && (r < Rmid - 90)) { r += 360.0; } 124 } 125 126 RD_to_XY (x, y, r, d, coords); 127 128 return (TRUE); 129 } -
trunk/Ohana/src/opihi/dvo/subpix.c
r5448 r5451 13 13 double Ra, Dec, Radius, Radius2, r, Rmin; 14 14 double *RA, *DEC; 15 char catdir[256], filename[256];16 15 16 SkyTable *sky; 17 SkyList *skylist; 17 18 Measure *measure; 18 19 Image *image; … … 20 21 21 22 if (!InitPhotcodes ()) return (FALSE); 22 23 VarConfig ("CATDIR", "%s", catdir);24 23 25 24 GetTimeFormat (&TimeReference, &TimeFormat); … … 34 33 Radius = atof (argv[3]); 35 34 36 /* load sky from correct table */37 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);38 SkyTableSetFilenames (sky, CATDIR, "cpt");39 40 35 /* load star nearest position */ 36 sky = GetSkyTable (); 41 37 skylist = SkyListByRadius (sky, -1, Ra, Dec, Radius); 42 38 if (skylist[0].Nregions > 1) { … … 45 41 46 42 /* lock, load, unlock catalog */ 47 catalog.filename = skylist[0].regions[0][0].filename;43 catalog.filename = (char *) skylist[0].regions[0][0].filename; 48 44 switch (lock_catalog (&catalog, LCK_SOFT)) { 49 45 case 2: … … 94 90 if (catalog.average != 0) free (catalog.average); 95 91 if (catalog.measure != 0) free (catalog.measure); 96 SkyListFree (skylist );92 SkyListFree (skylist, FALSE); 97 93 return (TRUE); 98 94 } … … 160 156 free (image); 161 157 free (index); 162 SkyListFree ( regions);158 SkyListFree (skylist, FALSE); 163 159 164 160 return (TRUE); -
trunk/Ohana/src/opihi/include/dvo1.h
r5442 r5451 57 57 int GetMeasureTypeCode PROTO((Measure *measure)); 58 58 int GetPhotcodeInfo PROTO((char *string, PhotCode **Code, int *Mode)); 59 int GetRegionSelection PROTO(());60 59 int GetSelectionParam PROTO(()); 61 60 int GetTimeSelection PROTO((time_t *tz, time_t *te)); … … 68 67 int Quality PROTO((Measure *measure, int IsDophot)); 69 68 int SelectMags PROTO((int Nphot, int Tphot, int Ns, Average *average, Measure *measure, SecFilt *secfilt, int UL)); 70 RegionFile *SelectRegions PROTO((char *RegionName, char *RegionList, int *nregions)); 71 int SetImageSelection PROTO((int mode)); 69 70 SkyList *SelectRegions PROTO((char *RegionName, char *RegionList)); 71 SkyList *SkyListLoadFile PROTO((char *filename)); 72 int SetCATDIR PROTO((char *path, int verbose)); 73 SkyTable *GetSkyTable PROTO(()); 74 SkyList *SkyListFromFile PROTO((char *filename)); 75 int SetRegionSelection PROTO((int *argc, char **argv, char **RegionName, char **RegionList)); 76 77 int SetImageSelection PROTO((int mode, int RegionSelect)); 72 78 int SetPhotSelections PROTO((int *argc, char **argv, int Nparams)); 73 int SetRegionSelection PROTO((int *argc, char **argv, char **RegionName, char **RegionList));74 79 int SetSelectionParam PROTO((int param)); 75 80 int TestAverage PROTO((PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure)); 76 81 int TestPhotSelections PROTO((PhotCode **code, int *mode, int param)); 77 void aregion PROTO((GSCRegion *region, FILE *f, double ra, double dec, char *path));78 82 void compare PROTO((Catalog *catlog1, Catalog *catlog2, Vector *rvec, Vector *dvec, Vector *mvec, Vector *drvec, Vector *ddvec, Vector *dmvec, double radius)); 79 83 void cprecess PROTO((Average *average, int Naverage, double in_epoch, double out_epoch)); 80 RegionFile *find_regions PROTO((double Ra, double Dec, double radius, int *Nregions));81 GSCRegion *get_regions PROTO((Image *image, int *Nregions));82 84 void image_subset PROTO((Image *image, int Nimage, int **Subset, int *Nsubset, Graphdata *graph, int RegionSelect, unsigned long int tzero, double trange, int TimeSelect)); 83 85 int match_image PROTO((Image *image, int Nimage, unsigned int T, short int S)); 84 86 int match_image_subset PROTO((Image *image, int *subset, int Nsubset, unsigned int T, short int S)); 85 87 void print_value PROTO((FILE *f, double value, short int ival)); 86 RegionFile *region_list PROTO((char *filename, int *Nregions));87 88 void sort_image_subset PROTO((Image *image, int *subset, int N)); 88 89 void sort_images PROTO((Image *image, int N)); 89 90 void sortave PROTO((Average *ave, int N)); 90 CMPstars *cmpReadFits (FILE *f, int *nstars); 91 CMPstars *cmpReadText (FILE *f, int *nstars); 92 int RD_to_XYpic (double *x, double *y, double r, double d, Coords *coords, double Rmin, double Rmax, double Rmid, int *leftside); 91 CMPstars *cmpReadFits PROTO((FILE *f, int *nstars)); 92 CMPstars *cmpReadText PROTO((FILE *f, int *nstars)); 93 int RD_to_XYpic PROTO((double *x, double *y, double r, double d, Coords *coords, double Rmin, double Rmax, double Rmid, int *leftside)); 94 95 RegionFile *find_regions PROTO((double Ra, double Dec, double radius, int *Nregions)); 96 GSCRegion *get_regions PROTO((Image *image, int *Nregions)); 97 RegionFile *region_list PROTO((char *filename, int *Nregions)); 98 void aregion PROTO((GSCRegion *region, FILE *f, double ra, double dec, char *path)); 93 99 94 100 # endif
Note:
See TracChangeset
for help on using the changeset viewer.
