Changeset 39926 for trunk/Ohana/src/relastro/src
- Timestamp:
- Jan 6, 2017, 11:30:10 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 3 deleted
- 32 edited
-
. (modified) (1 prop)
-
Ohana (modified) (1 prop)
-
Ohana/src/relastro/src (modified) (1 prop)
-
Ohana/src/relastro/src/BootstrapOps.c (modified) (1 diff)
-
Ohana/src/relastro/src/BrightCatalog.c (modified) (2 diffs)
-
Ohana/src/relastro/src/ConfigInit.c (modified) (1 diff)
-
Ohana/src/relastro/src/FitAstromOps.c (modified) (1 diff)
-
Ohana/src/relastro/src/FitChip.c (modified) (2 diffs)
-
Ohana/src/relastro/src/FitPM.c (modified) (8 diffs)
-
Ohana/src/relastro/src/FitPM_IRLS.c (deleted)
-
Ohana/src/relastro/src/FitPMandPar.c (modified) (8 diffs)
-
Ohana/src/relastro/src/FitPMandPar_IRLS.c (deleted)
-
Ohana/src/relastro/src/FitPosPMfixed.c (modified) (8 diffs)
-
Ohana/src/relastro/src/FitPosPMfixed_IRLS.c (deleted)
-
Ohana/src/relastro/src/GetAstromError.c (modified) (6 diffs)
-
Ohana/src/relastro/src/ImageOps.c (modified) (5 diffs)
-
Ohana/src/relastro/src/StarMaps.c (modified) (2 diffs)
-
Ohana/src/relastro/src/UpdateChips.c (modified) (4 diffs)
-
Ohana/src/relastro/src/UpdateMeasures.c (modified) (1 diff)
-
Ohana/src/relastro/src/UpdateObjectOffsets.c (modified) (8 diffs)
-
Ohana/src/relastro/src/UpdateObjects.c (modified) (16 diffs)
-
Ohana/src/relastro/src/UpdateStacks.c (modified) (2 diffs)
-
Ohana/src/relastro/src/args.c (modified) (33 diffs)
-
Ohana/src/relastro/src/assign_images.c (modified) (2 diffs)
-
Ohana/src/relastro/src/bcatalog.c (modified) (4 diffs)
-
Ohana/src/relastro/src/extra.c (modified) (1 diff)
-
Ohana/src/relastro/src/initialize.c (modified) (1 diff)
-
Ohana/src/relastro/src/launch_region_hosts.c (modified) (4 diffs)
-
Ohana/src/relastro/src/load_catalogs.c (modified) (5 diffs)
-
Ohana/src/relastro/src/load_images.c (modified) (1 diff)
-
Ohana/src/relastro/src/relastro_images.c (modified) (6 diffs)
-
Ohana/src/relastro/src/relastro_objects.c (modified) (3 diffs)
-
Ohana/src/relastro/src/relastro_parallel_images.c (modified) (2 diffs)
-
Ohana/src/relastro/src/select_images.c (modified) (2 diffs)
-
Ohana/src/relastro/src/syncfile.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to
/branches/czw_branch/20160809 merged eligible
-
Property svn:mergeinfo
set to
-
trunk/Ohana
-
trunk/Ohana/src/relastro/src
- Property svn:mergeinfo changed
/branches/czw_branch/20160809/Ohana/src/relastro/src (added) merged: 39719,39730-39731,39735,39738,39746-39747,39751,39761,39765-39767,39771,39783,39794-39795,39811,39918
- Property svn:mergeinfo changed
-
trunk/Ohana/src/relastro/src/BootstrapOps.c
r39457 r39926 77 77 case FIT_RESULT_RA: 78 78 // result->Ro = median; 79 result->dRo = sigma;79 result->dRo = MAX(sigma, result->dRo); 80 80 break; 81 81 case FIT_RESULT_DEC: 82 82 // result->Do = median; 83 result->dDo = sigma;83 result->dDo = MAX(sigma, result->dDo); 84 84 break; 85 85 case FIT_RESULT_uR: 86 86 // result->uR = median; 87 result->duR = sigma;87 result->duR = MAX(sigma, result->duR); 88 88 break; 89 89 case FIT_RESULT_uD: 90 90 // result->uD = median; 91 result->duD = sigma;91 result->duD = MAX(sigma, result->duD); 92 92 break; 93 93 case FIT_RESULT_PLX: 94 94 // result->p = median; 95 result->dp = sigma;95 result->dp = MAX(sigma, result->dp); 96 96 break; 97 97 default: -
trunk/Ohana/src/relastro/src/BrightCatalog.c
r39457 r39926 353 353 /*** MeasureTiny ***/ 354 354 { 355 ohana_memcheck (1);355 // ohana_memcheck (1); 356 356 gfits_create_table_header (&theader, "BINTABLE", "MEASURE_TINY"); 357 357 358 ohana_memcheck (1);358 // ohana_memcheck (1); 359 359 360 360 gfits_define_bintable_column (&theader, "D", "RA", "ra", "degrees", 1.0, 0.0); … … 429 429 gfits_set_bintable_column (&theader, &ftable, "RA", R, catalog->Nmeasure); 430 430 431 fprintf (stderr, "--------------- after set_bintable RA --------------");432 ohana_memdump_file (stderr, TRUE);431 // fprintf (stderr, "--------------- after set_bintable RA --------------"); 432 // ohana_memdump_file (stderr, TRUE); 433 433 434 434 gfits_set_bintable_column (&theader, &ftable, "DEC", D, catalog->Nmeasure); -
trunk/Ohana/src/relastro/src/ConfigInit.c
r39396 r39926 84 84 SetZeroPoint (25.0); 85 85 86 if (USE_GALAXY_MODEL) {87 if (!InitGalaxyModel ("FEAST-HIPPARCOS")) {88 fprintf (stderr, "failed to init galaxy model\n");89 exit (2);90 }91 }92 93 86 FreeConfigFile(); 94 87 free (config); -
trunk/Ohana/src/relastro/src/FitAstromOps.c
r39610 r39926 257 257 fit->converged = FALSE; 258 258 259 // this is an input value 260 // if true, use the IRLS modified weight 261 fit->useWeight = FALSE; 262 259 263 return; 260 264 } -
trunk/Ohana/src/relastro/src/FitChip.c
r39457 r39926 78 78 order_use = MIN(MIN(order_use, CHIPMAP), 6); // can only go up to 6th order map (can be user limited) 79 79 } else { 80 order_use = MIN( order_use, 3); // can only go up to 3rd order for polynomials80 order_use = MIN(MIN(order_use, CHIPORDER), 3); // can only go up to 3rd order for polynomials 81 81 } 82 82 … … 206 206 if (VERBOSE2) fprintf (stderr, "fit sigma: %f (%f, %f) : full: %f (%f, %f), scatter limit: %f (%d full, %d bright, %d fit, %d all) (%d %d %d %d %d)\n", dRsig, dLsig, dMsig, dRsigFull, dLsigFull, dMsigFull, dRmax, NstatFull, Nstat, fit[0].Npts, Nmatch, nMask1, nMask2, nMask3, nMask4, nMask5); 207 207 208 image[0].dXpixSys = dLsig; 209 image[0].dYpixSys = dMsig; 208 // need to convert dLsig, dMsig back to pixel scale (or up to arcsec) 209 210 float plateScale; 211 if (image[0].coords.mosaic) { 212 // NOTE: for the full pixel to sky plate scale, use this: 213 // float plateScaleX = 3600.0*image[0].coords.mosaic->cdelt1*image[0].coords.cdelt1; 214 // float plateScaleY = 3600.0*image[0].coords.mosaic->cdelt2*image[0].coords.cdelt2; 215 216 // since we are compare L,M values, just need to compensate for focal plate to sky: 217 float plateScaleX = 3600.0*fabs(image[0].coords.mosaic->cdelt1); 218 float plateScaleY = 3600.0*fabs(image[0].coords.mosaic->cdelt2); 219 plateScale = 0.5*(plateScaleX + plateScaleY); 220 } else { 221 // since we are compare L,M values, just need to compensate for arcsec vs degrees: 222 plateScale = 3600.0; 223 } 224 225 image[0].dXpixSys = plateScale*dLsig; 226 image[0].dYpixSys = plateScale*dMsig; 210 227 image[0].nFitAstrom = fit[0].Npts; 211 228 212 // fprintf (stderr, "%s %6.3f %4d %4d\n", image[0].name, image[0].refColor, Ncolor, image[0].nFitAstrom);229 if (VERBOSE2) fprintf (stderr, "%s | %6.3f %6.3f | %4d %4d | %6.3f %6.3f\n", image[0].name, image[0].refColorRed, image[0].refColorBlue, Ncolor, image[0].nFitAstrom, image[0].dXpixSys, image[0].dYpixSys); 213 230 214 231 if (fit) fit_free (fit); -
trunk/Ohana/src/relastro/src/FitPM.c
r39612 r39926 25 25 } 26 26 27 fit->useWeight = FALSE; // Ordinary Least Squares 27 28 if (!FitPM_MinChisq (fit, data, points, Npoints)) return FALSE; 28 29 if (!FitPM_SetChisq (fit, data, points, Npoints)) return FALSE; … … 47 48 48 49 // Solve OLS equation 50 fit->useWeight = FALSE; // Ordinary Least Squares 49 51 if (!FitPM_MinChisq(fit, data, points, Npoints)) { 50 52 return(FALSE); … … 69 71 70 72 // Iteratively reweight and solve 71 double sigma_hat = 0.0; // save for the error model73 // double sigma_hat = 0.0; // save for the error model 72 74 int converged = FALSE; 73 75 int iterations = 0; … … 90 92 91 93 // Solve with the new weights 94 fit->useWeight = TRUE; // Reweighted Least Squares 92 95 if (!FitPM_MinChisq(fit, data, points, Npoints)) { 93 96 … … 104 107 points[i].u = sqrt(SQ(points[i].rx / points[i].dX) + SQ(points[i].ry / points[i].dY)); 105 108 } 106 sigma_hat = MedianAbsDeviation(points, Npoints) / 0.6745;109 // sigma_hat = MedianAbsDeviation(points, Npoints) / 0.6745; 107 110 break; 108 111 } … … 119 122 points[i].u = sqrt(SQ(points[i].rx / points[i].dX) + SQ(points[i].ry / points[i].dY)); 120 123 } 121 sigma_hat = MedianAbsDeviation(points, Npoints) / 0.6745;124 // sigma_hat = MedianAbsDeviation(points, Npoints) / 0.6745; 122 125 123 126 // Check convergence … … 159 162 // NOTE EAM: in tests (fitpm.c), they seem to be too large by a factor of ~5.37 160 163 if (data->getError) { 161 double ax = 0.0, ay = 0.0; 162 double bx = 0.0, by = 0.0; 163 164 for (i = 0; i < Npoints; i++) { 165 ax += dpsi_cauchy(points[i].rx / points[i].dX); 166 ay += dpsi_cauchy(points[i].ry / points[i].dY); 167 168 bx += SQ(points[i].Wx); 169 by += SQ(points[i].Wy); 170 } 171 ax /= 1.0 * Npoints; // mean(psi_dot(r)) 172 ay /= 1.0 * Npoints; 173 bx /= 1.0 * (Npoints - data->Nterms); // mean(psi^2(r)) * (N / (N-p)) 174 by /= 1.0 * (Npoints - data->Nterms); 175 176 double lambda_x = 1.0 + (data->Nterms / Npoints) * (1 - ax) / ax; 177 double lambda_y = 1.0 + (data->Nterms / Npoints) * (1 - ay) / ay; 178 179 double sigma_robust_x = lambda_x * sqrt(bx) * sigma_hat * 2.385 / ax; 180 double sigma_robust_y = lambda_y * sqrt(by) * sigma_hat * 2.385 / ay; 181 182 // This is actually sigma^2, as that's the factor in the covariance (dumouchel 4.1) 183 double sigma_final_x = MAX(SQ(sigma_robust_x), (2 * Npoints * SQ(sigma_robust_x) + SQ(data->Nterms * sigma_ols)) / (2 * Npoints + SQ(data->Nterms))); 184 double sigma_final_y = MAX(SQ(sigma_robust_y), (2 * Npoints * SQ(sigma_robust_y) + SQ(data->Nterms * sigma_ols)) / (2 * Npoints + SQ(data->Nterms))); 185 186 fit[0].dRo = sqrt(data->Cov[0][0]); 187 fit[0].duR = sqrt(data->Cov[1][1]); 188 fit[0].dDo = sqrt(data->Cov[2][2]); 189 fit[0].duD = sqrt(data->Cov[3][3]); 190 191 fit[0].dRo *= sigma_final_x; 192 fit[0].duR *= sigma_final_x; 193 fit[0].dDo *= sigma_final_y; 194 fit[0].duD *= sigma_final_y; 164 FitAstromResult fitErrors; 165 FitAstromResultInit (&fitErrors); 166 fitErrors.useWeight = FALSE; 167 168 FitPM_MinChisq(&fitErrors, data, points, Npoints); 169 170 // we use the errors from a simple OLS, ignoring masked points 171 fit[0].dRo = fitErrors.dRo; 172 fit[0].duR = fitErrors.duR; 173 fit[0].dDo = fitErrors.dDo; 174 fit[0].duD = fitErrors.duD; 195 175 } 196 176 … … 212 192 Nfit ++; 213 193 214 wx = points[i].qx; 215 wy = points[i].qy; 194 if (fit->useWeight) { 195 wx = points[i].qx; 196 wy = points[i].qy; 197 } else { 198 wx = points[i].Qx; 199 wy = points[i].Qy; 200 } 216 201 217 202 Wx += wx; -
trunk/Ohana/src/relastro/src/FitPMandPar.c
r39612 r39926 25 25 } 26 26 27 fit->useWeight = FALSE; // Ordinary Least Squares 27 28 if (!FitPMandPar_MinChisq (fit, data, points, Npoints)) return FALSE; 28 29 if (!FitPMandPar_SetChisq (fit, data, points, Npoints)) return FALSE; … … 47 48 48 49 // Solve OLS equation: failure here means the chisq matrix is degenerate, give up entirely 50 fit->useWeight = FALSE; // Ordinary Least Squares 49 51 if (!FitPMandPar_MinChisq(fit, data, points, Npoints)) { 50 52 return(FALSE); … … 69 71 70 72 // Iteratively reweight and solve 71 double sigma_hat = 0.0; // save for the error model73 // double sigma_hat = 0.0; // save for the error model 72 74 int converged = FALSE; 73 75 int iterations = 0; … … 90 92 91 93 // Solve with the new weights 94 fit->useWeight = TRUE; // Reweighted Least Squares 92 95 if (!FitPMandPar_MinChisq(fit, data, points, Npoints)) { 93 96 … … 105 108 points[i].u = sqrt(SQ(points[i].rx / points[i].dX) + SQ(points[i].ry / points[i].dY)); 106 109 } 107 sigma_hat = MedianAbsDeviation(points, Npoints) / 0.6745;110 // sigma_hat = MedianAbsDeviation(points, Npoints) / 0.6745; 108 111 break; 109 112 } … … 120 123 points[i].u = sqrt(SQ(points[i].rx / points[i].dX) + SQ(points[i].ry / points[i].dY)); 121 124 } 122 sigma_hat = MedianAbsDeviation(points, Npoints) / 0.6745;125 // sigma_hat = MedianAbsDeviation(points, Npoints) / 0.6745; 123 126 124 127 // Check convergence … … 157 160 } 158 161 159 // this section calculates the formal error on the weightedfit using the covariance values160 // NOTE EAM: in tests (fitpm.c), they seem to be too large by a factor of ~5.37162 // this section calculates the formal error on the regular (unweighted) fit using the covariance values 163 // NOTE 20160929 : use only the unmasked points to calculate the error 161 164 if (data->getError) { 162 double ax = 0.0, ay = 0.0; 163 double bx = 0.0, by = 0.0; 164 165 for (i = 0; i < Npoints; i++) { 166 ax += dpsi_cauchy(points[i].rx / points[i].dX); 167 ay += dpsi_cauchy(points[i].ry / points[i].dY); 168 169 bx += SQ(points[i].Wx); 170 by += SQ(points[i].Wy); 171 } 172 ax /= 1.0 * Npoints; // mean(psi_dot(r)) 173 ay /= 1.0 * Npoints; 174 bx /= 1.0 * (Npoints - data->Nterms); // mean(psi^2(r)) * (N / (N-p)) 175 by /= 1.0 * (Npoints - data->Nterms); 176 177 double lambda_x = 1.0 + (data->Nterms / Npoints) * (1 - ax) / ax; 178 double lambda_y = 1.0 + (data->Nterms / Npoints) * (1 - ay) / ay; 179 180 double sigma_robust_x = lambda_x * sqrt(bx) * sigma_hat * 2.385 / ax; 181 double sigma_robust_y = lambda_y * sqrt(by) * sigma_hat * 2.385 / ay; 182 183 // This is actually sigma^2, as that's the factor in the covariance (dumouchel 4.1) 184 double sigma_final_x = MAX(SQ(sigma_robust_x), (2 * Npoints * SQ(sigma_robust_x) + SQ(data->Nterms * sigma_ols)) / (2 * Npoints + SQ(data->Nterms))); 185 double sigma_final_y = MAX(SQ(sigma_robust_y), (2 * Npoints * SQ(sigma_robust_y) + SQ(data->Nterms * sigma_ols)) / (2 * Npoints + SQ(data->Nterms))); 186 187 fit[0].dRo = sqrt(data->Cov[0][0]); 188 fit[0].duR = sqrt(data->Cov[1][1]); 189 fit[0].dDo = sqrt(data->Cov[2][2]); 190 fit[0].duD = sqrt(data->Cov[3][3]); 191 fit[0].dp = sqrt(data->Cov[4][4]); 192 193 fit[0].dRo *= sigma_final_x; 194 fit[0].duR *= sigma_final_x; 195 fit[0].dDo *= sigma_final_y; 196 fit[0].duD *= sigma_final_y; 197 fit[0].dp *= sqrt(sigma_final_x * sigma_final_y); 165 FitAstromResult fitErrors; 166 FitAstromResultInit (&fitErrors); 167 fitErrors.useWeight = FALSE; 168 169 FitPMandPar_MinChisq(&fitErrors, data, points, Npoints); 170 171 // we use the errors from a simple OLS, ignoring masked points 172 fit[0].dRo = fitErrors.dRo; 173 fit[0].duR = fitErrors.duR; 174 fit[0].dDo = fitErrors.dDo; 175 fit[0].duD = fitErrors.duD; 176 fit[0].dp = fitErrors.dp; 198 177 } 199 178 … … 219 198 Nfit ++; 220 199 221 wx = points[i].qx; 222 wy = points[i].qy; 200 if (fit->useWeight) { 201 wx = points[i].qx; 202 wy = points[i].qy; 203 } else { 204 wx = points[i].Qx; 205 wy = points[i].Qy; 206 } 223 207 224 208 Wx += wx; -
trunk/Ohana/src/relastro/src/FitPosPMfixed.c
r39612 r39926 54 54 } 55 55 56 fit->useWeight = FALSE; // Ordinary Least Squares 56 57 if (!FitPosPMfixed_MinChisq (fit, data, points, Npoints)) { 57 58 if (!FitPosPMfixed_Single (fit, points, Npoints)) return FALSE; … … 83 84 84 85 // Solve OLS equation 86 fit->useWeight = FALSE; // Ordinary Least Squares 85 87 if (!FitPosPMfixed_MinChisq(fit, data, points, Npoints)) { 86 88 return(FALSE); … … 105 107 106 108 // Iteratively reweight and solve 107 double sigma_hat = 0.0; // save for the error model109 // double sigma_hat = 0.0; // save for the error model 108 110 int converged = FALSE; 109 111 int iterations = 0; … … 126 128 127 129 // Solve with the new weights 130 fit->useWeight = TRUE; // Reweighted Least Squares 128 131 if (!FitPosPMfixed_MinChisq(fit, data, points, Npoints)) { 129 132 … … 138 141 points[i].u = sqrt(SQ(points[i].rx / points[i].dX) + SQ(points[i].ry / points[i].dY)); 139 142 } 140 sigma_hat = MedianAbsDeviation(points, Npoints) / 0.6745;143 // sigma_hat = MedianAbsDeviation(points, Npoints) / 0.6745; 141 144 break; 142 145 } … … 153 156 points[i].u = sqrt(SQ(points[i].rx / points[i].dX) + SQ(points[i].ry / points[i].dY)); 154 157 } 155 sigma_hat = MedianAbsDeviation(points, Npoints) / 0.6745;158 // sigma_hat = MedianAbsDeviation(points, Npoints) / 0.6745; 156 159 157 160 // Check convergence … … 193 196 // NOTE EAM: in tests (fitpm.c), they seem to be too large by a factor of ~5.37 194 197 if (data->getError) { 195 double ax = 0.0, ay = 0.0; 196 double bx = 0.0, by = 0.0; 197 198 for (i = 0; i < Npoints; i++) { 199 ax += dpsi_cauchy(points[i].rx / points[i].dX); 200 ay += dpsi_cauchy(points[i].ry / points[i].dY); 201 202 bx += SQ(points[i].Wx); 203 by += SQ(points[i].Wy); 204 } 205 ax /= 1.0 * Npoints; // mean(psi_dot(r)) 206 ay /= 1.0 * Npoints; 207 bx /= 1.0 * (Npoints - data->Nterms); // mean(psi^2(r)) * (N / (N-p)) 208 by /= 1.0 * (Npoints - data->Nterms); 209 210 double lambda_x = 1.0 + (data->Nterms / Npoints) * (1 - ax) / ax; 211 double lambda_y = 1.0 + (data->Nterms / Npoints) * (1 - ay) / ay; 212 213 double sigma_robust_x = lambda_x * sqrt(bx) * sigma_hat * 2.385 / ax; 214 double sigma_robust_y = lambda_y * sqrt(by) * sigma_hat * 2.385 / ay; 215 216 // This is actually sigma^2, as that's the factor in the covariance (dumouchel 4.1) 217 double sigma_final_x = MAX(SQ(sigma_robust_x), (2 * Npoints * SQ(sigma_robust_x) + SQ(data->Nterms * sigma_ols)) / (2 * Npoints + SQ(data->Nterms))); 218 double sigma_final_y = MAX(SQ(sigma_robust_y), (2 * Npoints * SQ(sigma_robust_y) + SQ(data->Nterms * sigma_ols)) / (2 * Npoints + SQ(data->Nterms))); 219 220 fit[0].dRo = sqrt(data->Cov[0][0]); 221 fit[0].dDo = sqrt(data->Cov[1][1]); 222 223 fit[0].dRo *= sigma_final_x; 224 fit[0].dDo *= sigma_final_y; 198 FitAstromResult fitErrors; 199 FitAstromResultInit (&fitErrors); 200 fitErrors.useWeight = FALSE; 201 202 FitPosPMfixed_MinChisq(&fitErrors, data, points, Npoints); 203 204 // we use the errors from a simple OLS, ignoring masked points 205 fit[0].dRo = fitErrors.dRo; 206 fit[0].duR = fitErrors.duR; 207 fit[0].dDo = fitErrors.dDo; 208 fit[0].duD = fitErrors.duD; 209 fit[0].dp = fitErrors.dp; 225 210 } 226 211 … … 242 227 Nfit ++; 243 228 244 wx = points[i].qx; 245 wy = points[i].qy; 229 if (fit->useWeight) { 230 wx = points[i].qx; 231 wy = points[i].qy; 232 } else { 233 wx = points[i].Qx; 234 wy = points[i].Qy; 235 } 246 236 247 237 Wx += wx; -
trunk/Ohana/src/relastro/src/GetAstromError.c
r39457 r39926 48 48 if (isnan(code[0].astromErrSys)) return NAN; 49 49 50 if (measure[0].photcode == 1030) { 51 if (mode == ERROR_MODE_RA) { 52 dPobs = pow(10.0, (6.0 * measure[0].dXccd - 3.0)); // dXccd is a value in pixels 53 } 54 if (mode == ERROR_MODE_DEC) { 55 dPobs = pow(10.0, (6.0 * measure[0].dYccd - 3.0)); // dXccd is a value in pixels 56 } 57 } 58 50 59 AS = code[0].astromErrScale; 51 60 MS = code[0].astromErrMagScale; … … 69 78 // to match the 2MASS / Tycho / ICRS reference frame. As Nloop gets higher, the weight 70 79 // needs to drop to allow the ps1 measurements to drive the solution 80 int isGAIA = USE_GALAXY_MODEL && !isImage && (measure[0].photcode == 1030); 71 81 int is2MASS = USE_GALAXY_MODEL && !isImage && (measure[0].photcode >= 2011) && (measure[0].photcode <= 2013); 72 82 int isTycho = USE_GALAXY_MODEL && !isImage && (measure[0].photcode >= 2020) && (measure[0].photcode <= 2021); 83 84 int hasGAIA = USE_GALAXY_MODEL && isImage && (measure[0].dbFlags & ID_MEAS_OBJECT_HAS_GAIA); 73 85 int has2MASS = USE_GALAXY_MODEL && isImage && (measure[0].dbFlags & ID_MEAS_OBJECT_HAS_2MASS); 86 int hasTycho = USE_GALAXY_MODEL && isImage && (measure[0].dbFlags & ID_MEAS_OBJECT_HAS_TYCHO); 74 87 75 88 // modest hack: if the object has 2MASS or Tycho, we set this internal bit and adjust the … … 79 92 dPtotal = dPtotal / LoopWeight2MASS[Nloop]; 80 93 } 94 if (hasGAIA && LoopWeightGAIA && (Nloop >= 0)) { 95 dPtotal = dPtotal / LoopWeightGAIA[Nloop]; 96 } 97 if (hasTycho && LoopWeightTycho && (Nloop >= 0)) { 98 dPtotal = dPtotal / LoopWeightTycho[Nloop]; 99 } 100 81 101 if (is2MASS && LoopWeight2MASS && (Nloop >= 0)) { 82 102 dPtotal = dPtotal / LoopWeight2MASS[Nloop]; 103 } 104 if (isGAIA && LoopWeightGAIA && (Nloop >= 0)) { 105 dPtotal = dPtotal / LoopWeightGAIA[Nloop]; 83 106 } 84 107 if (isTycho && LoopWeightTycho && (Nloop >= 0)) { … … 120 143 // do not raise an exception, just send back the result 121 144 if (isnan(code[0].astromErrSys)) return NAN; 145 146 if (measure[0].photcode == 1030) { 147 if (mode == ERROR_MODE_RA) { 148 dPobs = pow(10.0, (6.0 * measure[0].dXccd - 3.0)); // dXccd is a value in pixels 149 } 150 if (mode == ERROR_MODE_DEC) { 151 dPobs = pow(10.0, (6.0 * measure[0].dYccd - 3.0)); // dXccd is a value in pixels 152 } 153 } 122 154 123 155 AS = code[0].astromErrScale; … … 143 175 // to match the 2MASS / Tycho / ICRS reference frame. As Nloop gets higher, the weight 144 176 // needs to drop to allow the ps1 measurements to drive the solution 177 int isGAIA = USE_GALAXY_MODEL && !isImage && (measure[0].photcode == 1030); 145 178 int is2MASS = USE_GALAXY_MODEL && !isImage && (measure[0].photcode >= 2011) && (measure[0].photcode <= 2013); 146 179 int isTycho = USE_GALAXY_MODEL && !isImage && (measure[0].photcode >= 2020) && (measure[0].photcode <= 2021); 180 181 int hasGAIA = USE_GALAXY_MODEL && isImage && (measure[0].dbFlags & ID_MEAS_OBJECT_HAS_GAIA); 147 182 int has2MASS = USE_GALAXY_MODEL && isImage && (measure[0].dbFlags & ID_MEAS_OBJECT_HAS_2MASS); 183 int hasTycho = USE_GALAXY_MODEL && isImage && (measure[0].dbFlags & ID_MEAS_OBJECT_HAS_TYCHO); 148 184 149 185 // modest hack: if the object has 2MASS or Tycho, we set this internal bit and adjust the … … 153 189 dPtotal = dPtotal / LoopWeight2MASS[Nloop]; 154 190 } 191 if (hasGAIA && LoopWeightGAIA && (Nloop >= 0)) { 192 dPtotal = dPtotal / LoopWeightGAIA[Nloop]; 193 } 194 if (hasTycho && LoopWeightTycho && (Nloop >= 0)) { 195 dPtotal = dPtotal / LoopWeightTycho[Nloop]; 196 } 197 155 198 if (is2MASS && LoopWeight2MASS) { 156 199 dPtotal = dPtotal / LoopWeight2MASS[Nloop]; 200 } 201 if (isGAIA && LoopWeightGAIA && (Nloop >= 0)) { 202 dPtotal = dPtotal / LoopWeightGAIA[Nloop]; 157 203 } 158 204 if (isTycho && LoopWeightTycho) { -
trunk/Ohana/src/relastro/src/ImageOps.c
r39580 r39926 6 6 static Image *image; // list of available images 7 7 static off_t Nimage; // number of available images 8 static int isImageSubset; 8 9 9 10 // if we read only a subset of the rows from the Image FITS, LineNumber tells us to which row … … 78 79 } 79 80 80 void initImages (Image *input, off_t *line_number, off_t N ) {81 void initImages (Image *input, off_t *line_number, off_t N, int isSubset) { 81 82 82 83 off_t i; 83 84 85 isImageSubset = isSubset; 84 86 image = input; 85 87 LineNumber = line_number; … … 136 138 // we call gfits_db_free as well as this function. sometimes those point at the same 137 139 // memory location, in which case we should only do the free once. 138 if (( void *) dbImagePtr != (void *) image) free (image);140 if (((void *) dbImagePtr != (void *) image) && isImageSubset) free (image); 139 141 free_astrom_table(); 140 142 } … … 793 795 ref[i].D = catalog[c].average[n].D; 794 796 797 int XVERB = FALSE; 798 XVERB |= (catalog[c].average[n].objID == OBJ_ID_SRC) && (catalog[c].average[n].catID == CAT_ID_SRC); 799 XVERB |= (catalog[c].average[n].objID == OBJ_ID_DST) && (catalog[c].average[n].catID == CAT_ID_DST); 800 if (XVERB) { 801 fprintf (stderr, "found test object\n"); 802 } 803 795 804 // if we are applying the galaxy model, move the reference position... 796 if ( USE_GALAXY_MODEL) {805 if (APPLY_PROPER_MOTION) { 797 806 // apply proper-motion from average position to measure epoch: 798 807 float dTime = (measure[0].t - catalog[c].average[n].Tmean) / (86400*365.25) ; // time relative to Tmean in years … … 934 943 } 935 944 936 # if (0)937 /** lifted from relphot/StarOps.clean_measures */938 void FlagOutliers2D(Catalog *catalog);939 940 // operates on Full values (not tiny)941 void FlagOutliers (Catalog *catalog) {942 943 // XXX FlagOutliers is now just using FlagOutliers2D944 FlagOutliers2D(catalog);945 return;946 947 int Ndel, Nave;948 off_t i, j, k, m, N, Nmax, TOOFEW, Nsecfilt;949 double Ns, theta, x, y;950 double *R, *D, *dR, *dD;951 StatType statsR, statsD;952 953 Nsecfilt = GetPhotcodeNsecfilt();954 assert(catalog[0].Nsecfilt == Nsecfilt);955 956 if (VERBOSE2) fprintf (stderr, "marking poor measures\n");957 Nmax = 0;958 for (i = 0; i < catalog[0].Naverage; i++) {959 Nmax = MAX (Nmax, catalog[0].average[i].Nmeasure);960 }961 962 ALLOCATE (R, double, Nmax);963 ALLOCATE (D, double, Nmax);964 ALLOCATE (dR, double, Nmax);965 ALLOCATE (dD, double, Nmax);966 967 /* it makes no sense to mark 3-sigma outliers with <5 measurements */968 TOOFEW = MAX (5, SRC_MEAS_TOOFEW);969 970 Ns = CLIP_THRESH;971 Ndel = Nave = 0;972 973 /* loop over each object in the catalog */974 for (j = 0; j < catalog[0].Naverage; j++) {975 976 // pointer to this set of measurements977 m = catalog[0].average[j].measureOffset;978 Measure *measure = &catalog[0].measure[m];979 980 /* accumulate list of valid measurements */981 N = 0;982 for (k = 0; k < catalog[0].average[j].Nmeasure; k++) {983 // skip measurements based on user selected criteria984 if (!MeasFilterTest(&measure[k], FALSE)) continue;985 R[N] = measure[k].R;986 D[N] = measure[k].D;987 dR[N] = GetAstromError (&measure[k], ERROR_MODE_RA);988 dD[N] = GetAstromError (&measure[k], ERROR_MODE_DEC);989 if (isnan(R[N]) || isnan(D[N])) continue;990 N++;991 }992 if (N <= TOOFEW) continue;993 994 /* 3-sigma clip based on stats of inner 50% */995 initstats ("MEAN");996 liststats (R, dR, N, &statsR);997 liststats (D, dD, N, &statsD);998 999 statsR.sigma = MAX (MIN_ERROR, statsR.sigma);1000 statsD.sigma = MAX (MIN_ERROR, statsD.sigma);1001 1002 /* compare per-object distance to this standard deviation, and flag outliers*/1003 N = 0;1004 for (k = 0; k < catalog[0].average[j].Nmeasure; k++) {1005 // reset flag on each invocation1006 measure[k].dbFlags &= ~ID_MEAS_POOR_ASTROM;1007 1008 // skip measurements based on user selected criteria1009 if (!MeasFilterTest(&measure[k], FALSE)) continue;1010 1011 x = measure[k].R - statsR.median;1012 y = measure[k].D - statsD.median;1013 theta = atan2(y,x);1014 if ((x*x + y*y) > (SQR(statsR.sigma * Ns * cos(theta)) +1015 SQR(statsD.sigma * Ns * sin(theta)))) {1016 measure[k].dbFlags |= ID_MEAS_POOR_ASTROM;1017 Ndel++;1018 }1019 N++;1020 Nave ++;1021 }1022 1023 // examine results1024 // relastroVisualPlotOutliers(catalog, catalog[0].average[j].measureOffset, catalog[0].average[j].Nmeasure, statsR, statsD, Ns);1025 }1026 1027 if (VERBOSE) fprintf (stderr, "%d measures marked poor, %d total\n", Ndel, Nave);1028 free (R);1029 free (dR);1030 free (D);1031 free (dD);1032 }1033 1034 1035 /** an alternative outlier rejection scheme */1036 void FlagOutliers2D (Catalog *catalog) {1037 1038 int Ndel, Nave;1039 off_t i, j, k, m, N, Nmax, TOOFEW, Nsecfilt;1040 double *index;1041 double Ns, theta, x, y;1042 double *R, *D, *dR, *dD, *d2;1043 StatType statsR, statsD;1044 1045 // XXX we are not going to use this for now1046 return;1047 1048 Nsecfilt = GetPhotcodeNsecfilt();1049 assert(catalog[0].Nsecfilt == Nsecfilt);1050 1051 if (VERBOSE2) fprintf (stderr, "marking poor measures\n");1052 Nmax = 0;1053 for (i = 0; i < catalog[0].Naverage; i++) {1054 Nmax = MAX (Nmax, catalog[0].average[i].Nmeasure);1055 }1056 1057 ALLOCATE (R, double, Nmax);1058 ALLOCATE (D, double, Nmax);1059 ALLOCATE (dR, double, Nmax);1060 ALLOCATE (dD, double, Nmax);1061 ALLOCATE (d2, double, Nmax);1062 ALLOCATE (index, double, Nmax);1063 1064 /* it makes no sense to mark 3-sigma outliers with <5 measurements */1065 TOOFEW = MAX (5, SRC_MEAS_TOOFEW);1066 1067 Ns = CLIP_THRESH;1068 Ndel = Nave = 0;1069 1070 /* loop over each object in the catalog */1071 for (j = 0; j < catalog[0].Naverage; j++) {1072 1073 // pointer to this set of measurements1074 m = catalog[0].average[j].measureOffset;1075 Measure *measure = &catalog[0].measure[m];1076 1077 /* accumulate list of valid measurements */1078 N = 0;1079 for (k = 0; k < catalog[0].average[j].Nmeasure; k++) {1080 1081 // reset flag on each invocation1082 measure[k].dbFlags &= ~ID_MEAS_POOR_ASTROM;1083 1084 // skip measurements based on user selected criteria1085 if (!MeasFilterTest(&measure[k], FALSE)) continue;1086 R[N] = measure[k].R;1087 D[N] = measure[k].D;1088 dR[N] = GetAstromError(&measure[k], ERROR_MODE_RA);1089 dD[N] = GetAstromError(&measure[k], ERROR_MODE_DEC);1090 if (isnan(R[N]) || isnan(D[N])) continue;1091 N++;1092 }1093 if (N <= TOOFEW) continue;1094 1095 /* calculate mean of all points*/1096 initstats ("MEAN");1097 liststats (R, dR, N, &statsR);1098 liststats (D, dD, N, &statsD);1099 statsR.sigma = MAX (MIN_ERROR, statsR.sigma);1100 statsD.sigma = MAX (MIN_ERROR, statsD.sigma);1101 1102 /* calculate deviations of all points*/1103 N = 0;1104 for (k = 0; k < catalog[0].average[j].Nmeasure; k++) {1105 // skip bad measurements1106 if (!MeasFilterTest(&measure[k], FALSE)) continue;1107 x = measure[k].R - statsR.median;1108 y = measure[k].D - statsD.median;1109 theta = atan2(y,x);1110 d2[N] = (x*x + y*y) / (SQR(statsR.sigma * Ns * cos(theta)) +1111 SQR(statsD.sigma * Ns * sin(theta)));1112 index[N] = k;1113 N++;1114 }1115 1116 // sort d21117 dsortpair(d2, index, N);1118 N = (N/2 > (N-1)) ? N/2 : N-1;1119 1120 // recalculate image center, sigma based on closest 50% of points1121 for (k = 0; k < N; k++) {1122 off_t ind = (off_t) index[k];1123 R[k] = measure[ind].R;1124 D[k] = measure[ind].D;1125 dR[k] = GetAstromError(&measure[ind], ERROR_MODE_RA);1126 dD[k] = GetAstromError(&measure[ind], ERROR_MODE_DEC);1127 }1128 liststats (R, dR, N, &statsR);1129 liststats (D, dD, N, &statsD);1130 statsR.sigma = MAX (MIN_ERROR, statsR.sigma);1131 statsD.sigma = MAX (MIN_ERROR, statsD.sigma);1132 1133 // use these new statistics to flag outliers1134 N = 0;1135 for (k = 0; k < catalog[0].average[j].Nmeasure; k++) {1136 //skip bad measurements1137 if (!MeasFilterTest(&measure[k], FALSE)) continue;1138 x = measure[k].R - statsR.median;1139 y = measure[k].D - statsD.median;1140 theta = atan2(y,x);1141 d2[N] = (x*x + y*y) / (SQR(statsR.sigma * Ns * cos(theta)) +1142 SQR(statsD.sigma * Ns * sin(theta)));1143 if ((d2[N]) > 1) {1144 measure[k].dbFlags |= ID_MEAS_POOR_ASTROM;1145 Ndel ++;1146 }1147 N++;1148 Nave++;1149 } // done rejecting outliers1150 1151 // examine results1152 // relastroVisualPlotOutliers(catalog, catalog[0].average[j].measureOffset, catalog[0].average[j].Nmeasure, statsR, statsD, Ns);1153 1154 } // done looping over objects1155 1156 if (VERBOSE) fprintf (stderr, "%d measures marked poor, %d total\n", Ndel, Nave);1157 free (R);1158 free (dR);1159 free (D);1160 free (dD);1161 free (d2);1162 free (index);1163 }1164 1165 /** Determine whether a measurement should be included in the analysis, based on supplied filter criteria */1166 // we only optionally apply the sigma limit: for object averages, this should not be used1167 int MeasFilterTestTiny(MeasureTiny *measure, int applySigmaLim) {1168 int found, k;1169 long mask;1170 PhotCode *code;1171 float mag;1172 1173 if (!finite(measure[0].R) || !finite(measure[0].D)) return FALSE;1174 if (!finite(measure[0].M)) return FALSE; //XXX is this necessary for all relastro tasks?1175 if (!finite(measure[0].dM)) return FALSE; //XXX is this necessary for all relastro tasks?1176 1177 if ((MinBadQF > 0.0) && (isGPC1chip(measure[0].photcode) || isGPC1stack(measure[0].photcode))) {1178 if (!isfinite(measure[0].psfQF)) { return FALSE; };1179 if (measure[0].psfQF < MinBadQF) { return FALSE; };1180 }1181 1182 /* select measurements by photcode, or equiv photcode, if specified */1183 if (NphotcodesKeep > 0) {1184 found = FALSE;1185 for (k = 0; (k < NphotcodesKeep) && !found; k++) {1186 if (photcodesKeep[k][0].code == measure[0].photcode) found = TRUE;1187 if (photcodesKeep[k][0].code == GetPhotcodeEquivCodebyCode(measure[0].photcode)) found = TRUE;1188 }1189 if (!found) return FALSE;1190 }1191 1192 if (NphotcodesSkip > 0) {1193 found = FALSE;1194 for (k = 0; (k < NphotcodesSkip) && !found; k++) {1195 if (photcodesSkip[k][0].code == measure[0].photcode) found = TRUE;1196 if (photcodesSkip[k][0].code == GetPhotcodeEquivCodebyCode(measure[0].photcode)) found = TRUE;1197 }1198 if (found) return FALSE;1199 }1200 1201 /* select measurements by time */1202 if (TimeSelect) {1203 if (measure[0].t < TSTART) return FALSE;1204 if (measure[0].t > TSTOP) return FALSE;1205 }1206 1207 /* select measurements by quality */1208 if (PhotFlagSelect) {1209 if (PhotFlagBad) {1210 mask = PhotFlagBad;1211 } else {1212 code = GetPhotcodebyCode (measure[0].photcode);1213 if (!code) return FALSE;1214 mask = code[0].astromBadMask;1215 }1216 if (mask & measure[0].photFlags) return FALSE;1217 }1218 1219 /* select measurements by measurement error */1220 // this is a bit convoluted: applySigmaLim is only TRUE when this function is1221 // called by bcatalog. for UpdateObjects, it is FALSE1222 if (applySigmaLim && (SIGMA_LIM > 0) && (measure[0].dM > SIGMA_LIM)) {1223 return FALSE;1224 }1225 1226 /* select measurements by mag limit */1227 if (ImagSelect) {1228 mag = PhotInstTiny (measure, MAG_CLASS_PSF);1229 if (mag < ImagMin || mag > ImagMax) return FALSE;1230 }1231 1232 return TRUE;1233 }1234 1235 # define SUPER_VERBOSE 01236 1237 /** Determine whether a measurement should be included in the analysis, based on supplied filter criteria */1238 // we only optionally apply the sigma limit: for object averages, this should not be used (should it?)1239 int MeasFilterTest(Measure *measure, int applySigmaLim) {1240 int found, k;1241 long mask;1242 PhotCode *code;1243 float mag;1244 1245 if (!finite(measure[0].R) || !finite(measure[0].D)) { if (SUPER_VERBOSE) fprintf (stderr, "filter 1\n"); return FALSE; };1246 if (!finite(measure[0].M)) { if (SUPER_VERBOSE) fprintf (stderr, "filter 2\n"); return FALSE; }; //XXX is this necessary for all relastro tasks?1247 if (!finite(measure[0].dM)) { if (SUPER_VERBOSE) fprintf (stderr, "filter 3\n"); return FALSE; }; //XXX is this necessary for all relastro tasks?1248 1249 /* select measurements by photcode, or equiv photcode, if specified */1250 if (NphotcodesKeep > 0) {1251 found = FALSE;1252 for (k = 0; (k < NphotcodesKeep) && !found; k++) {1253 if (photcodesKeep[k][0].code == measure[0].photcode) found = TRUE;1254 if (photcodesKeep[k][0].code == GetPhotcodeEquivCodebyCode(measure[0].photcode)) found = TRUE;1255 }1256 if (!found) { if (SUPER_VERBOSE) fprintf (stderr, "filter 4\n"); return FALSE; };1257 }1258 1259 if (NphotcodesSkip > 0) {1260 found = FALSE;1261 for (k = 0; (k < NphotcodesSkip) && !found; k++) {1262 if (photcodesSkip[k][0].code == measure[0].photcode) found = TRUE;1263 if (photcodesSkip[k][0].code == GetPhotcodeEquivCodebyCode(measure[0].photcode)) found = TRUE;1264 }1265 if (found) { if (SUPER_VERBOSE) fprintf (stderr, "filter 5\n"); return FALSE; };1266 }1267 1268 if ((MinBadQF > 0.0) && isGPC1chip(measure[0].photcode)) {1269 if (!isfinite(measure[0].psfQF)) { if (SUPER_VERBOSE) fprintf (stderr, "filter 6\n"); return FALSE; };1270 if (measure[0].psfQF < MinBadQF) { if (SUPER_VERBOSE) fprintf (stderr, "filter 7\n"); return FALSE; };1271 }1272 1273 /* select measurements by time */1274 if (TimeSelect) {1275 if (measure[0].t < TSTART) { if (SUPER_VERBOSE) fprintf (stderr, "filter 8\n"); return FALSE; };1276 if (measure[0].t > TSTOP) { if (SUPER_VERBOSE) fprintf (stderr, "filter 9\n"); return FALSE; };1277 }1278 1279 /* select measurements by quality */1280 if (PhotFlagSelect) {1281 if (PhotFlagBad) {1282 mask = PhotFlagBad;1283 } else {1284 code = GetPhotcodebyCode (measure[0].photcode);1285 if (!code) { if (SUPER_VERBOSE) fprintf (stderr, "filter 10\n"); return FALSE; };1286 mask = code[0].astromBadMask;1287 }1288 if (mask & measure[0].photFlags) { if (SUPER_VERBOSE) fprintf (stderr, "filter 11\n"); return FALSE; };1289 }1290 1291 /* select measurements by measurement error */1292 if (applySigmaLim && (SIGMA_LIM > 0) && (measure[0].dM > SIGMA_LIM)) {1293 { if (SUPER_VERBOSE) fprintf (stderr, "filter 12\n"); return FALSE; };1294 }1295 1296 /* select measurements by mag limit */1297 if (ImagSelect) {1298 mag = PhotInst (measure, MAG_CLASS_PSF);1299 if (mag < ImagMin || mag > ImagMax) { if (SUPER_VERBOSE) fprintf (stderr, "filter 13\n"); return FALSE; };1300 }1301 1302 return TRUE;1303 }1304 # endif -
trunk/Ohana/src/relastro/src/StarMaps.c
r39457 r39926 166 166 dLmax = dMmax = 0.0; 167 167 168 float plateScale; 169 if (images[N].coords.mosaic) { 170 // NOTE: for the full pixel to sky plate scale, use this: 171 // float plateScaleX = 3600.0*images[N].coords.mosaic->cdelt1*images[N].coords.cdelt1; 172 // float plateScaleY = 3600.0*images[N].coords.mosaic->cdelt2*images[N].coords.cdelt2; 173 174 // since we are compare L,M values, just need to compensate for focal plate to sky: 175 float plateScaleX = 3600.0*fabs(images[N].coords.mosaic->cdelt1); 176 float plateScaleY = 3600.0*fabs(images[N].coords.mosaic->cdelt2); 177 plateScale = 0.5*(plateScaleX + plateScaleY); 178 } else { 179 // since we are compare L,M values, just need to compensate for arcsec vs degrees: 180 plateScale = 3600.0; 181 } 182 168 183 for (i = 0; i < starmap[N].Npoints; i++) { 169 184 … … 171 186 XY_to_LM (&L, &M, starmap[N].points[i].X, starmap[N].points[i].Y, &images[N].coords); 172 187 173 starmap[N].points[i].dL = starmap[N].points[i].L - L;174 starmap[N].points[i].dM = starmap[N].points[i].M - M;188 starmap[N].points[i].dL = plateScale*(starmap[N].points[i].L - L); 189 starmap[N].points[i].dM = plateScale*(starmap[N].points[i].M - M); 175 190 176 191 dLmax = MAX(fabs(starmap[N].points[i].dL), dLmax); -
trunk/Ohana/src/relastro/src/UpdateChips.c
r39457 r39926 42 42 AstromErrorSetLoop (Nloop, TRUE); 43 43 44 // if ChipMapLoop or ChipOrderLoop is set use that to define the value of CHIPMAP and/or CHIPORDER this loop 45 if (ChipMapLoop) { CHIPMAP = ChipMapLoop[Nloop]; } 46 if (ChipOrderLoop) { CHIPORDER = ChipOrderLoop[Nloop]; } 47 44 48 if (NTHREADS) { 45 49 UpdateChips_threaded (catalog, Ncatalog); … … 60 64 for (i = 0; i < Nimage; i++) { 61 65 62 VERBOSE_IMAGE = !strcmp(image[i].name, "o5745g0516o.356887.cm.982631.smf[XY54]"); 66 VERBOSE = FALSE; 67 VERBOSE_IMAGE |= !strcmp(image[i].name, "o5745g0516o.356887.cm.982631.smf[XY45]"); 68 VERBOSE_IMAGE |= !strcmp(image[i].name, "o5745g0526o.356899.cm.982643.smf[XY45]"); 69 VERBOSE_IMAGE |= !strcmp(image[i].name, "o5748g0436o.358811.cm.982690.smf[XY34]"); 63 70 64 71 // XXX looks like everything below is thread safe : we can unroll this into a set of 65 72 // helper functions that grab the next available chip.... 66 73 74 // allow certain cameras to stay static 75 if (SKIP_PS1_CHIP && isGPC1chip (image[i].photcode)) { Nskip ++; mode[i] = 0; continue; } 76 if (SKIP_PS1_STACK && isGPC1stack(image[i].photcode)) { Nskip ++; mode[i] = 0; continue; } 77 if (SKIP_HSC && isHSCchip (image[i].photcode)) { Nskip ++; mode[i] = 0; continue; } 78 if (SKIP_CFH && isCFHchip (image[i].photcode)) { Nskip ++; mode[i] = 0; continue; } 79 67 80 /* skip all except WRP images */ 68 81 if (strcmp(&image[i].coords.ctype[4], "-WRP")) { … … 160 173 setImageRaw (catalog, Ncatalog, i, raw, Nraw, MODE_MOSAIC); 161 174 if (USE_GALAXY_MODEL) { 162 // XXX DEPRECATE?175 // the image calibration was calculated using a galaxy motion model 163 176 image[i].flags |= ID_IMAGE_ASTROM_GMM; 164 177 } … … 281 294 } 282 295 296 // allow certain cameras to stay static 297 if (SKIP_PS1_CHIP && isGPC1chip (image[i].photcode)) { threadinfo->Nskip ++; threadinfo->mode[i] = 0; continue; } 298 if (SKIP_PS1_STACK && isGPC1stack(image[i].photcode)) { threadinfo->Nskip ++; threadinfo->mode[i] = 0; continue; } 299 if (SKIP_HSC && isHSCchip (image[i].photcode)) { threadinfo->Nskip ++; threadinfo->mode[i] = 0; continue; } 300 if (SKIP_CFH && isCFHchip (image[i].photcode)) { threadinfo->Nskip ++; threadinfo->mode[i] = 0; continue; } 301 283 302 /* skip all except WRP images */ 284 303 if (strcmp(&image[i].coords.ctype[4], "-WRP")) { -
trunk/Ohana/src/relastro/src/UpdateMeasures.c
r39624 r39926 115 115 116 116 // only modify the chip coordinates 117 if (isGPC1chip (measureT->photcode)) { 117 if (UPDATE_PS1_STACK_MEASURE && isGPC1stack (measureT->photcode)) { 118 measureT->R = R; 119 measureT->D = D; 120 if (measureB) { 121 measureB->R = R; 122 measureB->D = D; 123 } 124 } 125 // only modify the chip coordinates 126 if (UPDATE_PS1_CHIP_MEASURE && isGPC1chip (measureT->photcode)) { 127 measureT->R = R; 128 measureT->D = D; 129 if (measureB) { 130 measureB->R = R; 131 measureB->D = D; 132 } 133 } 134 // only modify the chip coordinates 135 if (UPDATE_HSC_MEASURE && isGPC1chip (measureT->photcode)) { 136 measureT->R = R; 137 measureT->D = D; 138 if (measureB) { 139 measureB->R = R; 140 measureB->D = D; 141 } 142 } 143 // only modify the chip coordinates 144 if (UPDATE_CFH_MEASURE && isGPC1chip (measureT->photcode)) { 118 145 measureT->R = R; 119 146 measureT->D = D; -
trunk/Ohana/src/relastro/src/UpdateObjectOffsets.c
r39693 r39926 167 167 strextend (&command, "relastro_client -update-offsets"); 168 168 strextend (&command, "-hostID %d", group->hosts[i][0].hostID); 169 strextend (&command, "-hostdir %s", group->hosts[i][0].pathname); 170 169 171 strextend (&command, "-D CATDIR %s", CATDIR); 170 strextend (&command, "-hostdir %s", group->hosts[i][0].pathname);171 172 strextend (&command, "-region %f %f %f %f", UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax); 172 173 strextend (&command, "-statmode %s", STATMODE); 173 174 strextend (&command, "-minerror %f", MIN_ERROR); 174 175 176 strextend (&command, "-D RELASTRO_SIGMA_LIM %f", SIGMA_LIM); 177 strextend (&command, "-D RELASTRO_SRC_MEAS_TOOFEW %d", SRC_MEAS_TOOFEW); 178 175 179 if (FIT_MODE == FIT_PM_ONLY) strextend (&command, "-pm"); 176 180 if (FIT_MODE == FIT_PAR_ONLY) strextend (&command, "-par"); … … 180 184 if (VERBOSE2) strextend (&command, "-vv"); 181 185 if (RESET) strextend (&command, "-reset"); 182 if (UPDATE) strextend (&command, "-update");183 184 if (RESET_BAD_IMAGES) strextend (&command, "-reset-bad-images");185 186 186 187 if (ImagSelect) strextend (&command, "-instmag %f %f", ImagMin, ImagMax); 187 188 if (MaxDensityUse) strextend (&command, "-max-density %f", MaxDensityValue); 188 189 if (USE_BASIC_CHECK) strextend (&command, "-basic-image-search");190 189 if (FlagOutlier) strextend (&command, "-clip %d", CLIP_THRESH); 191 190 if (ExcludeBogus) strextend (&command, "-exclude-bogus %f", ExcludeBogusRadius); 192 191 193 if (USE_ALL_IMAGES) strextend (&command, "-use-all-images");194 192 if (USE_FIXED_PIXCOORDS) strextend (&command, "-D USE_FIXED_PIXCOORDS 1"); 195 196 if (REPAIR_STACKS) strextend (&command, "-repair-stacks-on-update");197 if (CHECK_MEASURE_TO_IMAGE) strextend (&command, "-check-measures");198 199 193 if (PHOTCODE_KEEP_LIST) strextend (&command, "+photcode %s", PHOTCODE_KEEP_LIST); 200 194 if (PHOTCODE_SKIP_LIST) strextend (&command, "-photcode %s", PHOTCODE_SKIP_LIST); … … 204 198 // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values 205 199 206 if (N_BOOTSTRAP_SAMPLES > 1) strextend (&command, "-bootstrap-samples %d", N_BOOTSTRAP_SAMPLES);207 208 200 if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) { 209 201 strextend (&command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); … … 213 205 } 214 206 207 if (REPAIR_STACKS) strextend (&command, "-repair-stacks-on-update"); 208 if (CHECK_MEASURE_TO_IMAGE) strextend (&command, "-check-measures"); 209 210 if (UPDATE_PS1_STACK_MEASURE) strextend (&command, "-update-ps1-stack"); 211 if (UPDATE_PS1_CHIP_MEASURE) strextend (&command, "-update-ps1-chip"); 212 if (UPDATE_HSC_MEASURE) strextend (&command, "-update-hsc"); 213 if (UPDATE_CFH_MEASURE) strextend (&command, "-update-cfh"); 214 215 if (UPDATE) strextend (&command, "-update"); 216 if (RESET_BAD_IMAGES) strextend (&command, "-reset-bad-images"); 217 if (USE_BASIC_CHECK) strextend (&command, "-basic-image-search"); 218 if (USE_ALL_IMAGES) strextend (&command, "-use-all-images"); 219 215 220 if (MinBadQF > 0.0) strextend (&command, "-min-bad-psfqf %f", MinBadQF); 216 221 if (MaxMeanOffset != 10.0) strextend (&command, "-max-mean-offset %f", MaxMeanOffset); 222 if (N_BOOTSTRAP_SAMPLES > 1) strextend (&command, "-bootstrap-samples %d", N_BOOTSTRAP_SAMPLES); 217 223 218 224 if (TimeSelect) { … … 300 306 strextend (&command, "relastro_client -update-offsets"); 301 307 strextend (&command, "-hostID %d", table->hosts[i].hostID); 308 strextend (&command, "-hostdir %s", table->hosts[i].pathname); 309 302 310 strextend (&command, "-D CATDIR %s", CATDIR); 303 strextend (&command, "-hostdir %s", table->hosts[i].pathname);304 311 strextend (&command, "-region %f %f %f %f", UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax); 305 312 strextend (&command, "-statmode %s", STATMODE); 306 313 strextend (&command, "-minerror %f", MIN_ERROR); 307 314 315 strextend (&command, "-D RELASTRO_SIGMA_LIM %f", SIGMA_LIM); 316 strextend (&command, "-D RELASTRO_SRC_MEAS_TOOFEW %d", SRC_MEAS_TOOFEW); 317 308 318 if (FIT_MODE == FIT_PM_ONLY) strextend (&command, "-pm"); 309 319 if (FIT_MODE == FIT_PAR_ONLY) strextend (&command, "-par"); … … 313 323 if (VERBOSE2) strextend (&command, "-vv"); 314 324 if (RESET) strextend (&command, "-reset"); 315 if (UPDATE) strextend (&command, "-update");316 317 if (RESET_BAD_IMAGES) strextend (&command, "-reset-bad-images");318 325 319 326 if (ImagSelect) strextend (&command, "-instmag %f %f", ImagMin, ImagMax); 320 327 if (MaxDensityUse) strextend (&command, "-max-density %f", MaxDensityValue); 321 322 if (USE_BASIC_CHECK) strextend (&command, "-basic-image-search");323 328 if (FlagOutlier) strextend (&command, "-clip %d", CLIP_THRESH); 324 329 if (ExcludeBogus) strextend (&command, "-exclude-bogus %f", ExcludeBogusRadius); 325 330 326 if (USE_ALL_IMAGES) strextend (&command, "-use-all-images");327 331 if (USE_FIXED_PIXCOORDS) strextend (&command, "-D USE_FIXED_PIXCOORDS 1"); 328 329 if (REPAIR_STACKS) strextend (&command, "-repair-stacks-on-update");330 if (CHECK_MEASURE_TO_IMAGE) strextend (&command, "-check-measures");331 332 332 if (PHOTCODE_KEEP_LIST) strextend (&command, "+photcode %s", PHOTCODE_KEEP_LIST); 333 333 if (PHOTCODE_SKIP_LIST) strextend (&command, "-photcode %s", PHOTCODE_SKIP_LIST); … … 337 337 // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values 338 338 339 if (N_BOOTSTRAP_SAMPLES > 1) strextend (&command, "-bootstrap-samples %d", N_BOOTSTRAP_SAMPLES);340 341 339 if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) { 342 340 strextend (&command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); … … 345 343 strextend (&command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG); 346 344 } 345 346 if (REPAIR_STACKS) strextend (&command, "-repair-stacks-on-update"); 347 if (CHECK_MEASURE_TO_IMAGE) strextend (&command, "-check-measures"); 348 349 if (UPDATE_PS1_STACK_MEASURE) strextend (&command, "-update-ps1-stack"); 350 if (UPDATE_PS1_CHIP_MEASURE) strextend (&command, "-update-ps1-chip"); 351 if (UPDATE_HSC_MEASURE) strextend (&command, "-update-hsc"); 352 if (UPDATE_CFH_MEASURE) strextend (&command, "-update-cfh"); 353 354 if (UPDATE) strextend (&command, "-update"); 355 if (RESET_BAD_IMAGES) strextend (&command, "-reset-bad-images"); 356 if (USE_BASIC_CHECK) strextend (&command, "-basic-image-search"); 357 if (USE_ALL_IMAGES) strextend (&command, "-use-all-images"); 358 359 if (N_BOOTSTRAP_SAMPLES > 1) strextend (&command, "-bootstrap-samples %d", N_BOOTSTRAP_SAMPLES); 347 360 348 361 if (MinBadQF > 0.0) strextend (&command, "-min-bad-psfqf %f", MinBadQF); -
trunk/Ohana/src/relastro/src/UpdateObjects.c
r39617 r39926 5 5 # define PAR_MIN_NPTS 7 6 6 # define PAR_MIN_NPTS_BOOT 6 7 # define PM_MIN_NPTS 48 # define PM_MIN_NPTS_BOOT 39 # define POS_MIN_NPTS 310 # define POS_MIN_NPTS_BOOT 27 # define PM_MIN_NPTS 5 8 # define PM_MIN_NPTS_BOOT 4 9 # define POS_MIN_NPTS 4 10 # define POS_MIN_NPTS_BOOT 4 11 11 12 12 typedef enum { 13 SELECT_MEAS_HAS_DATA = 1, 14 SELECT_MEAS_HAS_STACK = 2, 15 SELECT_MEAS_HAS_2MASS = 4, 13 SELECT_MEAS_HAS_DATA = 0x01, 14 SELECT_MEAS_HAS_STACK = 0x02, 15 SELECT_MEAS_HAS_2MASS = 0x04, 16 SELECT_MEAS_HAS_GAIA = 0x08, 17 SELECT_MEAS_HAS_TYCHO = 0x10, 16 18 } SelectMeasureStatus; 17 19 … … 181 183 if (Trange < PM_DT_MIN) { 182 184 // not enough baseline for proper motion, only set mean position 183 mode = FIT_AVERAGE;184 185 goto justPosition; 185 186 } 186 187 if (parRange < PAR_FACTOR_MIN) { 187 188 // not enough parallax factor range, skip parallax 188 mode = FIT_PM_ONLY;189 189 goto skipParallax; 190 190 } 191 191 if (fitStats->Npoints < PAR_MIN_NPTS) { 192 192 // not enough data, skip parallax 193 mode = FIT_PM_ONLY;194 193 goto skipParallax; 195 194 } 196 195 197 196 // we are going to use the IRLS analysis to calculate the mean solution and the masking 198 // then run N_BOOTSTRAP_SAMPLES to measure the errors 199 fitStats->fitdataPar->getError = !N_BOOTSTRAP_SAMPLES; 200 if (!FitPMandPar_IRLS (&fitPar, fitStats->fitdataPar, fitStats->points, fitStats->Npoints)) { 201 mode = FIT_PM_ONLY; 202 goto skipParallax; 203 } 204 205 if (N_BOOTSTRAP_SAMPLES) { 197 // then run N_BOOTSTRAP_SAMPLES to measure the errors. We first measure the OLS error, 198 // and choose the max of the OLS and bootstrap errors 199 fitStats->fitdataPar->getError = TRUE; 200 if (USE_IRLS) { 201 if (!FitPMandPar_IRLS (&fitPar, fitStats->fitdataPar, fitStats->points, fitStats->Npoints)) { 202 goto skipParallax; 203 } 204 } else { 205 if (!FitPMandPar_Basic (&fitPar, fitStats->fitdataPar, fitStats->points, fitStats->Npoints)) { 206 goto skipParallax; 207 } 208 } 209 210 // in the fits above, we have saved the formal error for the unmasked points. 211 // if we do not have enough points for bootstrap, we will keep those errors 212 if (N_BOOTSTRAP_SAMPLES && (fitPar.Nfit >= PAR_MIN_NPTS_BOOT)) { 206 213 fitStats->Nfit = 0; 207 214 int Nnomask = BootstrapSaveUnmasked (fitStats->nomask, fitStats->points, fitStats->Npoints); 208 if (Nnomask < PAR_MIN_NPTS_BOOT) { 209 // if we do not have enough points to assess parallax error, we cannot dothe bootstrap analysis.210 mode = FIT_PM_ONLY; 211 goto skipParallax;212 } 215 216 // if we do not have enough points to assess parallax error, skip the bootstrap analysis. 217 // (I think the test above means we never do this skip) 218 if (Nnomask < PAR_MIN_NPTS_BOOT) goto skipParallaxBootstrap; 219 213 220 for (k = 0; k < fitStats->NfitAlloc; k++) { 214 221 BootstrapResample (fitStats->sample, fitStats->nomask, Nnomask); … … 216 223 fitStats->Nfit ++; 217 224 } 218 // these calls set the ERRORS on the fit parameters, not the fit values (set in IRLS above) 225 226 // These calls set the ERRORS on the fit parameters, not the fit values (set in IRLS above) 227 // this call expects the fitted parameters to have the formal error set: it will apply the 228 // max of the formal and bootstrap errors 219 229 BootstrapRobustStats (&fitPar, fitStats->fit, fitStats->Nfit, FIT_RESULT_RA); 220 230 BootstrapRobustStats (&fitPar, fitStats->fit, fitStats->Nfit, FIT_RESULT_DEC); … … 224 234 } 225 235 236 skipParallaxBootstrap: 226 237 // project Ro, Do back to RA,DEC 227 238 XY_to_RD (&fitPar.Ro, &fitPar.Do, fitPar.Ro, fitPar.Do, &fitStats->coords); … … 242 253 valid = valid && (fabs(fitPar.uD) < 4.0); 243 254 valid = valid && (fabs(fitPar.p) < 2.0); 244 if (!valid) { 245 mode = FIT_PM_ONLY; 246 } else { 255 if (valid) { 247 256 average[0].flags |= ID_OBJ_USE_PAR; 248 257 } … … 254 263 if ((mode == FIT_PM_ONLY) || (mode == FIT_PM_AND_PAR)) { 255 264 if (Trange < PM_DT_MIN) { 256 mode = FIT_AVERAGE;257 265 goto justPosition; 258 266 } 259 267 if (fitStats->Npoints < PM_MIN_NPTS) { 260 mode = FIT_AVERAGE;261 268 goto justPosition; 262 269 } 263 270 264 271 // if we have fitted (and accepted) a parallax model, get the best pm fit and chisq 265 // given the set of points (mask is respected) 266 if (average[0].flags & ID_OBJ_USE_PAR) { 272 // given the set of points (mask is respected). Alternatively, if we do not request 273 // IRLS fitting, the just use OLS fitting (skip bootstrap) 274 if ((average[0].flags & ID_OBJ_USE_PAR) || !USE_IRLS) { 267 275 if (!FitPM_Basic (&fitPM, fitStats->fitdataPM, fitStats->points, fitStats->Npoints)) { 268 276 average[0].flags |= ID_OBJ_BAD_PM; 269 277 goto justPosition; 270 278 } 271 } else { 272 fitStats->fitdataPM->getError = !N_BOOTSTRAP_SAMPLES; 273 if (!FitPM_IRLS (&fitPM, fitStats->fitdataPM, fitStats->points, fitStats->Npoints)) { 274 mode = FIT_AVERAGE; 275 goto justPosition; 276 } 277 if (N_BOOTSTRAP_SAMPLES) { 278 fitStats->Nfit = 0; 279 int Nnomask = BootstrapSaveUnmasked (fitStats->nomask, fitStats->points, fitStats->Npoints); 280 if (Nnomask < PM_MIN_NPTS_BOOT) { 281 mode = FIT_AVERAGE; 282 goto justPosition; 283 } 284 for (k = 0; k < fitStats->NfitAlloc; k++) { 285 BootstrapResample (fitStats->sample, fitStats->nomask, Nnomask); 286 if (!FitPM_Basic (&fitStats->fit[k], fitStats->fitdataPM, fitStats->sample, Nnomask)) continue; 287 fitStats->Nfit ++; 288 } 289 BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_RA); 290 BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_DEC); 291 BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_uR); 292 BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_uD); 293 } 294 } 295 279 goto skipProperMotionBootstrap; 280 } 281 282 // we are going to use the IRLS analysis to calculate the mean solution and the masking 283 // then run N_BOOTSTRAP_SAMPLES to measure the errors. We first measure the OLS error, 284 // and choose the max of the OLS and bootstrap errors 285 fitStats->fitdataPM->getError = TRUE; 286 if (!FitPM_IRLS (&fitPM, fitStats->fitdataPM, fitStats->points, fitStats->Npoints)) { 287 goto justPosition; 288 } 289 290 // in the fits above, we have saved the formal error for the unmasked points. 291 // if we do not have enough points for bootstrap, we will keep those errors 292 if (N_BOOTSTRAP_SAMPLES && (fitPM.Nfit >= PM_MIN_NPTS_BOOT)) { 293 fitStats->Nfit = 0; 294 int Nnomask = BootstrapSaveUnmasked (fitStats->nomask, fitStats->points, fitStats->Npoints); 295 296 // if we do not have enough points to assess p.m. error, skip the bootstrap analysis. 297 // (I think the test above means we never do this skip) 298 if (Nnomask < PM_MIN_NPTS_BOOT) goto skipProperMotionBootstrap; 299 300 for (k = 0; k < fitStats->NfitAlloc; k++) { 301 BootstrapResample (fitStats->sample, fitStats->nomask, Nnomask); 302 if (!FitPM_Basic (&fitStats->fit[k], fitStats->fitdataPM, fitStats->sample, Nnomask)) continue; 303 fitStats->Nfit ++; 304 } 305 306 // These calls set the ERRORS on the fit parameters, not the fit values (set in IRLS above) 307 // this call expects the fitted parameters to have the formal error set: it will apply the 308 // max of the formal and bootstrap errors 309 BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_RA); 310 BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_DEC); 311 BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_uR); 312 BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_uD); 313 } 314 315 skipProperMotionBootstrap: 296 316 // project Ro, Do back to RA,DEC 297 317 XY_to_RD (&fitPM.Ro, &fitPM.Do, fitPM.Ro, fitPM.Do, &fitStats->coords); … … 300 320 fitStats->Npm ++; 301 321 322 // XXX a hard-wired hack... 302 323 // unless there is a clear problems (below) with the proper-motion fit or we have a parallax fit, we will use pm fit 303 324 int valid = TRUE; … … 309 330 valid = valid && (fabs(fitPM.uD) < 4.0); 310 331 if (!valid) { 311 mode = FIT_AVERAGE;312 332 average[0].flags |= ID_OBJ_BAD_PM; 313 333 } else { … … 323 343 // if we only have one point, this is silly... 324 344 345 // set the proper motion (to the galaxy model or average value, if desired; else to 0,0) 325 346 FitAstromResultSetPM (&fitPos, 1, average); 326 // fprintf (stderr, "fit 1: %f %f : %f %f\n", fitPos.Ro, fitPos.Do, fitPos.uR, fitPos.uD); 327 if (average[0].flags & (ID_OBJ_USE_PAR | ID_OBJ_USE_PM)) { 347 348 // if we already have a valid fit (pm or par), use OLS to fit the position 349 // alternatively, if we do not request IRLS, use OLS 350 // alternatively, if we do not have enough points, use OLS 351 if ((average[0].flags & (ID_OBJ_USE_PAR | ID_OBJ_USE_PM)) || (fitStats->Npoints < POS_MIN_NPTS) || !USE_IRLS) { 328 352 if (!FitPosPMfixed_Basic (&fitPos, fitStats->fitdataPos, fitStats->points, fitStats->Npoints)) { 329 // if this fails, stick with the PM and/or PAR fit from above 353 // if this fails, stick with the PM and/or PAR fit from above, or use a single value 330 354 goto doneWithFit; 331 355 } 332 } else { 333 if (fitStats->Npoints < POS_MIN_NPTS) { 334 // I will not try to outlier-reject, just calculate the weighted average 335 if (!FitPosPMfixed_Basic (&fitPos, fitStats->fitdataPos, fitStats->points, fitStats->Npoints)) { 336 // if we have tried this, we have not masked any points; we will find a single unmasked point below 337 goto doneWithFit; 338 } 356 // if we have not already gotten a good fit, use this fit 357 if (!(average[0].flags & (ID_OBJ_USE_PAR | ID_OBJ_USE_PM))) { 339 358 average[0].flags |= ID_OBJ_USE_AVE; 340 359 average[0].flags |= ID_OBJ_RAW_AVE; 341 goto useBasic; 342 } 343 if (!FitPosPMfixed_IRLS (&fitPos, fitStats->fitdataPos, fitStats->points, fitStats->Npoints)) { 344 // if the above fails, we need to clear the masks and try again below 345 FitPointsClearMasks (fitStats->points, fitStats->Npoints); 346 // just calculate the weighted average 347 if (!FitPosPMfixed_Basic (&fitPos, fitStats->fitdataPos, fitStats->points, fitStats->Npoints)) { 348 // if this fails, find a single unmasked point below 349 goto doneWithFit; 350 } 351 average[0].flags |= ID_OBJ_USE_AVE; 352 average[0].flags |= ID_OBJ_RAW_AVE; 353 goto useBasic; 354 } 355 // fprintf (stderr, "fit 2: %f %f : %f %f\n", fitPos.Ro, fitPos.Do, fitPos.uR, fitPos.uD); 356 if (N_BOOTSTRAP_SAMPLES) { 357 fitStats->Nfit = 0; 358 int Nnomask = BootstrapSaveUnmasked (fitStats->nomask, fitStats->points, fitStats->Npoints); 359 if (Nnomask < POS_MIN_NPTS_BOOT) { 360 // if the above fails, we need to clear the masks and try again below 361 FitPointsClearMasks (fitStats->points, fitStats->Npoints); 362 if (!FitPosPMfixed_Basic (&fitPos, fitStats->fitdataPos, fitStats->points, fitStats->Npoints)) { 363 // if this fails, find a single unmasked point below 364 goto doneWithFit; 365 } 366 average[0].flags |= ID_OBJ_USE_AVE; 367 average[0].flags |= ID_OBJ_RAW_AVE; 368 goto useBasic; 369 } 370 FitAstromResultSetPM (fitStats->fit, fitStats->NfitAlloc, average); 371 for (k = 0; k < fitStats->NfitAlloc; k++) { 372 BootstrapResample (fitStats->sample, fitStats->nomask, Nnomask); 373 if (!FitPosPMfixed_Basic (&fitStats->fit[k], fitStats->fitdataPos, fitStats->sample, Nnomask)) continue; 374 fitStats->Nfit ++; 375 } 376 BootstrapRobustStats (&fitPos, fitStats->fit, fitStats->Nfit, FIT_RESULT_RA); 377 BootstrapRobustStats (&fitPos, fitStats->fit, fitStats->Nfit, FIT_RESULT_DEC); 360 } 361 goto useBasic; 362 } 363 364 // try the IRLS fitting, otherwise give up and use OLS 365 if (!FitPosPMfixed_IRLS (&fitPos, fitStats->fitdataPos, fitStats->points, fitStats->Npoints)) { 366 // if the above fails, we need to clear the masks and try again below 367 FitPointsClearMasks (fitStats->points, fitStats->Npoints); 368 // just calculate the weighted average 369 if (!FitPosPMfixed_Basic (&fitPos, fitStats->fitdataPos, fitStats->points, fitStats->Npoints)) { 370 // if this fails, find a single unmasked point below 371 goto doneWithFit; 378 372 } 379 373 average[0].flags |= ID_OBJ_USE_AVE; 374 average[0].flags |= ID_OBJ_RAW_AVE; 375 goto useBasic; 376 } 377 average[0].flags |= ID_OBJ_USE_AVE; 378 379 if (N_BOOTSTRAP_SAMPLES && (fitPos.Nfit >= POS_MIN_NPTS_BOOT)) { 380 fitStats->Nfit = 0; 381 int Nnomask = BootstrapSaveUnmasked (fitStats->nomask, fitStats->points, fitStats->Npoints); 382 383 if (Nnomask < POS_MIN_NPTS_BOOT) goto useBasic; 384 385 FitAstromResultSetPM (fitStats->fit, fitStats->NfitAlloc, average); 386 for (k = 0; k < fitStats->NfitAlloc; k++) { 387 BootstrapResample (fitStats->sample, fitStats->nomask, Nnomask); 388 if (!FitPosPMfixed_Basic (&fitStats->fit[k], fitStats->fitdataPos, fitStats->sample, Nnomask)) continue; 389 fitStats->Nfit ++; 390 } 391 392 // These calls set the ERRORS on the fit parameters, not the fit values (set in IRLS above) 393 // this call expects the fitted parameters to have the formal error set: it will apply the 394 // max of the formal and bootstrap errors 395 BootstrapRobustStats (&fitPos, fitStats->fit, fitStats->Nfit, FIT_RESULT_RA); 396 BootstrapRobustStats (&fitPos, fitStats->fit, fitStats->Nfit, FIT_RESULT_DEC); 380 397 } 381 398 … … 544 561 average[0].dP = fit.dp; // parallax error in arcsec 545 562 563 546 564 average[0].ChiSqAve = fitPos.chisq; 547 565 average[0].ChiSqPM = fitPM.chisq; … … 666 684 667 685 int has2MASS = FALSE; 686 int hasGAIA = FALSE; 687 int hasTycho = FALSE; 668 688 int hasStack = FALSE; 669 689 if (stackEntry) *stackEntry = -1; … … 774 794 Npoints++; 775 795 776 if ((measure[k].photcode >= 2011) && (measure[k].photcode <= 2013)) {777 has2MASS = TRUE;778 }796 hasGAIA = (measure[k].photcode == 1030); 797 has2MASS = ((measure[k].photcode >= 2011) && (measure[k].photcode <= 2013)); 798 hasTycho = ((measure[k].photcode >= 2020) && (measure[k].photcode <= 2021)); 779 799 780 800 myAssert (Npoints <= fit->NpointsAlloc, "oops"); … … 796 816 measure[k].dbFlags &= ~ID_MEAS_OBJECT_HAS_2MASS; 797 817 } 818 if (hasGAIA) { 819 measure[k].dbFlags |= ID_MEAS_OBJECT_HAS_GAIA; 820 } else { 821 measure[k].dbFlags &= ~ID_MEAS_OBJECT_HAS_GAIA; 822 } 823 if (hasTycho) { 824 measure[k].dbFlags |= ID_MEAS_OBJECT_HAS_TYCHO; 825 } else { 826 measure[k].dbFlags &= ~ID_MEAS_OBJECT_HAS_TYCHO; 827 } 798 828 } 799 829 … … 803 833 if (hasStack) status |= SELECT_MEAS_HAS_STACK; 804 834 if (has2MASS) status |= SELECT_MEAS_HAS_2MASS; 835 if (hasGAIA) status |= SELECT_MEAS_HAS_GAIA; 836 if (hasTycho) status |= SELECT_MEAS_HAS_TYCHO; 805 837 return status; 806 838 } … … 822 854 823 855 int i; 856 857 myAbort ("this should not be called anymore"); 824 858 825 859 // add up the chi square for the fit … … 852 886 int i; 853 887 854 if ( USE_GALAXY_MODEL) {888 if (APPLY_PROPER_MOTION) { 855 889 for (i = 0; i < Nfit; i++) { 856 fit[i].uR = average->uRgal; 857 fit[i].uD = average->uDgal; 890 if (USE_GALAXY_MODEL) { 891 fit[i].uR = average->uRgal; 892 fit[i].uD = average->uDgal; 893 } else { 894 fit[i].uR = average->uR; 895 fit[i].uD = average->uD; 896 } 858 897 } 859 898 } else { -
trunk/Ohana/src/relastro/src/UpdateStacks.c
r39457 r39926 3 3 // NOTE: we only measure the systematic floor of the astrometric scatter per stack, no change to the calibration 4 4 int UpdateStacks (Catalog *catalog, int Ncatalog) { 5 6 if (SKIP_PS1_STACK) return TRUE; 5 7 6 8 off_t Nimage; … … 46 48 47 49 // XXX: I need to convert dLsig, dMsig from degrees to pixels 48 dLsig *= 3600.0 / 0.25;49 dMsig *= 3600.0 / 0.25;50 dLsig *= 3600.0; 51 dMsig *= 3600.0; 50 52 51 53 image[i].dXpixSys = dLsig; -
trunk/Ohana/src/relastro/src/args.c
r39693 r39926 1 1 # include "relastro.h" 2 void usage ( void);3 void usage_client ( void);2 void usage (int argc, char **argv); 3 void usage_client (int argc, char **argv); 4 4 void usage_merge_source (void); 5 5 void usage_merge_source_id (char *name); 6 6 float *ParseLoopWeights (char *rawlist); 7 int *ParseLoopOrder (char *rawlist, int minValue); 7 8 8 9 int args (int argc, char **argv) { … … 39 40 remove_argument (N, &argc, argv); 40 41 41 if (argc != 1) usage ( );42 if (argc != 1) usage (argc, argv); 42 43 return TRUE; 43 44 } … … 76 77 remove_argument (N, &argc, argv); 77 78 CHECK_MEASURE_TO_IMAGE = TRUE; 79 } 80 81 // catch-up mode : for a re-run, allow the sync file to be ahead of the desired location: 82 CATCH_UP = FALSE; 83 if ((N = get_argument (argc, argv, "-catch-up"))) { 84 remove_argument (N, &argc, argv); 85 CATCH_UP = TRUE; 78 86 } 79 87 … … 105 113 remove_argument (N, &argc, argv); 106 114 RELASTRO_OP = OP_PARALLEL_IMAGES; 107 if (N >= argc) usage ();115 if (N >= argc) usage (argc, argv); 108 116 IMAGE_TABLE = strcreate (argv[N]); 109 117 remove_argument (N, &argc, argv); 110 if (!REGION_FILE) usage ();118 if (!REGION_FILE) usage (argc, argv); 111 119 } 112 120 … … 114 122 remove_argument (N, &argc, argv); 115 123 RELASTRO_OP = OP_IMAGES; 124 } 125 126 // used to decide if changes to the image parameters get applied to the measures 127 APPLY_OFFSETS = FALSE; 128 if ((N = get_argument (argc, argv, "-apply-offsets"))) { 129 remove_argument (N, &argc, argv); 130 APPLY_OFFSETS = TRUE; 131 } 132 133 APPLY_PROPER_MOTION = FALSE; 134 if ((N = get_argument (argc, argv, "-apply-proper-motion"))) { 135 remove_argument (N, &argc, argv); 136 APPLY_PROPER_MOTION = TRUE; 137 } 138 139 SKIP_PS1_CHIP = FALSE; 140 if ((N = get_argument (argc, argv, "-skip-ps1-chip"))) { 141 remove_argument (N, &argc, argv); 142 SKIP_PS1_CHIP = TRUE; 143 } 144 SKIP_PS1_STACK = FALSE; 145 if ((N = get_argument (argc, argv, "-skip-ps1-stack"))) { 146 remove_argument (N, &argc, argv); 147 SKIP_PS1_STACK = TRUE; 148 } 149 SKIP_HSC = FALSE; 150 if ((N = get_argument (argc, argv, "-skip-hsc"))) { 151 remove_argument (N, &argc, argv); 152 SKIP_HSC = TRUE; 153 } 154 SKIP_CFH = FALSE; 155 if ((N = get_argument (argc, argv, "-skip-cfh"))) { 156 remove_argument (N, &argc, argv); 157 SKIP_CFH = TRUE; 158 } 159 160 UPDATE_PS1_STACK_MEASURE = FALSE; 161 if ((N = get_argument (argc, argv, "-update-ps1-stack"))) { 162 remove_argument (N, &argc, argv); 163 UPDATE_PS1_STACK_MEASURE = TRUE; 164 } 165 UPDATE_PS1_CHIP_MEASURE = FALSE; 166 if ((N = get_argument (argc, argv, "-update-ps1-chip"))) { 167 remove_argument (N, &argc, argv); 168 UPDATE_PS1_CHIP_MEASURE = TRUE; 169 } 170 UPDATE_HSC_MEASURE = FALSE; 171 if ((N = get_argument (argc, argv, "-update-hsc"))) { 172 remove_argument (N, &argc, argv); 173 UPDATE_HSC_MEASURE = TRUE; 174 } 175 UPDATE_CFH_MEASURE = FALSE; 176 if ((N = get_argument (argc, argv, "-update-cfh"))) { 177 remove_argument (N, &argc, argv); 178 UPDATE_CFH_MEASURE = TRUE; 179 } 180 if (RELASTRO_OP == OP_UPDATE_OFFSETS) { 181 if (!UPDATE_PS1_STACK_MEASURE && !UPDATE_PS1_CHIP_MEASURE && !UPDATE_HSC_MEASURE && !UPDATE_CFH_MEASURE) { 182 fprintf (stderr, "for -update-offsets, need to select at least one of -update-ps1-stack, -update-ps1-chip, -update-hsc, -update-cfh\n"); 183 exit (2); 184 } 185 } 186 if ((RELASTRO_OP == OP_PARALLEL_IMAGES) || (RELASTRO_OP == OP_IMAGES)) { 187 if (APPLY_OFFSETS && !UPDATE_PS1_STACK_MEASURE && !UPDATE_PS1_CHIP_MEASURE && !UPDATE_HSC_MEASURE && !UPDATE_CFH_MEASURE) { 188 fprintf (stderr, "for [-images or -parallel-images] with -apply-offsets, need to select at least one of -update-ps1-stack, -update-ps1-chip, -update-hsc, -update-cfh\n"); 189 exit (2); 190 } 191 } 192 193 // for fitting objects, this is always the same as 'ALLOW_IRLS' below, but for fitting 194 // images, this is set to FALSE while doing the fit for the image parameters 195 USE_IRLS = TRUE; 196 ALLOW_IRLS = TRUE; 197 if ((N = get_argument (argc, argv, "-no-irls"))) { 198 remove_argument (N, &argc, argv); 199 USE_IRLS = FALSE; 200 ALLOW_IRLS = FALSE; 116 201 } 117 202 … … 120 205 remove_argument (N, &argc, argv); 121 206 RELASTRO_OP = OP_PARALLEL_REGIONS; 122 if (!REGION_FILE) usage ();207 if (!REGION_FILE) usage (argc, argv); 123 208 if ((N = get_argument (argc, argv, "-parallel-regions-manual"))) { 124 209 remove_argument (N, &argc, argv); … … 128 213 129 214 if ((N = get_argument (argc, argv, "-testobj1"))) { 130 if (N > argc - 3) usage ( );215 if (N > argc - 3) usage (argc, argv); 131 216 remove_argument (N, &argc, argv); 132 217 OBJ_ID_SRC = strtol(argv[N], &endptr, 0); 133 if (*endptr) usage ( );218 if (*endptr) usage (argc, argv); 134 219 remove_argument (N, &argc, argv); 135 220 CAT_ID_SRC = strtol(argv[N], &endptr, 0); 136 if (*endptr) usage ( );221 if (*endptr) usage (argc, argv); 137 222 remove_argument (N, &argc, argv); 138 223 } 139 224 140 225 if ((N = get_argument (argc, argv, "-testobj2"))) { 141 if (N > argc - 3) usage ( );226 if (N > argc - 3) usage (argc, argv); 142 227 remove_argument (N, &argc, argv); 143 228 OBJ_ID_DST = strtol(argv[N], &endptr, 0); 144 if (*endptr) usage ( );229 if (*endptr) usage (argc, argv); 145 230 remove_argument (N, &argc, argv); 146 231 CAT_ID_DST = strtol(argv[N], &endptr, 0); 147 if (*endptr) usage ( );232 if (*endptr) usage (argc, argv); 148 233 remove_argument (N, &argc, argv); 149 234 } … … 167 252 if ((N = get_argument (argc, argv, "-high-speed"))) { 168 253 // XXX include a parallax / no-parallax option 169 if (N >= argc - 4) usage ();254 if (N >= argc - 4) usage (argc, argv); 170 255 RELASTRO_OP = OP_HIGH_SPEED; 171 256 remove_argument (N, &argc, argv); … … 181 266 182 267 if ((N = get_argument (argc, argv, "-hpm"))) { 183 if (N >= argc - 2) usage ();268 if (N >= argc - 2) usage (argc, argv); 184 269 RELASTRO_OP = OP_HPM; 185 270 remove_argument (N, &argc, argv); … … 212 297 FIT_TARGET = TARGET_MOSAICS; 213 298 } 299 if ((N = get_argument (argc, argv, "-set-chips"))) { 300 remove_argument (N, &argc, argv); 301 FIT_TARGET = SET_CHIPS; 302 } 214 303 215 304 FlagOutlier = FALSE; … … 231 320 } 232 321 233 if (RELASTRO_OP == OP_NONE) usage ();234 235 if (((RELASTRO_OP == OP_IMAGES) || (RELASTRO_OP == OP_PARALLEL_REGIONS) || (RELASTRO_OP == OP_PARALLEL_IMAGES)) && (FIT_TARGET == TARGET_NONE)) usage ();322 if (RELASTRO_OP == OP_NONE) usage (argc, argv); 323 324 if (((RELASTRO_OP == OP_IMAGES) || (RELASTRO_OP == OP_PARALLEL_REGIONS) || (RELASTRO_OP == OP_PARALLEL_IMAGES)) && (FIT_TARGET == TARGET_NONE)) usage (argc, argv); 236 325 237 326 /* specify portion of the sky : allow default of all sky? */ … … 303 392 } 304 393 394 KEEP_ALL_IMAGES_RA = FALSE; 395 if ((N = get_argument (argc, argv, "-keep-all-images-ra"))) { 396 remove_argument (N, &argc, argv); 397 KEEP_ALL_IMAGES_RA = TRUE; 398 } 399 305 400 USE_BASIC_CHECK = FALSE; 306 401 if ((N = get_argument (argc, argv, "-basic-image-search"))) { … … 315 410 remove_argument (N, &argc, argv); 316 411 MaxDensityUse = TRUE; 317 }318 319 APPLY_OFFSETS = FALSE;320 if ((N = get_argument (argc, argv, "-apply-offsets"))) {321 remove_argument (N, &argc, argv);322 APPLY_OFFSETS = TRUE;323 412 } 324 413 … … 439 528 } 440 529 441 CHIPORDER = 0;442 if ((N = get_argument (argc, argv, "-chiporder"))) {443 remove_argument (N, &argc, argv);444 CHIPORDER = atoi(argv[N]);445 remove_argument (N, &argc, argv);446 }447 448 CHIPMAP = 0;449 if ((N = get_argument (argc, argv, "-chipmap"))) {450 remove_argument (N, &argc, argv);451 CHIPMAP = atoi(argv[N]);452 remove_argument (N, &argc, argv);453 454 }455 456 530 SAVEPLOT = FALSE; 457 531 PLOTSTUFF = FALSE; … … 580 654 } 581 655 656 // e.g., -chiporderloop 3,4,5 657 // NOTE: this must come after -nloop above 658 ChipOrderLoop = NULL; 659 ChipOrderLoopStr = NULL; 660 CHIPORDER = 1; 661 if ((N = get_argument (argc, argv, "-chiporder"))) { 662 remove_argument (N, &argc, argv); 663 CHIPORDER = atoi(argv[N]); 664 remove_argument (N, &argc, argv); 665 } 666 if ((N = get_argument (argc, argv, "-chiporderloop"))) { 667 remove_argument (N, &argc, argv); 668 ChipOrderLoopStr = strcreate(argv[N]); 669 ChipOrderLoop = ParseLoopOrder (argv[N], 1); 670 remove_argument (N, &argc, argv); 671 } 672 673 ChipMapLoop = NULL; 674 ChipMapLoopStr = NULL; 675 CHIPMAP = 0; 676 if ((N = get_argument (argc, argv, "-chipmap"))) { 677 remove_argument (N, &argc, argv); 678 CHIPMAP = atoi(argv[N]); 679 remove_argument (N, &argc, argv); 680 681 } 682 if ((N = get_argument (argc, argv, "-chipmaploop"))) { 683 remove_argument (N, &argc, argv); 684 ChipMapLoopStr = strcreate(argv[N]); 685 ChipMapLoop = ParseLoopOrder (argv[N], 0); 686 remove_argument (N, &argc, argv); 687 } 688 689 582 690 // e.g., -loop-weights-2mass 1000,300,300,200,200,100 583 691 // NOTE: this must come after -nloop above … … 591 699 } 592 700 LoopWeightTycho = NULL; 701 LoopWeightTychostr = NULL; 593 702 if ((N = get_argument (argc, argv, "-loop-weights-tycho"))) { 594 703 remove_argument (N, &argc, argv); … … 597 706 remove_argument (N, &argc, argv); 598 707 } 708 LoopWeightGAIA = NULL; 709 LoopWeightGAIAstr = NULL; 710 if ((N = get_argument (argc, argv, "-loop-weights-gaia"))) { 711 remove_argument (N, &argc, argv); 712 LoopWeightGAIAstr = strcreate(argv[N]); 713 LoopWeightGAIA = ParseLoopWeights (argv[N]); 714 remove_argument (N, &argc, argv); 715 } 716 717 GALAXY_MODEL = NULL; 718 if ((N = get_argument (argc, argv, "-galaxy-model"))) { 719 remove_argument (N, &argc, argv); 720 GALAXY_MODEL = strcreate(argv[N]); 721 remove_argument (N, &argc, argv); 722 } 723 if (!GALAXY_MODEL) GALAXY_MODEL = strcreate ("FEAST-HIPPARCOS"); 724 725 // for testing, allow the galaxy model scale to be non-unity 726 TEST_SCALE = 1.0; 727 if ((N = get_argument (argc, argv, "-testing"))) { 728 remove_argument (N, &argc, argv); 729 TEST_SCALE = atof(argv[N]); 730 remove_argument (N, &argc, argv); 731 } 599 732 600 733 NTHREADS = 0; … … 605 738 } 606 739 607 if (argc != 1) usage ( );740 if (argc != 1) usage (argc, argv); 608 741 return TRUE; 609 742 } … … 614 747 FREE (LoopWeight2MASSstr); 615 748 FREE (LoopWeightTychostr); 749 FREE (LoopWeightGAIAstr); 750 FREE (LoopWeight2MASS); 751 FREE (LoopWeightTycho); 752 FREE (LoopWeightGAIA); 753 754 FREE (ChipMapLoop); 755 FREE (ChipMapLoopStr); 756 FREE (ChipOrderLoop); 757 FREE (ChipOrderLoopStr); 616 758 617 759 FREE (PHOTCODE_SKIP_LIST); … … 628 770 FREE (BCATALOG); 629 771 FREE (HOSTDIR); 772 FREE (GALAXY_MODEL); 630 773 631 774 // these are set in initialize … … 673 816 remove_argument (N, &argc, argv); 674 817 } 675 if (!HOST_ID) usage_client ();818 if (!HOST_ID) usage_client (argc, argv); 676 819 677 820 HOSTDIR = NULL; … … 681 824 remove_argument (N, &argc, argv); 682 825 } 683 if (!HOSTDIR) usage_client ();826 if (!HOSTDIR) usage_client (argc, argv); 684 827 685 828 if ((N = get_argument (argc, argv, "-load-objects"))) { … … 726 869 } 727 870 871 SKIP_PS1_CHIP = FALSE; 872 if ((N = get_argument (argc, argv, "-skip-ps1-chip"))) { 873 remove_argument (N, &argc, argv); 874 SKIP_PS1_CHIP = TRUE; 875 } 876 SKIP_PS1_STACK = FALSE; 877 if ((N = get_argument (argc, argv, "-skip-ps1-stack"))) { 878 remove_argument (N, &argc, argv); 879 SKIP_PS1_STACK = TRUE; 880 } 881 SKIP_HSC = FALSE; 882 if ((N = get_argument (argc, argv, "-skip-hsc"))) { 883 remove_argument (N, &argc, argv); 884 SKIP_HSC = TRUE; 885 } 886 SKIP_CFH = FALSE; 887 if ((N = get_argument (argc, argv, "-skip-cfh"))) { 888 remove_argument (N, &argc, argv); 889 SKIP_CFH = TRUE; 890 } 891 892 UPDATE_PS1_STACK_MEASURE = FALSE; 893 if ((N = get_argument (argc, argv, "-update-ps1-stack"))) { 894 remove_argument (N, &argc, argv); 895 UPDATE_PS1_STACK_MEASURE = TRUE; 896 } 897 UPDATE_PS1_CHIP_MEASURE = FALSE; 898 if ((N = get_argument (argc, argv, "-update-ps1-chip"))) { 899 remove_argument (N, &argc, argv); 900 UPDATE_PS1_CHIP_MEASURE = TRUE; 901 } 902 UPDATE_HSC_MEASURE = FALSE; 903 if ((N = get_argument (argc, argv, "-update-hsc"))) { 904 remove_argument (N, &argc, argv); 905 UPDATE_HSC_MEASURE = TRUE; 906 } 907 UPDATE_CFH_MEASURE = FALSE; 908 if ((N = get_argument (argc, argv, "-update-cfh"))) { 909 remove_argument (N, &argc, argv); 910 UPDATE_CFH_MEASURE = TRUE; 911 } 912 if (RELASTRO_OP == OP_UPDATE_OFFSETS) { 913 if (!UPDATE_PS1_STACK_MEASURE && !UPDATE_PS1_CHIP_MEASURE && !UPDATE_HSC_MEASURE && !UPDATE_CFH_MEASURE) { 914 fprintf (stderr, "for -update-offsets, need to select at least one of -update-ps1-stack, -update-ps1-chip, -update-hsc, -update-cfh\n"); 915 exit (2); 916 } 917 } 918 728 919 // check for object fitting modes 729 920 if ((N = get_argument (argc, argv, "-pm"))) { … … 742 933 if ((N = get_argument (argc, argv, "-high-speed"))) { 743 934 // XXX include a parallax / no-parallax option 744 if (N >= argc - 5) usage_client ();935 if (N >= argc - 5) usage_client (argc, argv); 745 936 RELASTRO_OP = OP_HIGH_SPEED; 746 937 remove_argument (N, &argc, argv); … … 756 947 757 948 if ((N = get_argument (argc, argv, "-hpm"))) { 758 if (N >= argc - 3) usage ();949 if (N >= argc - 3) usage_client (argc, argv); 759 950 RELASTRO_OP = OP_HPM; 760 951 remove_argument (N, &argc, argv); … … 766 957 767 958 if ((N = get_argument (argc, argv, "-testobj1"))) { 768 if (N > argc - 3) usage ();959 if (N > argc - 3) usage_client (argc, argv); 769 960 remove_argument (N, &argc, argv); 770 961 OBJ_ID_SRC = strtol(argv[N], &endptr, 0); 771 if (*endptr) usage ();962 if (*endptr) usage_client (argc, argv); 772 963 remove_argument (N, &argc, argv); 773 964 CAT_ID_SRC = strtol(argv[N], &endptr, 0); 774 if (*endptr) usage ();965 if (*endptr) usage_client (argc, argv); 775 966 remove_argument (N, &argc, argv); 776 967 } 777 968 778 969 if ((N = get_argument (argc, argv, "-testobj2"))) { 779 if (N > argc - 3) usage ();970 if (N > argc - 3) usage_client (argc, argv); 780 971 remove_argument (N, &argc, argv); 781 972 OBJ_ID_DST = strtol(argv[N], &endptr, 0); 782 if (*endptr) usage ();973 if (*endptr) usage_client (argc, argv); 783 974 remove_argument (N, &argc, argv); 784 975 CAT_ID_DST = strtol(argv[N], &endptr, 0); 785 if (*endptr) usage ();976 if (*endptr) usage_client (argc, argv); 786 977 remove_argument (N, &argc, argv); 787 978 } … … 805 996 } 806 997 807 if (RELASTRO_OP == OP_NONE) usage_client(); 998 GALAXY_MODEL = NULL; 999 if ((N = get_argument (argc, argv, "-galaxy-model"))) { 1000 remove_argument (N, &argc, argv); 1001 GALAXY_MODEL = strcreate(argv[N]); 1002 remove_argument (N, &argc, argv); 1003 } 1004 if (!GALAXY_MODEL) GALAXY_MODEL = strcreate ("FEAST-HIPPARCOS"); 1005 1006 // for testing, allow the galaxy model scale to be non-unity 1007 TEST_SCALE = 1.0; 1008 if ((N = get_argument (argc, argv, "-testing"))) { 1009 remove_argument (N, &argc, argv); 1010 TEST_SCALE = atof(argv[N]); 1011 remove_argument (N, &argc, argv); 1012 } 1013 1014 if (RELASTRO_OP == OP_NONE) usage_client (argc, argv); 808 1015 809 1016 /* specify portion of the sky : allow default of all sky? */ … … 1032 1239 } 1033 1240 1034 if (argc != 1) usage_client ( );1241 if (argc != 1) usage_client (argc, argv); 1035 1242 return TRUE; 1036 1243 } … … 1049 1256 FREE(HIGH_SPEED_DIR); 1050 1257 FREE(BCATALOG); 1051 FREE (HOSTDIR); 1258 FREE(HOSTDIR); 1259 FREE(GALAXY_MODEL); 1052 1260 1053 1261 // these are set in initialize … … 1066 1274 } 1067 1275 1068 void usage ( ) {1276 void usage (int argc, char **argv) { 1069 1277 fprintf (stderr, "ERROR: USAGE: relastro -images -update-simple [options]\n"); 1070 1278 fprintf (stderr, " OR: relastro -images -update-chips [options]\n"); … … 1116 1324 fprintf (stderr, " -v\n"); 1117 1325 fprintf (stderr, " \n"); 1326 1327 fprintf (stderr, "remaining args: "); 1328 for (int i = 0; i < argc; i++) { 1329 fprintf (stderr, "%s ", argv[i]); 1330 } 1331 fprintf (stderr, "\n"); 1332 1118 1333 exit (2); 1119 1334 } 1120 1335 1121 void usage_client ( ) {1336 void usage_client (int argc, char **argv) { 1122 1337 fprintf (stderr, "ERROR: USAGE: relastro_client -load\n"); 1123 1338 fprintf (stderr, " OR: relastro_client -update-offsets\n"); … … 1150 1365 fprintf (stderr, " -v\n"); 1151 1366 fprintf (stderr, " \n"); 1367 1368 fprintf (stderr, "remaining args: "); 1369 for (int i = 0; i < argc; i++) { 1370 fprintf (stderr, "%s ", argv[i]); 1371 } 1372 fprintf (stderr, "\n"); 1373 1152 1374 exit (2); 1153 1375 } … … 1189 1411 } 1190 1412 1413 // this sets the last loops to match the last value... 1191 1414 while (Nloop < NLOOP) { 1192 1415 weights[Nloop] = weights[Nloop - 1]; 1193 1416 Nloop ++; 1194 1417 } 1418 1195 1419 return weights; 1196 1420 } 1421 1422 int *ParseLoopOrder (char *rawlist, int minValue) { 1423 1424 int *orders = NULL; 1425 ALLOCATE (orders, int, NLOOP); 1426 1427 int Nloop = 0; 1428 1429 /* parse the comma-separated list of photcodes */ 1430 char *myList = strcreate(rawlist); 1431 char *list = myList; 1432 char *entry = NULL; 1433 char *ptr = NULL; 1434 while ((Nloop < NLOOP) && ((entry = strtok_r (list, ",", &ptr)) != NULL)) { 1435 list = NULL; // pass NULL on successive strtok_r calls 1436 1437 orders[Nloop] = atoi(entry); 1438 if (orders[Nloop] < minValue) { 1439 fprintf (stderr, "order cannot be < %d: %s\n", minValue, rawlist); 1440 exit (3); 1441 } 1442 1443 Nloop ++; 1444 } 1445 free (myList); 1446 1447 if (Nloop == 0) { 1448 fprintf (stderr, "syntax error parsing orders: %s\n", rawlist); 1449 exit (3); 1450 } 1451 1452 // this sets the last loops to match the last value... 1453 while (Nloop < NLOOP) { 1454 orders[Nloop] = orders[Nloop - 1]; 1455 Nloop ++; 1456 } 1457 1458 return orders; 1459 } -
trunk/Ohana/src/relastro/src/assign_images.c
r39457 r39926 40 40 41 41 // register the image array with ImageOps.c for later getimageByID calls 42 initImages (image, NULL, Nimage );42 initImages (image, NULL, Nimage, FALSE); 43 43 44 44 if (VERBOSE) fprintf (stderr, "finding images\n"); … … 72 72 73 73 for (j = 0; j < Nimage; j++) { 74 75 // allow certain cameras to stay static 76 if (SKIP_PS1_CHIP && isGPC1chip (image[j].photcode)) continue; 77 if (SKIP_PS1_STACK && isGPC1stack(image[j].photcode)) continue; 78 if (SKIP_HSC && isHSCchip (image[j].photcode)) continue; 79 if (SKIP_CFH && isCFHchip (image[j].photcode)) continue; 74 80 75 81 /* select images by photcode, or equiv photcode, if specified */ -
trunk/Ohana/src/relastro/src/bcatalog.c
r39587 r39926 72 72 73 73 int myNskip1 = 0, myNskip2 = 0, myNskip3 = 0, myNskip4 = 0, myNskip5 = 0, myNskip6 = 0; 74 75 int NgaiaObject = 0; 74 76 75 77 /* exclude stars not in range or with too few measurements */ … … 187 189 if (isGPC1warp(catalog[0].measure[offset].photcode)) continue; 188 190 191 // allow certain cameras to stay static 192 if (SKIP_PS1_CHIP && isGPC1chip(catalog[0].measure[offset].photcode)) continue; 193 if (SKIP_PS1_STACK && isGPC1stack(catalog[0].measure[offset].photcode)) continue; 194 if (SKIP_HSC && isHSCchip(catalog[0].measure[offset].photcode)) continue; 195 if (SKIP_CFH && isCFHchip(catalog[0].measure[offset].photcode)) continue; 196 189 197 // filter objects based on user supplied criteria, including SIGMA_LIM 190 198 if (!MeasFilterTest(&catalog[0].measure[offset], TRUE)) { … … 250 258 } 251 259 260 if (catalog[0].measure[offset].photcode == 1030) { NgaiaObject ++; } 261 252 262 CopyMeasureToTiny (&subcatalog[0].measureT[Nmeasure], &catalog[0].measure[offset]); 253 263 // subcatalog[0].measure[Nmeasure] = catalog[0].measure[offset]; … … 281 291 } 282 292 } 283 fprintf (stderr, "skips: %d %d %d %d %d %d \n", myNskip1, myNskip2, myNskip3, myNskip4, myNskip5, myNskip6);293 fprintf (stderr, "skips: %d %d %d %d %d %d, Ngaia: %d\n", myNskip1, myNskip2, myNskip3, myNskip4, myNskip5, myNskip6, NgaiaObject); 284 294 REALLOCATE (subcatalog[0].average, Average, MAX (Naverage, 1)); 285 295 REALLOCATE (subcatalog[0].measureT, MeasureTiny, MAX (Nmeasure, 1)); -
trunk/Ohana/src/relastro/src/extra.c
r37261 r39926 39 39 return FALSE; 40 40 } 41 42 // for now (20160925) I need to identify HSC chips explicitly. generalize in the future 43 int isHSCchip (int photcode) { 44 45 if ((photcode >= 20000) && (photcode <= 20111)) return TRUE; // g-band 46 if ((photcode >= 21000) && (photcode <= 21111)) return TRUE; // r-band 47 if ((photcode >= 22000) && (photcode <= 22111)) return TRUE; // i-band 48 if ((photcode >= 23000) && (photcode <= 23111)) return TRUE; // z-band 49 if ((photcode >= 24000) && (photcode <= 24111)) return TRUE; // y-band 50 51 return FALSE; 52 } 53 54 // for now (20160925) I need to identify CFH chips explicitly. generalize in the future 55 int isCFHchip (int photcode) { 56 57 if ((photcode >= 100) && (photcode <= 152)) return TRUE; // g-band 58 if ((photcode >= 200) && (photcode <= 252)) return TRUE; // r-band 59 if ((photcode >= 300) && (photcode <= 352)) return TRUE; // i-band 60 if ((photcode >= 400) && (photcode <= 452)) return TRUE; // z-band 61 if ((photcode >= 500) && (photcode <= 552)) return TRUE; // y-band 62 63 return FALSE; 64 } -
trunk/Ohana/src/relastro/src/initialize.c
r39457 r39926 11 11 ConfigInit (&argc, argv); 12 12 args (argc, argv); 13 14 if (USE_GALAXY_MODEL) { 15 if (!InitGalaxyModel (GALAXY_MODEL)) { 16 fprintf (stderr, "failed to init galaxy model %s\n", GALAXY_MODEL); 17 exit (2); 18 } 19 } 13 20 14 21 if (RELASTRO_OP == OP_MERGE_SOURCE) return; -
trunk/Ohana/src/relastro/src/launch_region_hosts.c
r39457 r39926 81 81 strextend (&command, "-region-hosts %s", REGION_FILE); 82 82 strextend (&command, "-region-hostID %d", host->hostID); 83 83 84 strextend (&command, "-D CATDIR %s", CATDIR); 84 85 strextend (&command, "-region %f %f %f %f", host->RminCat, host->RmaxCat, host->DminCat, host->DmaxCat); 85 86 strextend (&command, "-statmode %s", STATMODE); 86 87 strextend (&command, "-minerror %f", MIN_ERROR); 87 strextend (&command, "-nloop %d", NLOOP); 88 strextend (&command, "-threads %d", NTHREADS); 88 89 strextend (&command, "-D RELASTRO_SIGMA_LIM %f", SIGMA_LIM); 90 strextend (&command, "-D RELASTRO_SRC_MEAS_TOOFEW %d", SRC_MEAS_TOOFEW); 91 92 strextend (&command, " -D RELASTRO_MIN_DISTANCE_MOD %f", MIN_DISTANCE_MOD); 93 strextend (&command, " -D RELASTRO_MAX_DISTANCE_MOD %f", MAX_DISTANCE_MOD); 94 strextend (&command, " -D RELASTRO_MAX_DISTANCE_MOD_ERR %f", MAX_DISTANCE_MOD_ERR); 95 96 strextend (&command, "-D USE_GALAXY_MODEL %d", USE_GALAXY_MODEL); 97 strextend (&command, "-D USE_ICRF_CORRECT %d", USE_ICRF_CORRECT); 98 99 strextend (&command, "-D RELASTRO_DPOS_MAX %f", DPOS_MAX); 100 strextend (&command, "-D ADDSTAR_RADIUS %f", ADDSTAR_RADIUS); 101 102 strextend (&command, "-D USE_ICRF_LOCAL %d", USE_ICRF_LOCAL); 103 strextend (&command, "-D USE_ICRF_SHFIT %d", USE_ICRF_SHFIT); 104 strextend (&command, "-D USE_ICRF_POLE %d", USE_ICRF_POLE); 89 105 90 106 switch (FIT_TARGET) { … … 98 114 strextend (&command, "-update-mosaics"); 99 115 break; 116 case SET_CHIPS: 117 strextend (&command, "-set-chips"); 118 break; 100 119 case TARGET_NONE: 101 120 abort(); … … 105 124 if (VERBOSE2) strextend (&command, "-vv"); 106 125 if (RESET) strextend (&command, "-reset"); 126 127 if (ImagSelect) strextend (&command, "-instmag %f %f", ImagMin, ImagMax); 128 if (MaxDensityUse) strextend (&command, "-max-density %f", MaxDensityValue); 129 if (FlagOutlier) strextend (&command, "-clip %d", CLIP_THRESH); 130 if (ExcludeBogus) strextend (&command, "-exclude-bogus %f", ExcludeBogusRadius); 131 132 if (USE_FIXED_PIXCOORDS) strextend (&command, "-D USE_FIXED_PIXCOORDS 1"); 133 if (PHOTCODE_KEEP_LIST) strextend (&command, "+photcode %s", PHOTCODE_KEEP_LIST); 134 if (PHOTCODE_SKIP_LIST) strextend (&command, "-photcode %s", PHOTCODE_SKIP_LIST); 135 if (PhotFlagSelect) strextend (&command, "+photflags"); 136 if (PhotFlagBad) strextend (&command, "+photflagbad %d", PhotFlagBad); 137 if (PhotFlagPoor) strextend (&command, "+photflagpoor %d", PhotFlagPoor); 138 139 if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) { 140 strextend (&command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); 141 } 142 if (DCR_RED_COLOR_POS && DCR_RED_COLOR_NEG) { 143 strextend (&command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG); 144 } 145 146 if (TEST_SCALE != 1.0) strextend (&command, "-testing %f", TEST_SCALE); 147 148 if (SKIP_PS1_CHIP) strextend (&command, "-skip-ps1-chip"); 149 if (SKIP_PS1_STACK) strextend (&command, "-skip-ps1-stack"); 150 if (SKIP_HSC) strextend (&command, "-skip-hsc"); 151 if (SKIP_CFH) strextend (&command, "-skip-cfh"); 152 153 strextend (&command, "-nloop %d", NLOOP); 154 strextend (&command, "-threads %d", NTHREADS); 155 156 if (PHOTCODE_RESET_LIST) strextend (&command, "-reset-to-photcode %s", PHOTCODE_RESET_LIST); 157 107 158 if (UPDATE) strextend (&command, "-update"); 108 159 if (PARALLEL) strextend (&command, "-parallel"); 109 160 if (PARALLEL_MANUAL) strextend (&command, "-parallel-manual"); 110 161 if (PARALLEL_SERIAL) strextend (&command, "-parallel-serial"); 111 if (PHOTCODE_KEEP_LIST) strextend (&command, "+photcode %s", PHOTCODE_KEEP_LIST); 112 if (PHOTCODE_SKIP_LIST) strextend (&command, "-photcode %s", PHOTCODE_SKIP_LIST); 113 if (PHOTCODE_RESET_LIST) strextend (&command, "-reset-to-photcode %s", PHOTCODE_RESET_LIST); 114 115 if (MaxDensityUse) strextend (&command, "-max-density %f", MaxDensityValue); 116 if (ImagSelect) strextend (&command, "-instmag %f %f", ImagMin, ImagMax); 117 if (ExcludeBogus) strextend (&command, "-exclude-bogus %f", ExcludeBogusRadius); 118 119 if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) { 120 strextend (&command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); 121 } 122 if (DCR_RED_COLOR_POS && DCR_RED_COLOR_NEG) { 123 strextend (&command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG); 124 } 125 126 if (PhotFlagSelect) strextend (&command, "+photflags"); 127 if (PhotFlagBad) strextend (&command, "+photflagbad %d", PhotFlagBad); 128 if (PhotFlagPoor) strextend (&command, "+photflagpoor %d", PhotFlagPoor); 129 162 163 strextend (&command, "-chiporder %d", CHIPORDER); 130 164 if (CHIPMAP) strextend (&command, "-chipmap %d", CHIPMAP); 165 if (ChipMapLoop) strextend (&command, "-chipmaploop %s", ChipMapLoopStr); 166 if (ChipOrderLoop) strextend (&command, "-chiporderloop %s", ChipOrderLoopStr); 167 131 168 if (RESET_IMAGES) strextend (&command, "-reset-images"); 132 169 … … 136 173 if (LoopWeight2MASS) { strextend (&command, "-loop-weights-2mass %s", LoopWeight2MASSstr); } 137 174 if (LoopWeightTycho) { strextend (&command, "-loop-weights-tycho %s", LoopWeightTychostr); } 138 139 strextend (&command, "-D RELASTRO_SRC_MEAS_TOOFEW %d", SRC_MEAS_TOOFEW); 140 strextend (&command, "-D RELASTRO_SIGMA_LIM %f", SIGMA_LIM); 141 strextend (&command, "-D RELASTRO_DPOS_MAX %f", DPOS_MAX); 142 strextend (&command, "-D ADDSTAR_RADIUS %f", ADDSTAR_RADIUS); 143 144 strextend (&command, "-D USE_GALAXY_MODEL %d", USE_GALAXY_MODEL); 145 146 strextend (&command, "-D USE_ICRF_CORRECT %d", USE_ICRF_CORRECT); 147 strextend (&command, "-D USE_ICRF_LOCAL %d", USE_ICRF_LOCAL); 148 strextend (&command, "-D USE_ICRF_SHFIT %d", USE_ICRF_SHFIT); 149 strextend (&command, "-D USE_ICRF_POLE %d", USE_ICRF_POLE); 150 151 if (USE_FIXED_PIXCOORDS) strextend (&command, "-D USE_FIXED_PIXCOORDS 1"); 175 if (LoopWeightGAIA) { strextend (&command, "-loop-weights-gaia %s", LoopWeightGAIAstr); } 176 if (APPLY_PROPER_MOTION) strextend (&command, "-apply-proper-motion"); 152 177 153 178 if (TimeSelect) { -
trunk/Ohana/src/relastro/src/load_catalogs.c
r39466 r39926 178 178 strextend (&command, "relastro_client -load-objects %s", table->hosts[i].results); 179 179 strextend (&command, " -hostID %d", table->hosts[i].hostID); 180 strextend (&command, " -hostdir %s", table->hosts[i].pathname); 181 180 182 strextend (&command, " -D CATDIR %s", CATDIR); 181 strextend (&command, " -hostdir %s", table->hosts[i].pathname);182 183 strextend (&command, " -region %f %f %f %f", UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax); 183 184 strextend (&command, " -statmode %s", STATMODE); 184 185 strextend (&command, " -minerror %f", MIN_ERROR); 186 185 187 strextend (&command, " -D RELASTRO_SIGMA_LIM %f", SIGMA_LIM); 188 strextend (&command, " -D RELASTRO_SRC_MEAS_TOOFEW %d", SRC_MEAS_TOOFEW); 189 186 190 strextend (&command, " -D RELASTRO_MIN_DISTANCE_MOD %f", MIN_DISTANCE_MOD); 187 191 strextend (&command, " -D RELASTRO_MAX_DISTANCE_MOD %f", MAX_DISTANCE_MOD); 188 192 strextend (&command, " -D RELASTRO_MAX_DISTANCE_MOD_ERR %f", MAX_DISTANCE_MOD_ERR); 189 193 194 strextend (&command, "-D USE_GALAXY_MODEL %d", USE_GALAXY_MODEL); 195 strextend (&command, "-D USE_ICRF_CORRECT %d", USE_ICRF_CORRECT); 196 190 197 if (FIT_MODE == FIT_PM_ONLY) strextend (&command, "-pm"); 191 198 if (FIT_MODE == FIT_PAR_ONLY) strextend (&command, "-par"); 192 199 if (FIT_MODE == FIT_PM_AND_PAR) strextend (&command, "-pmpar"); 193 200 194 if (VERBOSE) strextend (&command, "-v"); 195 if (VERBOSE2) strextend (&command, "-vv"); 196 if (RESET) strextend (&command, "-reset"); 197 if (ImagSelect) strextend (&command, "-instmag %f %f", ImagMin, ImagMax); 198 if (MaxDensityUse) strextend (&command, "-max-density %f", MaxDensityValue); 199 if (FlagOutlier) strextend (&command, "-clip %d", CLIP_THRESH); 200 if (ExcludeBogus) strextend (&command, "-exclude-bogus %f", ExcludeBogusRadius); 201 202 if (USE_ICRF_CORRECT) strextend (&command, "-D USE_ICRF_CORRECT %d", USE_ICRF_CORRECT); 203 if (USE_GALAXY_MODEL) strextend (&command, "-D USE_GALAXY_MODEL %d", USE_GALAXY_MODEL); 204 205 if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) { 206 strextend (&command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); 207 } 208 if (DCR_RED_COLOR_POS && DCR_RED_COLOR_NEG) { 209 strextend (&command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG); 210 } 211 212 if (USE_ALL_IMAGES) strextend (&command, "-use-all-images"); 201 if (VERBOSE) strextend (&command, "-v"); 202 if (VERBOSE2) strextend (&command, "-vv"); 203 if (RESET) strextend (&command, "-reset"); 204 205 if (ImagSelect) strextend (&command, "-instmag %f %f", ImagMin, ImagMax); 206 if (MaxDensityUse) strextend (&command, "-max-density %f", MaxDensityValue); 207 if (FlagOutlier) strextend (&command, "-clip %d", CLIP_THRESH); 208 if (ExcludeBogus) strextend (&command, "-exclude-bogus %f", ExcludeBogusRadius); 209 213 210 if (USE_FIXED_PIXCOORDS) strextend (&command, "-D USE_FIXED_PIXCOORDS 1"); 214 211 if (PHOTCODE_KEEP_LIST) strextend (&command, "+photcode %s", PHOTCODE_KEEP_LIST); … … 217 214 if (PhotFlagBad) strextend (&command, "+photflagbad %d", PhotFlagBad); 218 215 if (PhotFlagPoor) strextend (&command, "+photflagpoor %d", PhotFlagPoor); 216 217 if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) { 218 strextend (&command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); 219 } 220 if (DCR_RED_COLOR_POS && DCR_RED_COLOR_NEG) { 221 strextend (&command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG); 222 } 223 224 if (SKIP_PS1_CHIP) strextend (&command, "-skip-ps1-chip"); 225 if (SKIP_PS1_STACK) strextend (&command, "-skip-ps1-stack"); 226 if (SKIP_HSC) strextend (&command, "-skip-hsc"); 227 if (SKIP_CFH) strextend (&command, "-skip-cfh"); 228 229 if (USE_ALL_IMAGES) strextend (&command, "-use-all-images"); 230 219 231 // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values 220 232 … … 282 294 CatalogSplitter *catalogs = BrightCatalogSplitInit (Nsecfilt); 283 295 296 ohana_memstats (TRUE); 297 284 298 for (i = 0; i < table->Nhosts; i++) { 285 299 … … 296 310 free (bcatalog->secfilt); 297 311 free (bcatalog); 312 313 ohana_memstats (TRUE); 298 314 } 299 315 … … 320 336 321 337 BrightCatalogSplitFree (catalogs); 338 ohana_memstats (TRUE); 322 339 323 340 return (catalog); -
trunk/Ohana/src/relastro/src/load_images.c
r39474 r39926 66 66 } 67 67 68 initImages (subset, LineNumber, Nsubset );68 initImages (subset, LineNumber, Nsubset, !USE_ALL_IMAGES); 69 69 MARKTIME(" init images: %f sec\n", dtime); 70 70 -
trunk/Ohana/src/relastro/src/relastro_images.c
r39580 r39926 16 16 int finalPassMode = FIT_MODE; // start with the globally-defined fit mode 17 17 FIT_MODE = FIT_AVERAGE; 18 19 int RESET_ON_UPDATE = RESET; 20 RESET = TRUE; // we need to reset when we load the bright catalog subset 18 21 19 22 /* lock and load the image db table */ … … 65 68 // XXX NOTE : for 2mass reset, photcodesKeep should now limit to 2MASS measurements 66 69 70 USE_IRLS = FALSE; // do not use IRLS yet -- leads to excessive outlier rejections in the loops 71 67 72 /* major modes */ 68 73 switch (FIT_TARGET) { … … 90 95 break; 91 96 97 case SET_CHIPS: 98 // we just want to fit the selected chips to the mean positions 99 UpdateChips (catalog, Ncatalog, 0); // measure.X,Y -> R,D, fit image.coords 100 MARKTIME("update chips: %f sec\n", dtime); 101 102 break; 103 92 104 case TARGET_MOSAICS: 93 105 for (i = 0; i < NLOOP; i++) { … … 102 114 } 103 115 104 if (!UPDATE) {105 freeStarMaps();106 gfits_db_free (&db);107 ohana_memcheck (VERBOSE);108 ohana_memdump (VERBOSE);109 exit (0);110 }111 112 116 // free the image / measurement pointers 113 117 freeImageBins (Ncatalog); … … 117 121 free (catalog); 118 122 freeMosaics (); 123 124 if (!UPDATE) { 125 freeStarMaps(); 126 dvo_image_unlock (&db); 127 freeImages (db.ftable.buffer); 128 gfits_db_free (&db); 129 return TRUE; 130 } 119 131 120 132 // If we did NOT use all images, then we applied the measured corrections to a subset of … … 154 166 // iterate over catalogs to make detection coordinates consistant 155 167 if (APPLY_OFFSETS) { 168 USE_IRLS = ALLOW_IRLS; // now that we have fitted the images, choose the user's option 169 RESET = RESET_ON_UPDATE; 156 170 UpdateObjectOffsets (skylist, 0, NULL); 157 171 } -
trunk/Ohana/src/relastro/src/relastro_objects.c
r39457 r39926 159 159 strextend (&command, "relastro_client -update-objects"); 160 160 strextend (&command, "-hostID %d", table->hosts[i].hostID); 161 strextend (&command, "-hostdir %s", table->hosts[i].pathname); 162 161 163 strextend (&command, "-D CATDIR %s", CATDIR); 162 strextend (&command, "-hostdir %s", table->hosts[i].pathname);163 164 strextend (&command, "-region %f %f %f %f", UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax); 164 165 strextend (&command, "-statmode %s", STATMODE); 166 strextend (&command, "-minerror %f", MIN_ERROR); 167 168 strextend (&command, "-D RELASTRO_SIGMA_LIM %f", SIGMA_LIM); 169 strextend (&command, "-D RELASTRO_SRC_MEAS_TOOFEW %d", SRC_MEAS_TOOFEW); 165 170 166 171 if (FIT_MODE == FIT_PM_ONLY) { strextend (&command, "-pm"); } … … 171 176 if (VERBOSE2) { strextend (&command, "-vv"); } 172 177 if (RESET) { strextend (&command, "-reset"); } 173 if (UPDATE) { strextend (&command, "-update"); } 178 174 179 if (ImagSelect) { strextend (&command, "-instmag %f %f", ImagMin, ImagMax); } 175 180 if (MaxDensityUse) { strextend (&command, "-max-density %f", MaxDensityValue); } 176 181 if (FlagOutlier) { strextend (&command, "-clip %d", CLIP_THRESH); } 177 178 if (USE_ALL_IMAGES) { strextend (&command, "-use-all-images"); } 182 if (ExcludeBogus) strextend (&command, "-exclude-bogus %f", ExcludeBogusRadius); 183 179 184 if (USE_FIXED_PIXCOORDS) { strextend (&command, "-D USE_FIXED_PIXCOORDS 1"); } 180 185 if (PHOTCODE_KEEP_LIST) { strextend (&command, "+photcode %s", PHOTCODE_KEEP_LIST); } … … 185 190 // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values 186 191 192 if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) { 193 strextend (&command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); 194 } 195 if (DCR_RED_COLOR_POS && DCR_RED_COLOR_NEG) { 196 strextend (&command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG); 197 } 198 199 if (UPDATE) { strextend (&command, "-update"); } 200 if (USE_ALL_IMAGES) { strextend (&command, "-use-all-images"); } 201 187 202 if (MinBadQF > 0.0) strextend (&command, "-min-bad-psfqf %f", MinBadQF); 188 203 if (MaxMeanOffset != 10.0) strextend (&command, "-max-mean-offset %f", MaxMeanOffset); -
trunk/Ohana/src/relastro/src/relastro_parallel_images.c
r39580 r39926 61 61 initMosaics (image, Nimage); 62 62 63 initImages (image, NULL, Nimage );63 initImages (image, NULL, Nimage, FALSE); 64 64 65 65 SkyTable *sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); … … 103 103 104 104 client_logger_message ("starting the loops: %s\n", myHostName); 105 106 RESET = TRUE; // we need to reset when we load the bright catalog subset 107 FIT_MODE = FIT_AVERAGE; // we need to only fit the average 108 USE_IRLS = FALSE; // do not use IRLS yet -- leads to excessive outlier rejections in the loops 105 109 106 110 /* major modes */ -
trunk/Ohana/src/relastro/src/select_images.c
r39474 r39926 121 121 } 122 122 123 // allow certain cameras to stay static 124 if (SKIP_PS1_CHIP && isGPC1chip (timage[i].photcode)) continue; 125 if (SKIP_PS1_STACK && isGPC1stack(timage[i].photcode)) continue; 126 if (SKIP_HSC && isHSCchip (timage[i].photcode)) continue; 127 if (SKIP_CFH && isCFHchip (timage[i].photcode)) continue; 128 123 129 /* select images by photcode, or equiv photcode, if specified */ 124 130 if (NphotcodesKeep > 0) { … … 187 193 if (DmaxImage < DminSkyRegion) continue; 188 194 195 if (KEEP_ALL_IMAGES_RA) goto found_it; 196 189 197 // the sky region RA is defined to be 0 - 360.0 190 198 if (RminImage > RmaxSkyRegion) continue; -
trunk/Ohana/src/relastro/src/syncfile.c
r36871 r39926 39 39 int loop; 40 40 sscanf (message, "%*s %d", &loop); 41 if (CATCH_UP && (nloop < loop)) return TRUE; // if I am behind this machine, I need to catch up! 41 42 if (loop != nloop) { 42 43 usleep (2000000);
Note:
See TracChangeset
for help on using the changeset viewer.
