Plotting Spectra with pplot

From DavinciWiki
(Difference between revisions)
Jump to: navigation, search
 
(7 intermediate revisions by one user not shown)
Line 1: Line 1:
{{DavinciWiki_Function|
+
{{DavinciWiki_Procedure|
Run through a variety of [[pplot|pplot()]] cases.
+
Run through a variety of [[pplot|pplot()]] cases.  The commands can be run automatically by using [[pplot_tutorial|pplot_tutorial()]].
 
|
 
|
Arguments: none.
+
Setup all the data we need...lots of output will be printed (but has been omitted here)
 +
dv> xlab1 = make_band(lab1=1)
 +
dv> xtes = make_band(tes=1)
 +
dv> xmtes = make_band(mtes=1)
 +
dv> xthemis = make_band(themis=1)
 +
dv> xthemiscm = make_band(themis=1, cm=1)
 +
dv> xastercm = make_band(aster=1, cm=1)
 +
dv> xtimscm = make_band(tims=1, cm=1)
 +
 +
# mini-TES data
 +
dv> minites_emiss = read($DV_EX+"/minites_cube.vicar")
 +
dv> array=minites_emiss[8:11, 5:6]
 +
dv> xx=array[1:4,1]
 +
dv> yy=array[1,1:2]
 +
dv> a=array[1,1]
 +
dv> b=array[2,2]
 +
dv> c=array[2,1]
 +
 +
# tes data
 +
dv> tes_emiss = read($DV_EX+"/TES_emissivity_example.vic")
 +
 +
# lab data
 +
dv> asu = read($DV_EX+"/ASU_minlib.hdf")
 +
dv> spectrum = asu.data[1]
 +
dv> lab_array = asu.data[1:5]
 +
dv> spec_struc = read($DV_EX+"/lab_structure.hdf")
 +
 +
# make simulated aster data from lab - wavenumber x-axis
 +
dv> asterdata = i2i(asu.data, from='lab1', to='aster', cm=1)
 +
# make simulated tims data from lab - wavenumber x-axis
 +
dv> timsdata = i2i(asu.data, from='lab1', to='tims', cm=1)
 +
# make simulated aster data from lab - wavelength x-axis
 +
dv> asterdata = i2i(asu.data, from='lab1', to='aster')
 +
 +
# make some simulated themis data - wavelength x-axis
 +
dv> emthemis_cube = i2i(asu.data[1:3], from = 'lab1', to='themis')
 +
 +
# convert lab1 data to aster, tims, and themis with wavenumber x-axis
 +
dv> a1 = i2i(asu.data[1], from='lab1', to='aster', cm=1)
 +
dv> t1 = i2i(asu.data[1], from='lab1', to='tims', cm=1)
 +
dv> th1 = i2i(asu.data[1], from='lab1', to='themis', cm=1)
  
Return Value: none. [[GnuPlot]] is launched and displays graph.
+
'''Each image corresponds to the listed command'''
|
+
[[Syntax]]: pplot_tutorial()
+
|
+
See [[pplot_tutorial|pplot_tutorial()]] or [[pplot_examples|pplot_examples()]] for sample cases.
+
  
Each image corresponds to the listed command.
+
Simplest possible case: 1 vector, no colors, no labels - like xplot
  dv> pplot_tutorial()
+
  dv> pplot(spectrum)
..........................................
+
doing broadband
+
..........................................
+
 
   
 
   
  Simplest possible case: 1 vector, no colors, no labels - like xplot
+
  [[Image:pplot2_tutorial1.png|500px]]
"pplot(array[1,1])"
+
 
pausing
+
2. Simple case: 1 vector with user-input x-axis, no colors, no labels
[[Image:pplot_tutorial1.png|500px]]
+
  dv> pplot(spectrum, xaxis=xlab1)
Next simplest case: 1 array, no colors, no labels - will cycle colors automatically
+
    Use standard mtes x-axis
+
"pplot(array, mtes=1)"
+
pausing
+
[[Image:pplot_tutorial2.png|500px]]
+
Simple case: 1 data element (array), 1 color (for all), 1 label, standard mini-TES plot
+
    Note: Order doesn't matter for colors and labels)
+
"pplot(array, 'Array', 2, mtes=1)"
+
pausing
+
[[Image:pplot_tutorial3.png|500px]]
+
1 array, 1 label, no colors - will auto cycle through colors and add index to label
+
"pplot(array, 'Array', mtes=1)"
+
pausing
+
[[Image:pplot_tutorial4.png|500px]]
+
2 data elements, 2 colors, 2 labels in structures - single color and single label for each data element
+
"pplot({array, xx}, {1,2}, {'a', 'b'}, mtes=1)"
+
pausing
+
[[Image:pplot_tutorial5.png|500px]]
+
2 data elements (1 array & 1 vector), 2 colors, 2 labels - single color and single label for each data element
+
"pplot({array, array[1,1]}, {1,2}, {'a', 'b'}, mtes=1)"
+
pausing
+
[[Image:pplot_tutorial6.png|500px]]
+
2 different data elements with different x axes
+
"pplot({asudata[1:2], asterdata[1:2]}, xaxis={xlab1, xastercm}, x1=800, x2=1300, xlabel='Wavenumber', \
+
ylabel='Emissivity',  plot_title = 'Lab and ASTER Example')"
+
pausing
+
[[Image:pplot_tutorial7.png|500px]]
+
3 vectors, 3 labels, no colors - will auto cycle through colors
+
"pplot({a,b,c}, {'V1', 'V2', 'V3'}, mtes=1)"
+
pausing
+
[[Image:pplot_tutorial8.png|500px]]
+
Just 1 data element with 5 vectors in x, 5 labels, 5 colors
+
"pplot(array[1:5, 1], {1,3,5,6,7}, {'a', 'b', 'b', 'd','e'}, mtes=1)"
+
pausing
+
[[Image:pplot_tutorial9.png|500px]]
+
1 data element, 1 label, no color specified, auto loop through colors and index label 'a'
+
"pplot({array}, {'a'}, mtes=1)"
+
pausing
+
[[Image:pplot_tutorial10.png|500px]]
+
3 data elements, no color specified, auto loop through colors and index labels 'a', 'xx', and 'yy'
+
  "pplot({array,xx, yy}, {'a','xx', 'yy'}, mtes=1)"
+
pausing
+
[[Image:pplot_tutorial11.png|500px]]
+
3 data elements, colors WERE specified, one color for each and 1 label for 'a', 'xx', 'yy'
+
"pplot({array,xx, yy}, {1,2,3}, {'a','xx', 'yy'}, mtes=1)"
+
pausing
+
[[Image:pplot_tutorial12.png|500px]]
+
ASU spectral structure example
+
"pplot(spec_struc)"
+
pausing
+
[[Image:pplot_tutorial13.png|500px]]
+
data in x and y case
+
Case of 3 data elements in x and 3 in y
+
"pplot({a, a+1, a+2, ay+3, ay+4, ay+5})"
+
pausing
+
[[Image:pplot_tutorial14.png|500px]]
+
**** Now I'll demonstrate the more specific functions ***********
+
 
   
 
   
  Plot title, key location, mini-TES and emissivity default
+
  [[Image:pplot2_tutorial2.png|500px]]
  "pplot({array, xx}, {1,4}, {'Mini-TES 1','Mini-TES 2'}, plot_title='My Plot', key = 'right bottom', mtes=1, emiss=1)"
+
 
  pausing
+
3. Next simplest case: 1 array, user-input x-axis, no colors, no labels - will cycle colors automatically
[[Image:pplot_tutorial15.png|500px]]
+
dv> pplot(lab_array, xaxis=xlab1)
Specific key location, Wavenumber on bottom x axis, date
+
  "pplot({array, xx}, {1,4}, {'Mini-TES 1','Mini-TES 2'}, plot_title='My Plot', key = '900, .9', mtes=1, emiss=1, cm=1, date=1)"
+
[[Image:pplot2_tutorial3.png|500px]]
  pausing
+
 
[[Image:pplot_tutorial16.png|500px]]
+
4. Array of spectra, 1 color (for all), 1 label, x and y axis labels, key in specfic location  Note: Order doesn't matter for colors and labels)
TES default plot, wavelength on bottom x axis, ps, pdf
+
  dv> pplot(lab_array, 'Lab Spectra', 5, xaxis=xlab1, xlabel = 'Wavenumber', ylabel = 'Emissivity', key= '1400, .91')
  "pplot({etes[1:3,1]}, {'TES 1'}, key = '900, .9', tes=1, emiss=1, wave=1, ps='./junk.ps', pdf=1)"
+
 +
[[Image:pplot2_tutorial4.png|500px]]
 +
 
 +
5. Array of spectra, 1 color (for all), 1 label, standardized lab plot
 +
dv> pplot(lab_array, 5, 'Lab Spectra', lab1=1)
 +
...............................................................................
 +
 +
[[Image:pplot2_tutorial5.png|500px]]
 +
 
 +
6. 1 array, 1 label, no colors specified - will auto cycle through colors and add index to label.  Key in bottom right.  Standard Mini-TES plot
 +
dv> pplot(array, 'Mini-TES Array', key = 'bottom right', mtes=1)
 +
 +
[[Image:pplot2_tutorial6.png|500px]]
 +
 
 +
7. 2 different data elements with different x axes. x, y limits,  manually make lower x-axis wavelength but linear in cm-1. The x-axis is in wavenumber, but want a plot that is in wavelength on the lower axis. line weight 5, font_size 26, x-axis, y-axis, and plot labels
 +
dv> pplot({asudata[1:2], asterdata[1:2]}, xaxis={xlab1, xastercm}, {'Lab', 'ASTER'}, key = 'outside', \
 +
wave=1, x1=500, x2=1500,  y1=.7, y2=1.05, lw = 5, font_size=26, xlabel='Wavenumber', \
 +
ylabel='Emissivity', plot_title = 'Lab and ASTER Example')
 +
   
 +
[[Image:pplot2_tutorial7.png|500px]]
 +
 
 +
8. 2 data elements (1 array & 1 vector), 2 colors, 2 labels - single color and single label for each data element
 +
  dv> pplot({array, avg(array, xy)}, {1,2}, {'Spectra', 'Ave. Spectrum'}, xaxis=xmtes, x1=500, \
 +
x2=1800, y1=.7, y2=1.02, cm=1)
 +
 +
[[Image:pplot2_tutorial8.png|500px]]
 +
 
 +
9. ASU spectral structure example
 +
dv> pplot(spec_struc)
 +
 +
[[Image:pplot2_tutorial9.png|500px]]
 +
 
 +
10. Resample example - lab, mtes, tes, and themis spectra
 +
dv> pplot({asu.data[1], a1, t1, th1},{1,2,3,4}, {'Lab','ASTER', 'TIMS', 'THEMIS'}, key='1450,.96', \
 +
xaxis={xlab1, xacm, xtcm, xthcm}, x1=500, x2=1800, y1=.88, y2=1.01)
 +
  doing broadband
 +
.........................................................
 +
doing broadband
 +
.........................................................
 +
doing broadband
 +
.........................................................
 +
 +
[[Image:pplot2_tutorial10.png|500px]]
 +
 
 +
11. write to ps and pdf files. TES default plot, wavenumber on bottom x axis, ps, pdf
 +
  dv> pplot({tes_emiss[1:3,1]}, {'TES Array'}, key = '900, .9', tes=1, emiss=1, cm=1, \
 +
ps=$TMPDIR+"/junk.ps", pdf=1)
 
  Outputting postscript to file: ./junk.ps
 
  Outputting postscript to file: ./junk.ps
  Wavelength on the bottom
+
  Wavelength on the top
 
  converting to pdf file ./junk.ps.pdf
 
  converting to pdf file ./junk.ps.pdf
 
  Using postscript line colors from file: /u/cedwards/.Xdefaults
 
  Using postscript line colors from file: /u/cedwards/.Xdefaults
  pausing
+
   
[[Image:pplot_tutorial17.png|500px]]
+
[[Image:pplot2_tutorial11.png|500px]]
THEMIS default plot, wavelength on bottom x axis
+
 
  "pplot(emthemis_cube, 'THEMIS', key = '1100, .96', themis=1, emiss=1)"
+
'''Now I'll demonstrate the more esoteric functions and features'''
  pausing
+
 
[[Image:pplot_tutorial18.png|500px]]
+
3 vectors, 3 labels, no colors - will auto cycle through colors
Resample example - lab, mtes, tes, and themis spectra
+
  dv> pplot({a,b,c}, {'V1', 'V2', 'V3'}, mtes=1)
  "pplot({labdata1, ave_mtes, ave_tes, emthemis},{1,2,3,4}, {'Lab','Mini-TES','TES','THEMIS'}, \
+
  key='900,.85', xaxis={xlab1, xmtes, xtes,  xthemis}, emiss=1, y1=.75)"
+
[[Image:pplot2_tutorial12.png|500px]]
  pausing
+
 
[[Image:pplot_tutorial19.png|500px]]
+
2 data elements, 2 colors, 2 labels in structures - single color and single label for each data element
|
+
dv> plot({array, xx}, {1,2}, {'a', 'b'}, mtes=1)
 +
 +
[[Image:pplot2_tutorial13.png|500px]]
 +
 
 +
Just 1 data element with 4 vectors in x, 4 labels, 4 colors
 +
dv> pplot(array[1:4, 1], {1,3,5,6}, {'a', 'b', 'b', 'd'}, mtes=1)
 +
   
 +
[[Image:pplot2_tutorial14.png|500px]]
 +
 
 +
3 data elements, colors WERE specified, one color for each and 1 label for 'a', 'xx', 'yy'
 +
  dv> pplot({array,xx, yy}, {1,3,7}, {'a','xx', 'yy'}, mtes=1)
 +
 +
[[Image:pplot2_tutorial15.png|500px]]
 +
 
 +
THEMIS default plot, wavelength on bottom x axis
 +
  dv> pplot(emthemis_cube, 'THEMIS', key = '1100, .96', themis=1, emiss=1)
 +
   
 +
[[Image:pplot2_tutorial16.png|500px]]
 
|
 
|
 
*[[pplot]]
 
*[[pplot]]
 
*[[make_band]]
 
*[[make_band]]
*[[HasValue]]
+
*[[i2i]]
*[[add_struct]]
+
*[[read]]
*[[dim]]
+
 
|
 
|
 +
*[[pplot]]
 
*[[plot]]
 
*[[plot]]
*[[vplot]]
 
 
*[[xplot]]
 
*[[xplot]]
|
+
*[[triplot]]
*plot_tools.dvrc
+
|
+
1.04
+
 
}}
 
}}
[[category:Functions]]
+
[[category:Procedures]]
[[category:User Defined Functions]]
+
[[category:GnuPlot]]
+

Latest revision as of 18:04, 7 September 2010

Description

Run through a variety of pplot() cases. The commands can be run automatically by using pplot_tutorial().

Procedure

Setup all the data we need...lots of output will be printed (but has been omitted here)

dv> xlab1 = make_band(lab1=1)
dv> xtes = make_band(tes=1)
dv> xmtes = make_band(mtes=1)
dv> xthemis = make_band(themis=1)
dv> xthemiscm = make_band(themis=1, cm=1)
dv> xastercm = make_band(aster=1, cm=1)
dv> xtimscm = make_band(tims=1, cm=1)

# mini-TES data
dv> minites_emiss = read($DV_EX+"/minites_cube.vicar")
dv> array=minites_emiss[8:11, 5:6]
dv> xx=array[1:4,1]
dv> yy=array[1,1:2]
dv> a=array[1,1]
dv> b=array[2,2]
dv> c=array[2,1]

# tes data
dv> tes_emiss = read($DV_EX+"/TES_emissivity_example.vic")

# lab data
dv> asu = read($DV_EX+"/ASU_minlib.hdf")
dv> spectrum = asu.data[1]
dv> lab_array = asu.data[1:5]
dv> spec_struc = read($DV_EX+"/lab_structure.hdf")

# make simulated aster data from lab - wavenumber x-axis
dv> asterdata = i2i(asu.data, from='lab1', to='aster', cm=1)
# make simulated tims data from lab - wavenumber x-axis
dv> timsdata = i2i(asu.data, from='lab1', to='tims', cm=1)
# make simulated aster data from lab - wavelength x-axis
dv> asterdata = i2i(asu.data, from='lab1', to='aster')

# make some simulated themis data - wavelength x-axis
dv> emthemis_cube = i2i(asu.data[1:3], from = 'lab1', to='themis')

# convert lab1 data to aster, tims, and themis with wavenumber x-axis
dv> a1 = i2i(asu.data[1], from='lab1', to='aster', cm=1)
dv> t1 = i2i(asu.data[1], from='lab1', to='tims', cm=1)
dv> th1 = i2i(asu.data[1], from='lab1', to='themis', cm=1)

Each image corresponds to the listed command

Simplest possible case: 1 vector, no colors, no labels - like xplot

dv> pplot(spectrum)

pplot2 tutorial1.png

2. Simple case: 1 vector with user-input x-axis, no colors, no labels

dv> pplot(spectrum, xaxis=xlab1)

pplot2 tutorial2.png

3. Next simplest case: 1 array, user-input x-axis, no colors, no labels - will cycle colors automatically

dv> pplot(lab_array, xaxis=xlab1)

pplot2 tutorial3.png

4. Array of spectra, 1 color (for all), 1 label, x and y axis labels, key in specfic location Note: Order doesn't matter for colors and labels)

dv> pplot(lab_array, 'Lab Spectra', 5, xaxis=xlab1, xlabel = 'Wavenumber', ylabel = 'Emissivity', key= '1400, .91')

pplot2 tutorial4.png

5. Array of spectra, 1 color (for all), 1 label, standardized lab plot

dv> pplot(lab_array, 5, 'Lab Spectra', lab1=1)
...............................................................................

pplot2 tutorial5.png

6. 1 array, 1 label, no colors specified - will auto cycle through colors and add index to label. Key in bottom right. Standard Mini-TES plot

dv> pplot(array, 'Mini-TES Array', key = 'bottom right', mtes=1)

pplot2 tutorial6.png

7. 2 different data elements with different x axes. x, y limits, manually make lower x-axis wavelength but linear in cm-1. The x-axis is in wavenumber, but want a plot that is in wavelength on the lower axis. line weight 5, font_size 26, x-axis, y-axis, and plot labels

dv> pplot({asudata[1:2], asterdata[1:2]}, xaxis={xlab1, xastercm}, {'Lab', 'ASTER'}, key = 'outside', \
wave=1, x1=500, x2=1500,  y1=.7, y2=1.05, lw = 5, font_size=26, xlabel='Wavenumber', \
ylabel='Emissivity', plot_title = 'Lab and ASTER Example')

pplot2 tutorial7.png

8. 2 data elements (1 array & 1 vector), 2 colors, 2 labels - single color and single label for each data element

dv> pplot({array, avg(array, xy)}, {1,2}, {'Spectra', 'Ave. Spectrum'}, xaxis=xmtes, x1=500, \
x2=1800, y1=.7, y2=1.02, cm=1)

pplot2 tutorial8.png

9. ASU spectral structure example

dv> pplot(spec_struc)

pplot2 tutorial9.png

10. Resample example - lab, mtes, tes, and themis spectra

dv> pplot({asu.data[1], a1, t1, th1},{1,2,3,4}, {'Lab','ASTER', 'TIMS', 'THEMIS'}, key='1450,.96', \
xaxis={xlab1, xacm, xtcm, xthcm}, x1=500,  x2=1800, y1=.88, y2=1.01)
doing broadband
.........................................................
doing broadband
.........................................................
doing broadband
.........................................................

pplot2 tutorial10.png

11. write to ps and pdf files. TES default plot, wavenumber on bottom x axis, ps, pdf

dv> pplot({tes_emiss[1:3,1]}, {'TES Array'}, key = '900, .9', tes=1, emiss=1, cm=1, \
ps=$TMPDIR+"/junk.ps", pdf=1)
Outputting postscript to file: ./junk.ps
Wavelength on the top
converting to pdf file ./junk.ps.pdf
Using postscript line colors from file: /u/cedwards/.Xdefaults

pplot2 tutorial11.png

Now I'll demonstrate the more esoteric functions and features

3 vectors, 3 labels, no colors - will auto cycle through colors

dv> pplot({a,b,c}, {'V1', 'V2', 'V3'}, mtes=1)

pplot2 tutorial12.png

2 data elements, 2 colors, 2 labels in structures - single color and single label for each data element

dv> plot({array, xx}, {1,2}, {'a', 'b'}, mtes=1)

pplot2 tutorial13.png

Just 1 data element with 4 vectors in x, 4 labels, 4 colors

dv> pplot(array[1:4, 1], {1,3,5,6}, {'a', 'b', 'b', 'd'}, mtes=1)

pplot2 tutorial14.png

3 data elements, colors WERE specified, one color for each and 1 label for 'a', 'xx', 'yy'

dv> pplot({array,xx, yy}, {1,3,7}, {'a','xx', 'yy'}, mtes=1)

pplot2 tutorial15.png

THEMIS default plot, wavelength on bottom x axis

dv> pplot(emthemis_cube, 'THEMIS', key = '1100, .96', themis=1, emiss=1)

pplot2 tutorial16.png

DavinciWiki Mini-Nav Bar

Contents


Contact Developers

  • davinci-dev [AT] mars.asu.edu

All other topics

  • See navigation on the left

Functions Used

Related Procedures

Personal tools