/* FILE: check.c * PURPOSE: Get WFPC2 synthetic zeropoints from Table 9 of * Holtzman et al. 1995 (PASP, 107, 1065-1093) * AUTHOR: Kenneth J. Mighell (mighell@noao.edu) * LANGUAGE: ANSI C * DATE: 2001JUN06 * COPYRIGHT: (C) 2001 Assoc. of Universities for Research in Astronomy Inc. */ #include "mx.h" #include "wfpc2color.h" #define NFILTERS (25) #define NEQUATIONS (35) int wfpc2color2_Check_Transform_i1 ( wfpc2color2_ParS *ParS ){ char mxfunc[] = "wfpc2color2_Check_Transform_i1"; int status=-1; /* * Data from Tables 9 and 10 of Holtzman et al. 1995 (PASP, 107, 1065-1093) */ struct { char imag[7]; double zsyn; int sindex; } table1[NFILTERS] = { { "F336W", 18.539, 1 }, { "F439W", 20.045, 2 }, { "F555W", 21.723, 3 }, { "F675W", 21.237, 4 }, { "F814W", 20.844, 5 }, { "F122M", 12.843, 0 }, { "F160W", 13.901, 0 }, { "F170W", 15.466, 0 }, { "F185W", 15.082, 0 }, { "F218W", 15.717, 0 }, { "F255W", 16.211, 0 }, { "F300W", 18.575, 1 }, { "F380W", 20.119, 2 }, { "F410M", 18.805, 2 }, { "F450W", 21.173, 2 }, { "F467M", 19.160, 2 }, { "F547M", 20.839, 3 }, { "F569W", 21.419, 3 }, { "F606W", 22.084, 3 }, { "F622W", 21.543, 4 }, { "F702W", 21.628, 4 }, {"F785LP", 19.877, 5 }, { "F791W", 20.707, 5 }, {"F850LP", 19.140, 5 }, {"F1042M", 15.367, 5 } }; char SMAG[6][1+1] = { "?", "U", "B", "V", "R", "I" }; /* * Data from Tables 7 and 10 of Holtzman et al. 1995 (PASP, 107, 1065-1093) */ struct { char IMAG[7]; char SMAG[2]; char SCOL[6]; double T1; double T2; double Z; double CMIN; double CMAX; } table2[NEQUATIONS] = { { "F336W", "U", "(U-B)", -0.844, -0.160, 18.505, -99.999, 99.999 }, { "F336W", "U", "(U-V)", -0.240, 0.048, 18.764, -99.999, 99.999 }, { "F336W", "U", "(U-R)", -0.172, 0.041, 18.797, -99.999, 99.999 }, { "F336W", "U", "(U-I)", -0.149, 0.038, 18.817, -99.999, 99.999 }, { "F439W", "B", "(U-B)", -0.103, -0.046, 20.057, -99.999, 99.999 }, { "F439W", "B", "(B-V)", 0.003, -0.088, 20.070, -99.999, 99.999 }, { "F439W", "B", "(B-R)", 0.019, -0.049, 20.064, -99.999, 99.999 }, { "F439W", "B", "(B-I)", 0.005, -0.023, 20.067, -99.999, 99.999 }, { "F555W", "V", "(U-V)", -0.014, 0.005, 21.706, -99.999, 99.999 }, { "F555W", "V", "(B-V)", -0.060, 0.033, 21.725, -99.999, 99.999 }, { "F555W", "V", "(V-R)", -0.121, 0.120, 21.730, -99.999, 99.999 }, { "F555W", "V", "(V-I)", -0.052, 0.027, 21.725, -99.999, 99.999 }, { "F675W", "R", "(U-R)", 0.039, -0.007, 21.254, -99.999, 99.999 }, { "F675W", "R", "(B-R)", 0.092, -0.017, 21.235, -99.999, 99.999 }, { "F675W", "R", "(V-R)", 0.253, -0.125, 21.234, -99.999, 99.999 }, { "F675W", "R", "(R-I)", 0.273, -0.066, 21.225, -99.999, 99.999 }, { "F814W", "I", "(U-I)", -0.018, 0.002, 20.815, -99.999, 99.999 }, { "F814W", "I", "(B-I)", -0.031, 0.007, 20.835, -99.999, 99.999 }, { "F814W", "I", "(V-I)", -0.062, 0.025, 20.839, -99.999, 99.999 }, { "F814W", "I", "(R-I)", -0.112, 0.084, 20.839, -99.999, 99.999 }, { "F300W", "U", "(U-B)", -0.427, 0.138, 18.181, 0.200, 1.000 }, { "F380W", "U", "(U-B)", -0.943, 0.103, 20.496, 0.500, 1.400 }, { "F410M", "B", "(B-V)", -0.183, -0.287, 18.815, -99.999, 1.400 }, { "F450W", "B", "(B-V)", 0.230, -0.003, 21.175, -99.999, 1.400 }, { "F467M", "B", "(B-V)", 0.432, -0.002, 19.118, 0.050, 1.400 }, { "F547M", "V", "(V-I)", 0.027, -0.032, 20.834, -99.999, 1.100 }, { "F569W", "V", "(V-I)", 0.089, -0.003, 21.417, -99.999, 2.000 }, { "F606W", "V", "(V-I)", 0.254, 0.012, 22.093, -99.999, 2.000 }, { "F622W", "R", "(V-R)", -0.252, -0.111, 21.557, -99.999, 99.000 }, { "F702W", "R", "(V-R)", 0.486, -0.079, 21.511, 0.600, 99.000 }, {"F785LP", "I", "(V-I)", 0.091, 0.020, 19.880, -99.999, 99.000 }, { "F791W", "I", "(V-I)", -0.029, -0.004, 20.707, -99.999, 1.000 }, {"F850LP", "I", "(V-I)", 0.160, 0.023, 19.122, -99.999, 99.000 }, {"F1042M", "I", "(V-I)", 0.350, 0.022, 15.314, -99.999, 99.000 } }; int j; int k; int index[3]; int IMAG_match; int SCOL_match; strcpy( ParS->IMAG[0], "?" ); ParS->ZSYN[0] = 0.0; ParS->SINDEX[0] = 0; strcpy( ParS->SMAG[0], SMAG[ParS->SINDEX[0]] ); for ( j=1; j<3; ++j) { strcpy( ParS->IMAG[j], ParS->IMAG[0] ); ParS->ZSYN[j] = ParS->ZSYN[0]; ParS->SINDEX[j] = ParS->SINDEX[0]; strcpy( ParS->SMAG[j], SMAG[ParS->SINDEX[j]] ); for ( k=0; kimag[j], table1[k].imag ) == 0 ) { strcpy( ParS->IMAG[j], table1[k].imag ); ParS->ZSYN[j] = table1[k].zsyn; ParS->SINDEX[j] = table1[k].sindex; strcpy( ParS->SMAG[j], SMAG[ParS->SINDEX[j]] ); break; } } /* for loop over k */ if (ParS->smag_is_INDEF[j]) strcpy( ParS->smag[j], ParS->SMAG[j] ); if (ParS->zsyn_is_INDEF[j]) ParS->zsyn[j] = ParS->ZSYN[j]; } /* for loop over j */ /* * Are we really working with a standard color? */ if ( ((ParS->SINDEX[1]==0)&&(ParS->SINDEX[2]>0)) || ((ParS->SINDEX[2]==0)&&(ParS->SINDEX[1]>0)) || (ParS->SINDEX[1]==ParS->SINDEX[2]) ) { /* nope! */ ParS->SINDEX[1] = 0; strcpy( ParS->SMAG[1], SMAG[0] ); ParS->SINDEX[2] = 0; strcpy( ParS->SMAG[2], SMAG[0] ); } ParS->SIGN = 1; if (ParS->SINDEX[2]SINDEX[1]) ParS->SIGN = -1; /* build SCOL */ strcpy( ParS->SCOL, "(" ); if ( ParS->SIGN == -1 ) { strcat( ParS->SCOL, ParS->SMAG[2] ); strcat( ParS->SCOL, "-" ); strcat( ParS->SCOL, ParS->SMAG[1] ); } else { strcat( ParS->SCOL, ParS->SMAG[1] ); strcat( ParS->SCOL, "-" ); strcat( ParS->SCOL, ParS->SMAG[2] ); } strcat( ParS->SCOL, ")" ); /* Did the user give their own transformation? */ ParS->transform_custom = (!ParS->t1_is_INDEF[1]) || (!ParS->t1_is_INDEF[1]) || ( !ParS->z_is_INDEF[1]) || (!ParS->t1_is_INDEF[2]) || (!ParS->t1_is_INDEF[2]) || ( !ParS->z_is_INDEF[2]); ParS->T1[0] = 0.0; ParS->T2[0] = 0.0; ParS->Z[0] = 0.0; index[0] = -1; for ( j=1; j<3; ++j ) { ParS->T1[j] = ParS->T1[0]; ParS->T2[j] = ParS->T2[0]; ParS->Z[j] = ParS->Z[0]; index[j] = index[0]; for ( k=0; kIMAG[j],table2[k].IMAG) == 0); SCOL_match = (strcmp(ParS->SCOL,table2[k].SCOL) == 0); if ( IMAG_match && SCOL_match ) { ParS->T1[j] = table2[k].T1; ParS->T2[j] = table2[k].T2; ParS->Z[j] = table2[k].Z; index[j] = k; break; } /* if */ } /* for loop over k */ if (!ParS->transform_custom) { if (ParS->t1_is_INDEF[j]) ParS->t1[j] = ParS->T1[j]; if (ParS->t2_is_INDEF[j]) ParS->t2[j] = ParS->T2[j]; if (ParS->z_is_INDEF[j]) ParS->z[j] = ParS->Z[j]; } /* if */ } /* for loop over j */ /* Is this a standard transformation? */ ParS->transform_standard = (index[1]!=-1) && (index[2]!=-1) && (!ParS->transform_custom); ParS->do_transform = ( ParS->transform_custom || ParS->transform_standard ); if (!ParS->do_transform) { /* redfine SMAG1 as a synthetic magnitude */ strcpy( ParS->SMAG[1], ParS->IMAG[1] ); if (ParS->smag_is_INDEF[1]) strcpy( ParS->smag[1], ParS->SMAG[1] ); /* redfine SMAG2 as a synthetic magnitude */ strcpy( ParS->SMAG[2], ParS->IMAG[2] ); if (ParS->smag_is_INDEF[2]) strcpy( ParS->smag[2], ParS->SMAG[2] ); /* rebuild SCOL */ strcpy( ParS->SCOL, "(" ); strcat( ParS->SCOL, ParS->SMAG[1] ); strcat( ParS->SCOL, "-" ); strcat( ParS->SCOL, ParS->SMAG[2] ); strcat( ParS->SCOL, ")" ); /* set SIGN to default */ ParS->SIGN = 1; } /* if */ ok: status = 0; goto bye; mx_error1: mxp_tmpmsg_init_f0(); mx_error2: mxp_errmsg_append_f3 (mxfunc, status, MX.tmpmsg); mxp_tmpmsg_init_f0(); status = 1; goto bye; bye: return(status); } #undef NFILTERS #undef NEQUATIONS /* end-of-file */