- Timestamp:
- Jun 22, 2014, 5:21:17 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/mkcmf.c
r36921 r36934 21 21 void writeStars_PS1_V2 (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars); 22 22 void writeStars_PS1_V1 (FTable *ftable, double *X, double *Y, double *M, int Nstars); 23 void writeStars_PS1_SV3 (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars); 23 24 void writeStars_PS1_DEV_1 (FTable *ftable, double *X, double *Y, double *M, int Nstars); 24 25 void writeStars_PS1_DEV_0 (FTable *ftable, double *X, double *Y, double *M, int Nstars); … … 339 340 if (!strcmp(type, "PS1_V5_Lensing")) { 340 341 writeStars_PS1_V5_Lensing (&ftable, X, Y, M, Flag, Nstars); 342 found = TRUE; 343 } 344 if (!strcmp(type, "PS1_SV3")) { 345 writeStars_PS1_SV3 (&ftable, X, Y, M, Flag, Nstars); 341 346 found = TRUE; 342 347 } … … 885 890 } 886 891 887 void writeStars_PS1_ V5_Lensing(FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars) {892 void writeStars_PS1_SV3 (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars) { 888 893 889 894 int i; 890 CMF_PS1_ V5_Lensing*stars;895 CMF_PS1_SV3 *stars; 891 896 float flux, fSN; 892 897 893 898 // XXX add gaussian-distributed noise based on counts 894 899 // this needs to make different output 'stars' entries depending on the desired type 895 ALLOCATE (stars, CMF_PS1_ V5_Lensing, Nstars);900 ALLOCATE (stars, CMF_PS1_SV3, Nstars); 896 901 for (i = 0; i < Nstars; i++) { 897 902 … … 964 969 stars[i].Mrh = FX; 965 970 966 stars[i].X11_sm_obj = FX;967 stars[i].X12_sm_obj = FX;968 stars[i].X22_sm_obj = FY;969 stars[i].E1_sm_obj = FX;970 stars[i].E2_sm_obj = FX;971 972 stars[i].X11_sh_obj = FX;973 stars[i].X12_sh_obj = 0.2;974 stars[i].X22_sh_obj = FY;975 stars[i].E1_sh_obj = FX*0.9;976 stars[i].E2_sh_obj = FX*0.8;977 978 stars[i].X11_sm_psf = FX;979 stars[i].X12_sm_psf = FX;980 stars[i].X22_sm_psf = FX;981 stars[i].E1_sm_psf = FX;982 stars[i].E2_sm_psf = FX;983 984 stars[i].X11_sh_psf = FX;985 stars[i].X12_sh_psf = FX;986 stars[i].X22_sh_psf = FX;987 stars[i].E1_sh_psf = FX;988 stars[i].E2_sh_psf = FX;989 990 971 stars[i].kronFlux = flux * 1.25; 991 972 stars[i].kronFluxErr = fSN * flux * 1.25; … … 994 975 stars[i].kronOuter = fSN * flux * 1.5; 995 976 996 stars[i].skyLimitRad = 1;997 stars[i].skyLimitFlux = 2;998 stars[i].skyLimitSlope = 0.2;977 // stars[i].skyLimitRad = 1; 978 // stars[i].skyLimitFlux = 2; 979 // stars[i].skyLimitSlope = 0.2; 999 980 1000 981 stars[i].flags = Flag[i]; … … 1014 995 } 1015 996 997 gfits_table_set_CMF_PS1_SV3 (ftable, stars, Nstars); 998 gfits_modify (ftable->header, "EXTTYPE", "%s", 1, "PS1_SV3"); 999 } 1000 1001 void writeStars_PS1_V5_Lensing (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars) { 1002 1003 int i; 1004 CMF_PS1_V5_Lensing *stars; 1005 float flux, fSN; 1006 1007 // XXX add gaussian-distributed noise based on counts 1008 // this needs to make different output 'stars' entries depending on the desired type 1009 ALLOCATE (stars, CMF_PS1_V5_Lensing, Nstars); 1010 for (i = 0; i < Nstars; i++) { 1011 1012 flux = pow (10.0, -0.4*M[i]); 1013 fSN = 1.0 / sqrt(flux); 1014 1015 stars[i].detID = i; 1016 stars[i].X = X[i]; 1017 stars[i].Y = Y[i]; 1018 stars[i].dX = FX * fSN; 1019 stars[i].dY = FY * fSN; 1020 1021 stars[i].posangle = 10.0; 1022 stars[i].pltscale = 0.25; 1023 1024 stars[i].M = M[i]; 1025 stars[i].dM = fSN; 1026 1027 stars[i].Flux = flux; 1028 stars[i].dFlux = flux * fSN; 1029 1030 stars[i].Map = M[i] - 0.05; 1031 stars[i].MapRaw = M[i] - 0.10; 1032 1033 stars[i].apRadius = 8.0; 1034 1035 stars[i].apFlux = pow(10.0, -0.4*stars[i].Map); 1036 stars[i].apFluxErr = stars[i].apFlux * fSN; 1037 1038 stars[i].Mcalib = M[i] + ZERO_POINT + 2.5*log10(exptime); 1039 stars[i].dMcal = 0.05; 1040 1041 XY_to_RD (&stars[i].RA, &stars[i].DEC, X[i], Y[i], &coords); 1042 stars[i].apNpix = 3.14*8.0*8.0; 1043 1044 stars[i].Mpeak = M[i] + 1.0; 1045 stars[i].sky = SKY; 1046 stars[i].dSky = DSKY; 1047 stars[i].psfChisq = PSFCHI; 1048 stars[i].crNsigma = CRN; 1049 stars[i].extNsigma = EXTN; 1050 stars[i].fx = FX; 1051 stars[i].fy = FY; 1052 stars[i].df = DF; 1053 1054 stars[i].k = 1.0; 1055 stars[i].fwhmMaj = FX*2.8; 1056 stars[i].fwhmMin = FY*2.8; 1057 1058 // randomly give poor PSFQF values 1059 if ((BAD_PSFQF_FRAC > 0.0) && (drand48() < BAD_PSFQF_FRAC)) { 1060 stars[i].psfQF = 0.25; 1061 stars[i].psfQFperf = 0.24; 1062 } else { 1063 stars[i].psfQF = PSFQUAL; 1064 stars[i].psfQFperf = MAX(PSFQUAL - 0.01, 0.0); 1065 } 1066 1067 stars[i].psfNdof = 1; 1068 stars[i].psfNpix = 2; 1069 1070 stars[i].Mxx = FX; 1071 stars[i].Mxy = 0.01; 1072 stars[i].Myy = FX; 1073 stars[i].M3c = FX; 1074 stars[i].M3s = FX; 1075 stars[i].M4c = FX; 1076 stars[i].M4s = FX; 1077 stars[i].Mr1 = FX; 1078 stars[i].Mrh = FX; 1079 1080 stars[i].X11_sm_obj = FX; 1081 stars[i].X12_sm_obj = FX; 1082 stars[i].X22_sm_obj = FY; 1083 stars[i].E1_sm_obj = FX; 1084 stars[i].E2_sm_obj = FX; 1085 1086 stars[i].X11_sh_obj = FX; 1087 stars[i].X12_sh_obj = 0.2; 1088 stars[i].X22_sh_obj = FY; 1089 stars[i].E1_sh_obj = FX*0.9; 1090 stars[i].E2_sh_obj = FX*0.8; 1091 1092 stars[i].X11_sm_psf = FX; 1093 stars[i].X12_sm_psf = FX; 1094 stars[i].X22_sm_psf = FX; 1095 stars[i].E1_sm_psf = FX; 1096 stars[i].E2_sm_psf = FX; 1097 1098 stars[i].X11_sh_psf = FX; 1099 stars[i].X12_sh_psf = FX; 1100 stars[i].X22_sh_psf = FX; 1101 stars[i].E1_sh_psf = FX; 1102 stars[i].E2_sh_psf = FX; 1103 1104 stars[i].kronFlux = flux * 1.25; 1105 stars[i].kronFluxErr = fSN * flux * 1.25; 1106 1107 stars[i].kronInner = fSN * flux * 0.9; 1108 stars[i].kronOuter = fSN * flux * 1.5; 1109 1110 stars[i].skyLimitRad = 1; 1111 stars[i].skyLimitFlux = 2; 1112 stars[i].skyLimitSlope = 0.2; 1113 1114 stars[i].flags = Flag[i]; 1115 stars[i].flags2 = 0x80; 1116 1117 stars[i].nFrames = 1; 1118 1119 if (ADDNOISE) { 1120 stars[i].X += FX * fSN * rnd_gauss(0.0, 1.0); 1121 stars[i].Y += FY * fSN * rnd_gauss(0.0, 1.0); 1122 float Moff = fSN*rnd_gauss(0.0, 1.0); 1123 stars[i].M += Moff; 1124 stars[i].Map += Moff; 1125 stars[i].MapRaw += Moff; 1126 stars[i].Mcalib += Moff; 1127 } 1128 } 1129 1016 1130 gfits_table_set_CMF_PS1_V5_Lensing (ftable, stars, Nstars); 1017 1131 gfits_modify (ftable->header, "EXTTYPE", "%s", 1, "PS1_V5");
Note:
See TracChangeset
for help on using the changeset viewer.
