PRO axaf1_observ, ax1_file @effic_com @axaf1_com if(n_elements(ax1_file) EQ 0) then ax1_file = "s_Capella_nei.ax1" if(n_elements(ax_time) EQ 0) then ax_time = 10.E3 ; Read the input file: all_data = fltarr(1000,4) OPENR, 37, ax1_file Ndata = 0 tmp0 = 0. tmp1 = 0. tmp2 = 0. tmp3 = 0. WHILE (not EOF(37)) DO BEGIN READF, 37,FORMAT='(4F15.8)', tmp0, tmp1, tmp2, tmp3 all_data(Ndata,0) = tmp0 all_data(Ndata,1) = tmp1 all_data(Ndata,2) = tmp2 all_data(Ndata,3) = tmp3 Ndata = Ndata+1 ENDWHILE CLOSE, 37 ; Fill the arrays: es = fltarr(Ndata) spec_heg = es spec_meg = es spec_total = es es = all_data(0:Ndata-1,0) spec_heg = all_data(0:Ndata-1,1) spec_meg = all_data(0:Ndata-1,2) spec_total = all_data(0:Ndata-1,3) ; Multiply by the time and Convolve for FWHM = 2xbin_size ax_kernal = [0.045, 0.23, 0.45, 0.23, 0.045] resolving =0.5*es(0)/(es(1)-es(0)) blur_counts = CONVOL(spec_total,ax_kernal)*ax_time ; Add Poisson noise: convert counts to observed counts blur_counts = FLOAT(g_poiss(blur_counts)) ; Output to a file: ; and output to a file = ax1_file.o IF(1 EQ 1) then begin ax_outfile = ax1_file + ".o" OPENW, 37, ax_outfile FOR id = 0,n_elements(blur_counts)-1 DO BEGIN PRINTF, FORMAT='(2F15.8)', 37, es(id), blur_counts(id) END CLOSE, 37 END ; end of if(1 EQ 1) ; Calculate some statistics t_counts = TOTAL(blur_counts) print, " Total counts in "+STRING(ax_time)+" seconds: "+STRING(t_counts) !MTITLE = "Simulated HETG Observation of Capella" plot_yt = "Counts in bin (bin width is E/"+$ STRING(es(0)/(es(1)-es(0)),FORMAT='(F4.0)')+")" plot, es, blur_counts, PSYM=10, $ XTITLE = "Energy (keV)", YTITLE = plot_yt, $ XRANGE = [0.5, 2.0], YRANGE = [1.0,1000.] t_string = " Exposure: "+STRING(ax_time,FORMAT='(F7.0)')+" seconds" c_string = " Total counts:"+STRING(t_counts,FORMAT='(I6)')+$ STRING(FORMAT='(" (",F4.1," -",F4.1,"keV)")',MIN(es),MAX(es)) r_string = " Resolving power is: "+STRING(resolving,FORMAT='(F4.0)') x_loc = 0.60 xyouts, x_loc, 0.90, t_string, /NORMAL xyouts, x_loc, 0.87, c_string, /NORMAL xyouts, x_loc, 0.84, r_string, /NORMAL xyouts, 1.80, 150., "Si XIII" xyouts, 1.47, 200., "Mg XII Lyman alpha" xyouts, 1.30, 250., "Mg XI He-like" RETURN END