Debian Codegraph @

doc/tsrs/choppy_count_problem/source/commands.rst

raw
1 Appendix: Commands used to generate plots
2 ==========================================
3
4 The version of pysynphot used for this investigation was::
5
6 URL: https://svn.stsci.edu/svn/ssb/astrolib/tags/pysynphot_v0.61_ETC18.0
7 Repository Root: https://svn.stsci.edu/svn/ssb/astrolib
8 Revision: 1143
9 Last Changed Author: laidler
10 Last Changed Rev: 1080
11 Last Changed Date: 2009-08-14 14:57:05 -0400 (Fri, 14 Aug 2009)
12
13 #Examine spectrum as presented in CDBS::
14
15 sp=S.FileSpectrum('/grp/hst/cdbs/calspec/lds749b_mod_001.fits')
16 clf()
17 plot(sp.wave,sp.flux)
18 xlabel(sp.waveunits)
19 ylabel(sp.fluxunits)
20 title(sp)
21 xlim(1100,1500)
22 savefig('cdbs_flam.png')
23
24 #Examine bin widths of spectrum::
25
26 dw=sp.wave[1:]-sp.wave[:-1]
27 plot(sp.wave[1:],dw,'.')
28 xlabel('angstrom')
29 ylabel('binwidth')
30 title(sp)
31 savefig('binwidth.png')
32 xlim(1100,1500)
33 ylim(0,0.6)
34 savefig('binwidth_zoom.png')
35
36
37 #Previously obtain and save SYNPHOT spectrum using calcspec task::
38
39 #--> lpar calcspec
40 # spectrum = "crcalspec$lds749b_mod_001.fits" Spectrum to calculate
41 # output = "lds749b.fits" Output table name
42 # (form = "counts") Desired form of output spectrum
43
44 #Read in this spectrum to examine its wavelength array::
45
46 synspec=S.FileSpectrum('lds749b.fits')
47 syndw=synspec.wave[1:]-synspec.wave[:-1]
48 plot(synspec.wave[1:],syndw,'.')
49 xlabel('angstrom')
50 ylabel('binwidth')
51 title('crcalspec$lds749b_mod_001.fits rendered in SYNPHOT')
52 savefig('syn_binwidth.png')
53 xlim(1100,1500)
54 ylim(0,.6)
55 savefig('syn_binwidth_zoom.png')
56
57 #Examine the spectrum in pysynphot on the SYNPHOT waveset::
58
59 sp.convert('counts')
60 plot(synspec.wave,sp.sample(synspec.wave),'.-')
61 xlim(1100,1500)
62 ylim(0,30)
63 xlabel(synspec.waveunits)
64 ylabel(sp.fluxunits)
65 title("%s sampled on SYNPHOT wavelength array"%os.path.basename(str(sp)))
66 savefig('syn_sampled_counts.png')
67