*** photon_analysis_1.3.pro Mon May 5 16:16:42 2003 --- photon_analysis_1.4.pro Thu May 8 13:21:57 2003 *************** *** 184,217 **** ;define colors for plotting black = 0 white = 255 - red = 0 endif else begin ;set up to plot to memory buffer and then write to JPEG ! set_plot, 'z' ! device, set_resolution=[8000,6000] ! device, set_font='Courier' ! fsub = jpgfile ;text to write at bottom of plot - ;set parameters for JPEG - - ;set tick marks and margins - !Y.MINOR=0 - !y.margin=[6,4] - !x.margin=[20,4] - - asize = 8.0 ;charsize for annotations - athick = 15.0 ;charthick for annotations - lthick = 20.0 ;line thickness - - ;plot colors - black = 0 - white = 255 - red = 0 - endelse - endelse - ;add /xlog and /ylog to the plot statement below to return to log-log plot plot, 10^x, 10^y, $ xtitle="Signal (ADU)", $ --- 184,217 ---- ;define colors for plotting black = 0 white = 255 endif else begin ;set up to plot to memory buffer and then write to JPEG ! set_plot, 'z' ! device, set_colors=256 ! device, set_resolution=[8000,6000] ! device, set_font='Courier' ! fsub = jpgfile ;text to write at bottom of plot ! ! ;set parameters for JPEG ! ! ;set tick marks and margins ! !Y.MINOR=0 ! !y.margin=[6,4] ! !x.margin=[20,4] ! ! asize = 8.0 ;charsize for annotations ! athick = 15.0 ;charthick for annotations ! lthick = 20.0 ;line thickness ! ! ;plot colors ! black = 0 ! white = 255 ! red=0 ! endelse ! endelse ;add /xlog and /ylog to the plot statement below to return to log-log plot plot, 10^x, 10^y, $ xtitle="Signal (ADU)", $ *************** *** 251,261 **** ; Rectify the points, negative signal is not allowed. avgadu = avgadu > 0 ! ; Plot the observed points on the graph ! oplot, avgadu, sigmavals^2, psym=8, color=red ! oplot, [!x.crange[0], !x.crange[1]], [0,0], linestyle=linestyle, thick=lthick, color=black ; Add error bars ;xyerrbar, avgadu, sigmavals, sigmavals-sigma_sigma, sigmavals+sigma_sigma, $ --- 251,269 ---- ; Rectify the points, negative signal is not allowed. avgadu = avgadu > 0 ! ; for ii=0,n_elements(avgadu)-1 do begin ! ; sigmavals[ii] = sigmavals[ii]/(1-2.36e-6*avgadu[ii]-1.7e-11*avgadu[ii])^2 ! ; avgadu[ii]=avgadu[ii]/(1-2.36e-6*avgadu[ii]-1.7e-11*avgadu[ii]) ! ; end ! goodpoints = where(avgadu lt 1e4) ; Plot the observed points on the graph ! oplot, avgadu[goodpoints], sigmavals[goodpoints]^2, psym=8, color=red ! ;;Plot the points that are greater than 10K as an asterisk since they were ignored in ! ;;the fit. ! bigpoints = where(avgadu ge 1e4) ! oplot, avgadu[bigpoints],sigmavals[bigpoints]^2, psym=1, color=black ! oplot, [!x.crange[0], !x.crange[1]], [0,0], linestyle=linestyle, thick=lthick, color=black ; Add error bars ;xyerrbar, avgadu, sigmavals, sigmavals-sigma_sigma, sigmavals+sigma_sigma, $ *************** *** 270,278 **** ; error_gain = 0. ; Find the readnoise and gain using linear fit - goodpoints = where(avgadu lt 1e4) fitexy, avgadu[goodpoints], sigmavals[goodpoints]^2, rn2, rgain, sigma_A_B, chisq, prob, $ ! X_SIG=sigma_adu, Y_SIG=2.*sigma_sigma*sigmavals readnoise = sqrt(rn2) gain = 1./rgain --- 278,285 ---- ; error_gain = 0. ; Find the readnoise and gain using linear fit fitexy, avgadu[goodpoints], sigmavals[goodpoints]^2, rn2, rgain, sigma_A_B, chisq, prob, $ ! X_SIG=sigma_adu[goodpoints], Y_SIG=2.*sigma_sigma[goodpoints] readnoise = sqrt(rn2) gain = 1./rgain *************** *** 299,308 **** print,' Signal (ADU) = ',avgadu[bad_snr] print,'' endif ! fitexy, avgadu[good_snr], sigmavals[good_snr]^2, rn2, rgain, sigma_A_B, chisq, prob, $ ! X_SIG=sigma_adu[good_snr], Y_SIG=2.*sigma_sigma[good_snr]*sigmavals[good_snr] readnoise = sqrt(rn2) gain = 1./rgain error_rn = 0.5*sigma_A_B[0]/readnoise error_gain = sigma_A_B[1]*gain^2 endelse --- 306,319 ---- print,' Signal (ADU) = ',avgadu[bad_snr] print,'' endif ! fitexy, avgadu[good_snr], sigmavals[good_snr]^2, rn2, rgain, sigma_A_B, chisq, prob,$ ! X_SIG=sigma_adu[good_snr], Y_SIG=2*sigma_sigma[good_snr] readnoise = sqrt(rn2) gain = 1./rgain + ; res=poly_fit(avgadu[good_snr],sigmavals[good_snr]^2,1,$ + ; chisq=chisq,covar=covar,sigma=sigma_A_B) + ; readnoise = sqrt(res[0]) + ; gain = 1./res[1] error_rn = 0.5*sigma_A_B[0]/readnoise error_gain = sigma_A_B[1]*gain^2 endelse *************** *** 317,325 **** ; Calculate gain and read noise for our plot theGain = strtrim(string(gain,format='(f6.2)'),2) + string("261B) + $ ! strtrim(string(error_gain,format='(f5.2)'),2) theReadNoise = strtrim(string(readnoise * gain,format='(f6.1)'),2) + string("261B) + $ ! strtrim(string(error_rn * gain,format='(f5.1)'),2) ; Add SCA, date & time stamps, read noise and gain to plot --- 328,336 ---- ; Calculate gain and read noise for our plot theGain = strtrim(string(gain,format='(f6.2)'),2) + string("261B) + $ ! strtrim(string(error_gain,format='(f6.3)'),2) theReadNoise = strtrim(string(readnoise * gain,format='(f6.1)'),2) + string("261B) + $ ! strtrim(string(error_rn * gain,format='(f6.2)'),2) ; Add SCA, date & time stamps, read noise and gain to plot