FUNCTION StarP3, starspec_file, starext_file, Water=Swater3 wave_length = (IndGen(335) * 0.005) + 0.82 star_spec = starspec_file[1,140:334] wave_short = wave_length[140:334] y1 = IndGen(51) * 2 n1y1 = FltArr(2,51) FOR j=0, 50 DO BEGIN star_ext = starext_file[y1[j],*] b1 = star_spec / star_ext b2 = svdfit(wave_short[*], b1[*], 5, /DOUBLE, chisq=b3) n1y1[0,j] = (y1[j] * 0.1) n1y1[1,j] = b3 ENDFOR my1 = min(n1y1[1,*]) y2 = (IndGen(41) * 0.01) + (n1y1[0,!C] - 0.2) n1y2 = FltArr(2,41) FOR j=0, 40 DO BEGIN star_wat = y2[j] a1 = fix(star_wat * 10.0) a2 = (star_wat * 10.0) - a1 a3 = a1 a4 = a1 + 1 star_ext = (a2 * starext_file[a4,*]) + ((1.0 - a2) * starext_file[a3,*]) b1 = star_spec / star_ext b2 = svdfit(wave_short[*], b1[*], 5, /DOUBLE, chisq=b3) n1y2[0,j] = y2[j] n1y2[1,j] = b3 ENDFOR my2 = min(n1y2[1,*]) y3 = (IndGen(21) * 0.001) + (n1y2[0,!C] - 0.01) n1y3 = FltArr(2,21) FOR j=0, 20 DO BEGIN star_wat = y3[j] a1 = fix(star_wat * 10.0) a2 = (star_wat * 10.0) - a1 a3 = a1 a4 = a1 + 1 star_ext = (a2 * starext_file[a4,*]) + ((1.0 - a2) * starext_file[a3,*]) b1 = star_spec / star_ext b2 = svdfit(wave_short[*], b1[*], 5, /DOUBLE, chisq=b3) n1y3[0,j] = y3[j] n1y3[1,j] = b3 ENDFOR my3 = min(n1y3[1,*]) print, n1y3[0,!C], n1y3[1,!C] Swater3 = n1y3[0,!C] bb1 = fix(n1y3[0,!C] * 10.0) bb2 = (n1y3[0,!C] * 10.0) - bb1 bb3 = bb1 bb4 = bb1 + 1 star_ex = (bb2 * starext_file[bb4,*]) + ((1.0 - bb2) * starext_file[bb3,*]) star_out = FltArr(2,195) star_out[0,*] = wave_short star_out[1,*] = star_spec / star_ex RETURN, star_out END