Changeset 3401
- Timestamp:
- Mar 9, 2005, 9:22:34 PM (21 years ago)
- Location:
- trunk/Ohana/src/mosastro
- Files:
-
- 22 edited
-
Makefile (modified) (2 diffs)
-
include/mosastro.h (modified) (1 diff)
-
src/FitChips.c (modified) (1 diff)
-
src/FitGradients.c (modified) (1 diff)
-
src/GetScatter.c (modified) (1 diff)
-
src/LoadStars.c (modified) (1 diff)
-
src/args.c (modified) (1 diff)
-
src/chips.c (modified) (3 diffs)
-
src/clip.c (modified) (3 diffs)
-
src/dump.c (modified) (1 diff)
-
src/fakefield.c (modified) (1 diff)
-
src/field.c (modified) (5 diffs)
-
src/fitpoly.c (modified) (5 diffs)
-
src/gaussj.c (modified) (1 diff)
-
src/greference.c (modified) (1 diff)
-
src/match.c (modified) (1 diff)
-
src/mkmosaic.c (modified) (1 diff)
-
src/mosastro.c (modified) (2 diffs)
-
src/output.c (modified) (2 diffs)
-
src/parse_time.c (modified) (3 diffs)
-
src/project.c (modified) (5 diffs)
-
src/transforms.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/mosastro/Makefile
r3323 r3401 56 56 $(SRC)/GetScatter.$(ARCH).o \ 57 57 $(SRC)/clip.$(ARCH).o \ 58 $(SRC)/parse_time.$(ARCH).o 58 $(SRC)/parse_time.$(ARCH).o \ 59 $(SRC)/testcoords.$(ARCH).o 59 60 60 61 mosastro: $(BIN)/mosastro.$(ARCH) … … 102 103 $(STD) : $(INC)/mosastro.h 103 104 104 INSTALL = mosastro mkstandards mkobs 105 # INSTALL = mosastro mkstandards mkobs 106 INSTALL = mosastro 105 107 106 108 # dependancy rules for binary code ######################### -
trunk/Ohana/src/mosastro/include/mosastro.h
r3323 r3401 96 96 char *FOCAL_PLANE; 97 97 98 CatStats *gregions (CatStats *patch, int *nregion); 99 Gradients *GetGradients (); 100 Header *mkheader (int Nx, int Ny, int Nstars, Coords *coords); 101 Header *mkmosaic (int Nx, int Ny, int Nstars, Coords *coords); 98 102 StarData *getusno (CatStats *catstats, int *Nstars); 99 103 StarData *getgsc (CatStats *catstats, int *NSTARS); 100 104 StarData *get2mass (CatStats *catstats, int *NSTARS); 101 105 StarData *getptolemy (CatStats *catstats, int *NSTARS); 102 void GetConfig (char *config, char *field, char *format, int N, void *ptr);103 106 StarData *greference (int *Nrefcat); 104 105 Header *mkheader (int Nx, int Ny, int Nstars, Coords *coords);106 107 107 StarData *gcatalog (char *filename, int *Nstars); 108 109 CatStats *gregions (CatStats *patch, int *nregion);108 StarData *gptolemy (char *filename, int *NSTARS); 109 double GetScatter (); 110 110 int find_dec_bands (CatStats *area); 111 111 int load_ra_blocks (int Ndec, CatStats *area); 112 112 int parse_GSC_line (CatStats *tregion, char *line); 113 int fake_field (double RA, double DEC); 114 int LoadStars (int Nfile, char **file); 115 int project_refcat (StarData *refcat, int Nrefcat); 116 int deproject_stars (); 117 int project_stars (); 118 int deproject_raw (); 119 int project_ref (); 120 int init_field (); 121 int load_field (char *filename); 122 int init_chips (); 123 int load_chips (char *filename); 124 int dump_stars (FILE *f, StarData *stars, int Nstars); 125 int dump_grads (Gradients *grad, char *filename); 126 int dump_match (); 127 int dump_rawstars (); 128 int dump_refcat (StarData *refcat, int Nrefcat); 129 int match (StarData *refcat, int Nrefcat); 130 int mkvector (int n, int m, int norder); 131 int ClipOnFP (double Nsigma); 132 void GetConfig (char *config, char *field, char *format, int N, void *ptr); 113 133 void init_regions (); 114 134 void add_to_regions (CatStats *area); 115 135 void area_of_region (CatStats *region); 116 136 void set_catalog (char *catdir); 117 118 StarData *gptolemy (char *filename, int *NSTARS);119 int fake_field (double RA, double DEC);120 Gradients *GetGradients ();121 void FitChips (int Norder);122 137 void FitChipLinear (StarData *raw, StarData *ref, int Nmatch, Coords *coords); 123 138 void FitChipResid (StarData *raw, StarData *ref, int Nmatch, Coords *coords); 124 double GetScatter (); 125 Header *mkmosaic (int Nx, int Ny, int Nstars, Coords *coords); 139 void ConfigInit (int *argc, char **argv); 140 void print_help (); 141 void args (int *argc, char **argv); 142 void field_stats (); 143 void field_combine (); 144 void fit_apply_grads (Coords *distort, Coords *project, int term); 145 void fit_apply_coords (Coords *coords); 146 void fit_eval (); 147 void fit_add (double x1, double y1, double x2, double y2); 148 void fit_init (int order); 149 void fit_correct_grads (Gradients *in, Gradients *out, int term); 150 void fit_free (); 151 void output (char *ext, char *phu); 152 void FitGradients (Gradients *grad); 153 void uppercase (char *string); 154 e_time parse_time (Header *header); 155 int sortthree (double *X, double *Y, int *Z, int N); 156 StarData *getstone (CatStats *input, int *nstars); 157 void ChipToSky (StarData *stars, int Nstars, Coords *coords); 158 void ChipToFP (StarData *stars, int Nstars, Coords *coords); 159 void FPtoTP (StarData *stars, int Nstars, Coords *coords); 160 void TPtoSky (StarData *stars, int Nstars, Coords *coords); 161 void SkyToTP (StarData *stars, int Nstars, Coords *coords); 162 void TPtoFP (StarData *stars, int Nstars, Coords *coords); 163 void FPtoChip (StarData *stars, int Nstars, Coords *coords); 164 int gaussj (double **a, int n, double **b, int m); 165 void FitChips (int Norder); 166 void FitChip (StarData *raw, StarData *ref, int Nmatch, Coords *coords); 167 int mkpolyterm (int n, int m); 168 void wchip (char *filename, Chip *data); 169 void wstars (char *filename, Stars *stars, int Nstars, Header *header); -
trunk/Ohana/src/mosastro/src/FitChips.c
r3323 r3401 19 19 fit_init (coords[0].Npolyterms); 20 20 for (i = 0; i < Nmatch; i++) { 21 if (raw[i].mask) continue; 21 22 fit_add (raw[i].X, raw[i].Y, ref[i].L, ref[i].M); 22 23 } -
trunk/Ohana/src/mosastro/src/FitGradients.c
r3323 r3401 4 4 void FitGradients (Gradients *grad) { 5 5 6 int i, j, Nterm, Norder; 7 double **Pf, **Qf, chisq; 6 int i, Norder; 8 7 Gradients grfix; 9 8 -
trunk/Ohana/src/mosastro/src/GetScatter.c
r3323 r3401 21 21 } 22 22 } 23 dR = sqrt (dR2 / Ntotal) ;23 dR = sqrt (dR2 / Ntotal) * 3600.0 * field.project.cdelt1; 24 24 *Nscatter = Ntotal; 25 25 return (dR); -
trunk/Ohana/src/mosastro/src/LoadStars.c
r3323 r3401 4 4 int LoadStars (int Nfile, char **file) { 5 5 6 Header *header; 7 int i, j, NCHIP, itmp, Nbytes, nbytes; 6 int i, j, itmp, Nbytes, nbytes; 8 7 FILE *f; 9 8 time_t tsval; -
trunk/Ohana/src/mosastro/src/args.c
r3323 r3401 12 12 13 13 int N; 14 char line[500];15 14 16 15 if (get_argument (*argc, argv, "-help") || -
trunk/Ohana/src/mosastro/src/chips.c
r3323 r3401 2 2 3 3 /* set chip model based on initial header info */ 4 5 /** when the chips and field terms are treated independently, they must be of 6 ctype PLY. When we reach a solution, and write out a coupled set of chip 7 and field terms, then we need to transition to WRP (chip) & DIS (field 8 **/ 9 4 10 int init_chips () { 5 11 … … 15 21 16 22 /* bore site center guess */ 17 strcpy (chip[i].map.ctype, "DEC-- WRP");23 strcpy (chip[i].map.ctype, "DEC--PLY"); 18 24 chip[i].map.crpix1 = 0.0; 19 25 chip[i].map.crpix2 = 0.0; … … 53 59 exit (1); 54 60 } 61 -
trunk/Ohana/src/mosastro/src/clip.c
r3323 r3401 3 3 int ClipOnFP (double Nsigma) { 4 4 5 int i, j, Nscatter ;5 int i, j, Nscatter, Nmask, Nkeep; 6 6 double dL, dM, dV; 7 7 double sigma; … … 9 9 10 10 sigma = GetScatter (&Nscatter); 11 fprintf (stderr, "scatter (chip) : %f for %d stars\n", sigma, Nscatter); 12 13 Nmask = Nkeep = 0; 11 14 12 15 for (i = 0; i < Nchip; i++) { 13 16 raw = chip[i].raw; 14 17 ref = chip[i].ref; 15 for (j = 0; j < chip[i].N stars; j++) {18 for (j = 0; j < chip[i].Nmatch; j++) { 16 19 dL = raw[j].L - ref[j].L; 17 20 dM = raw[j].M - ref[j].M; … … 19 22 if (dV > Nsigma*sigma) { 20 23 raw[j].mask = TRUE; 24 Nmask ++; 21 25 } else { 22 26 raw[j].mask = FALSE; 27 Nkeep ++; 23 28 } 24 29 } 25 30 } 31 32 fprintf (stderr, "Nmask: %d, Nkeep: %d\n", Nmask, Nkeep); 26 33 return (TRUE); 27 34 } -
trunk/Ohana/src/mosastro/src/dump.c
r3323 r3401 66 66 int dump_refcat (StarData *refcat, int Nrefcat) { 67 67 68 int i;69 68 FILE *f; 70 69 f = fopen ("refcat.dat", "w"); -
trunk/Ohana/src/mosastro/src/fakefield.c
r3323 r3401 38 38 39 39 /** distort only has power in polyterms **/ 40 strcpy (field.distort.ctype, "DEC-- WRP");40 strcpy (field.distort.ctype, "DEC--PLY"); 41 41 field.distort.crval1 = 0.0; 42 42 field.distort.crval2 = 0.0; -
trunk/Ohana/src/mosastro/src/field.c
r3323 r3401 2 2 3 3 /* determine an initial guess to field parameters from data */ 4 int init_field ( int Norder) {4 int init_field () { 5 5 6 int i, Nterm; 7 double PS; 6 int i; 8 7 9 8 if (FIELD != (char *) NULL) { … … 38 37 39 38 /* bore site center guess */ 40 strcpy (field.distort.ctype, "DEC-- WRP");39 strcpy (field.distort.ctype, "DEC--PLY"); 41 40 field.distort.crval1 = 0.0; 42 41 field.distort.crval2 = 0.0; … … 89 88 90 89 int i; 90 double cd1, cd2, pc11, pc12, pc21, pc22; 91 91 92 strcpy (field.project.ctype, "DEC--WRP"); 92 /* combine boresite & distortion parameters: ctype DIS */ 93 strcpy (field.project.ctype, "DEC--DIS"); 94 95 cd1 = field.project.cdelt1; 96 cd2 = field.project.cdelt2; 97 pc11 = field.project.pc1_1; 98 pc12 = field.project.pc1_2; 99 pc21 = field.project.pc2_1; 100 pc22 = field.project.pc2_2; 93 101 94 102 field.project.Npolyterms = field.distort.Npolyterms; 103 95 104 for (i = 0; i < 7; i++) { 96 field.project.polyterms[i][0] = field.distort.polyterms[i][0]; 97 field.project.polyterms[i][1] = field.distort.polyterms[i][1]; 105 field.project.polyterms[i][0] = (pc11*cd1*field.distort.polyterms[i][0] + pc12*cd2*field.distort.polyterms[i][1]); 106 field.project.polyterms[i][1] = (pc21*cd1*field.distort.polyterms[i][0] + pc22*cd2*field.distort.polyterms[i][1]); 107 } 108 for (i = 0; i < 2; i++) { 109 field.project.polyterms[0][i] = field.project.polyterms[0][i] / (cd1*cd1); 110 field.project.polyterms[1][i] = field.project.polyterms[1][i] / (cd1*cd2); 111 field.project.polyterms[2][i] = field.project.polyterms[2][i] / (cd2*cd2); 112 113 field.project.polyterms[3][i] = field.project.polyterms[3][i] / (cd1*cd1*cd1); 114 field.project.polyterms[4][i] = field.project.polyterms[4][i] / (cd1*cd1*cd2); 115 field.project.polyterms[5][i] = field.project.polyterms[5][i] / (cd1*cd2*cd2); 116 field.project.polyterms[6][i] = field.project.polyterms[6][i] / (cd2*cd2*cd2); 98 117 } 99 118 } … … 116 135 } 117 136 137 /* separate field into boresite + distortion terms */ 138 118 139 /* bore site center guess */ 119 140 strcpy (field.project.ctype, "DEC--TAN"); … … 135 156 136 157 /* bore site center guess */ 137 strcpy (field.distort.ctype, "DEC-- WRP");158 strcpy (field.distort.ctype, "DEC--PLY"); 138 159 field.distort.crval1 = 0.0; 139 160 field.distort.crval2 = 0.0; -
trunk/Ohana/src/mosastro/src/fitpoly.c
r3323 r3401 68 68 69 69 int i, j, n, m, M, N; 70 double max; 70 71 if (Npts == 0) { 72 fprintf (stderr, "warning: no valid pts\n"); 73 } 71 74 72 75 i = 0; … … 123 126 124 127 int i, j, Np, Nv, N; 125 double c1 0, c11, c12;126 double c2 0, c21, c22;127 double R , D;128 double c11, c12; 129 double c21, c22; 130 double R; 128 131 129 132 /* update the higher order terms */ … … 163 166 164 167 coords[0].Npolyterms = NORDER; 165 strcpy (coords[0].ctype, "DEC-- WRP");168 strcpy (coords[0].ctype, "DEC--PLY"); 166 169 } 167 170 … … 174 177 175 178 /* NORDER is order of gradient fit : Npolyterms is Norder + 1 */ 176 fit_apply_grads (Coords *distort, Coords *project, int term) {179 void fit_apply_grads (Coords *distort, Coords *project, int term) { 177 180 178 181 int i, j, Np, Nv1, Nv2; 179 182 180 183 distort[0].Npolyterms = NORDER + 1; 181 if (distort[0].Npolyterms > 1) strcpy (distort[0].ctype, "DEC-- WRP");184 if (distort[0].Npolyterms > 1) strcpy (distort[0].ctype, "DEC--PLY"); 182 185 183 186 for (i = 0; i < NPOWER + 1; i++) { … … 212 215 } 213 216 214 fit_correct_grads (Gradients *in, Gradients *out, int term) {217 void fit_correct_grads (Gradients *in, Gradients *out, int term) { 215 218 216 219 int i, k, m, n; -
trunk/Ohana/src/mosastro/src/gaussj.c
r3323 r3401 13 13 ipiv[j] = 0; 14 14 15 icol = irow = 0; 15 16 for (i = 0; i < n; i++) { 16 17 big = 0.0; -
trunk/Ohana/src/mosastro/src/greference.c
r3323 r3401 9 9 if (VERBOSE) fprintf (stderr, "loading astrometric reference data from %s\n", REFCAT); 10 10 11 stars = NULL; 11 12 Nstars = 0; 12 13 catstats.RA[0] = field.Rmin; -
trunk/Ohana/src/mosastro/src/match.c
r3323 r3401 4 4 int match (StarData *refcat, int Nrefcat) { 5 5 6 int i, j, k, N,K, Ntotal;6 int i, j, k, K, Ntotal; 7 7 int Nmatch, NMATCH; 8 8 double dp, dq, radius, Radius; -
trunk/Ohana/src/mosastro/src/mkmosaic.c
r3323 r3401 3 3 Header *mkmosaic (int Nx, int Ny, int Nstars, Coords *coords) { 4 4 5 int i,Nastro;5 int Nastro; 6 6 double Xmin, Xmax, Ymin, Ymax, tmp, Cerror, Cprecise; 7 7 Header *header; -
trunk/Ohana/src/mosastro/src/mosastro.c
r3323 r3401 9 9 StarData *refcat; 10 10 Gradients *grad; 11 11 12 12 13 ConfigInit (&argc, argv); … … 64 65 if ((DUMP != NULL) && !strcmp (DUMP, "fitchips")) dump_match(); 65 66 67 /* testcoords (); */ 66 68 output (argv[2], argv[3]); 67 69 exit (0); -
trunk/Ohana/src/mosastro/src/output.c
r3323 r3401 20 20 strcat (outname, ext); 21 21 22 /* convert chip from PLY to WRP (linked to field model) */ 23 strcpy (chip[i].map.ctype, "DEC--WRP"); 22 24 PutCoords (&chip[i].map, &chip[i].header); 23 25 wchip (outname, &chip[i]); … … 41 43 fclose (f); 42 44 } 45 46 { 47 48 FILE *f; 49 double R, D; 50 51 fprintf (stderr, "starting test.dat\n"); 52 f = fopen ("test.dat", "w"); 53 if (f == (FILE *) NULL) { 54 fprintf (stderr, "ERROR: can't create output file \n"); 55 exit (1); 56 } 57 58 RegisterMosaic (&field.project); 59 for (i = 0; i < chip[0].Nmatch; i++) { 60 XY_to_RD (&R, &D, chip[0].raw[i].X, chip[0].raw[i].Y, &chip[0].map); 61 fprintf (f, "%4d %10.6f %10.6f %8.2f %8.2f\n", 62 i, R, D, chip[0].raw[i].X, chip[0].raw[i].Y); 63 } 64 fclose (f); 65 } 66 43 67 } -
trunk/Ohana/src/mosastro/src/parse_time.c
r3294 r3401 1 1 # include "mosastro.h" 2 2 3 parse_time (Header *header) {3 e_time parse_time (Header *header) { 4 4 5 5 double jd; 6 6 int Ny, Nf, mode; 7 int Nsec,hour, min, sec, year, month, day;7 int hour, min, sec, year, month, day; 8 8 char *py, *pm, *pd, *c; 9 9 char line[256]; 10 e_time Nsec; 10 11 11 12 /* we want to find JD or MJD to get Nsec (seconds since 01/01/1970) */ … … 75 76 for (c = strchr (line, 0x2d); c != (char *) NULL; c = strchr (line, 0x2d)) { *c = ' '; } 76 77 78 Nf = 0; 77 79 switch (mode) { 78 80 case 1: … … 118 120 } 119 121 120 uppercase (char *string) {122 void uppercase (char *string) { 121 123 122 124 int i; -
trunk/Ohana/src/mosastro/src/project.c
r3297 r3401 2 2 3 3 int project_refcat (StarData *refcat, int Nrefcat) { 4 5 int i;6 4 7 5 SkyToTP (refcat, Nrefcat, &field.project); … … 13 11 int deproject_stars () { 14 12 15 int i , j;13 int i; 16 14 17 15 for (i = 0; i < Nchip; i++) { … … 23 21 int project_stars () { 24 22 25 int i , j;23 int i; 26 24 27 25 for (i = 0; i < Nchip; i++) { … … 34 32 int deproject_raw () { 35 33 36 int i , j;34 int i; 37 35 38 36 for (i = 0; i < Nchip; i++) { … … 46 44 int project_ref () { 47 45 48 int i , j;46 int i; 49 47 50 48 for (i = 0; i < Nchip; i++) { -
trunk/Ohana/src/mosastro/src/transforms.c
r3294 r3401 1 1 # include "mosastro.h" 2 2 3 ChipToSky (StarData *stars, int Nstars, Coords *coords) {3 void ChipToSky (StarData *stars, int Nstars, Coords *coords) { 4 4 int i; 5 5 for (i = 0; i < Nstars; i++) { … … 10 10 } 11 11 12 ChipToFP (StarData *stars, int Nstars, Coords *coords) {12 void ChipToFP (StarData *stars, int Nstars, Coords *coords) { 13 13 int i; 14 14 for (i = 0; i < Nstars; i++) { … … 17 17 } 18 18 19 FPtoTP (StarData *stars, int Nstars, Coords *coords) {19 void FPtoTP (StarData *stars, int Nstars, Coords *coords) { 20 20 int i; 21 21 for (i = 0; i < Nstars; i++) { … … 24 24 } 25 25 26 TPtoSky (StarData *stars, int Nstars, Coords *coords) {26 void TPtoSky (StarData *stars, int Nstars, Coords *coords) { 27 27 int i; 28 28 for (i = 0; i < Nstars; i++) { … … 33 33 } 34 34 35 SkyToTP (StarData *stars, int Nstars, Coords *coords) {35 void SkyToTP (StarData *stars, int Nstars, Coords *coords) { 36 36 int i; 37 37 for (i = 0; i < Nstars; i++) { … … 40 40 } 41 41 42 TPtoFP (StarData *stars, int Nstars, Coords *coords) {42 void TPtoFP (StarData *stars, int Nstars, Coords *coords) { 43 43 int i; 44 44 for (i = 0; i < Nstars; i++) { … … 47 47 } 48 48 49 FPtoChip (StarData *stars, int Nstars, Coords *coords) {49 void FPtoChip (StarData *stars, int Nstars, Coords *coords) { 50 50 int i; 51 51 for (i = 0; i < Nstars; i++) {
Note:
See TracChangeset
for help on using the changeset viewer.
