# to extract a radial profile, coordinates need to be formatted as a # vector column, instead of independent columns; so to get the radial # profile for the ChaRT/SAOSac file is to create a new column defined # by the vector of (rt_y,rt_z) that's called "rtpos". % dmtcalc infile="HRMA.fits[cols rt_y,rt_z] " outfile="hrma_vector.fits" expression="rt_y,rt_z" % dmhedit infile="hrma_vector.fits" filelist="" operation="add" key="MTYPE1" value="rtpos" % dmhedit infile="hrma_vector.fits" filelist="" operation="add" key="MFORM1" value="rt_y,rt_z" % dmpaste infile="HRMA.fits" pastefile="hrma_vector.fits" outfile="HRMA_saosac_vectored.fits" # % dmlist HRMA_saosac_vectored.fits cols | grep rtpos # 20 rtpos(rt_y,rt_z) mm Real8 -1738.8360: 1295.4574754631 Label for field % dmextract infile="HRMA_saosac_vectored.fits[bin rtpos=@hrma.reg]" outfile=hrma.radprof opt="generic" % dmtcalc infile="hrma.radprof" outfile="hrma_rmid.radprof" expression="rmid=0.5*(R[0]+R[1])/0.023985" # converts from mm to ACIS pixel unit # the HRMA rays projected to the detector-plane are regular events # files, so the radial profile can be extracted as normal with # dmextract, and then add the radial mid-point as a column with # dmtcalc (http://cxc.harvard.edu/ciao/threads/radial_profile/index.html#dmextract) % dmextract infile="hrma_ppr_perfectdet.fits[bin detpos=@perfectdet.reg]" outfile=hrma_perfectdet.radprof opt=generic % dmtcalc infile="hrma_perfectdet.radprof" outfile=hrma_perfectdet_rmid.radprof expression="rmid=0.5*(R[0]+R[1])" % dmextract infile="hrma_nodither.fits[bin det=@nodither.reg]" outfile=hrma_nodither.radprof opt=generic % dmtcalc infile=hrma_nodither.radprof outfile=hrma_nodither_rmid.radprof expression="rmid=0.5*(R[0]+R[1])" % dmextract infile="obs_sim.fits[bin det=@obs_sim.reg]" outfile=obs_sim.radprof opt=generic % dmtcalc infile=obs_sim.radprof outfile=obs_sim_rmid.radprof expression="rmid=0.5*(R[0]+R[1])" # plotting with ChIPS chips> import pycrates as pcr chips> hrma="hrma_rmid.radprof" chips> obs_sim="obs_sim_rmid.radprof" chips> hrma_nodither="hrma_nodither_rmid.radprof" chips> hrma_perfectdet="hrma_perfectdet_rmid.radprof" chips> variables=[n for n in vars().keys() if n.startswith("hrma")] chips> variables.append("obs_sim") chips> for n in variables: vars()["cr_"+n] = pcr.read_file(vars()[n]) chips> for n in variables: vars()["r_{}".format(n)]=pcr.get_colvals(vars()["cr_{}".format(n)],"rmid").tolist() chips> for n in variables: vars()["counts_{}".format(n)]=pcr.get_colvals(vars()["cr_{}".format(n)],"sur_bri").tolist() chips> add_window(17.5,8,"inches") chips> add_frame() chips> col_grid_objects([2,2,2],0.1,0,1) chips> adjust_grid_xrelsize(1,1.25) chips> set_current_plot("all") chips> add_curve(r_obs_sim,np.array(counts_obs_sim)/max(counts_obs_sim),["symbol.style","none","line.color","green"]) chips> add_curve(r_hrma_perfectdet,np.array(counts_hrma_perfectdet)/max(counts_hrma_perfectdet),["symbol.style","none","line.color","red"]) chips> add_curve(r_hrma_nodither,np.array(counts_hrma_nodither)/max(counts_hrma_nodither),["symbol.style","none","line.color","blue"]) chips> add_curve(r_hrma,np.array(counts_hrma)/max(counts_hrma),["symbol.style","none","line.style","shortdash"]) chips> set_plot_ylabel("normalized counts per pixel") chips> set_plot_xlabel("radius [ACIS pixels]") chips> set_xaxis(["label.size",18]) chips> set_yaxis(["label.size",18]) chips> set_yaxis(["tickformat","%0.0z","offset.perpendicular",60]) chips> set_plot({"title.size":24}) chips> set_current_plot("plot1") chips> hide_axis("ax1") chips> set_plot_title("PSF to 25 Pixels") chips> set_current_plot("plot3") chips> hide_axis("ax1") chips> set_plot_title("PSF Core") chips> set_current_plot("plot5") chips> hide_axis("ax1") chips> set_plot_title("PSF Wings") chips> set_current_plot("plot1") chips> log_scale(X_AXIS) chips> set_current_plot("plot2") chips> log_scale() chips> set_current_plot("plot3") chips> limits(X_AXIS,AUTO,3.5) chips> set_current_plot("plot4") chips> limits(X_AXIS,AUTO,3.5) chips> limits(Y_AXIS,0.001,AUTO) chips> log_scale(Y_AXIS) chips> set_current_plot("plot5") chips> limits(X_AXIS,8,25) chips> limits(Y_AXIS,AUTO,0.00025) chips> set_current_plot("plot6") chips> limits(X_AXIS,8,25) chips> limits(Y_AXIS,AUTO,0.00025) chips> log_scale(Y_AXIS) chips> add_label(5.25,85,"HRMA PSF",["coordsys",PIXEL,"size",18]) chips> add_label(5.25,70,"HRMA PSF/Ideal Detector",["color","red","coordsys",PIXEL,"size",18]) chips> add_label(5.25,55,"HRMA PSF/ACIS-I",["color","blue","coordsys",PIXEL,"size",18]) chips> add_label(5.25,40,"HRMA PSF/ACIS-I w/dither",["color","green","coordsys",PIXEL,"size",18])