Plotting Spectra with pplot

From DavinciWiki
(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
{{DavinciWiki_Function|
+
{{DavinciWiki_Procedure|
 
Run through a variety of [[pplot|pplot()]] cases.
 
Run through a variety of [[pplot|pplot()]] cases.
 
|
 
|
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()
+
|
+
Each image corresponds to the listed command.
+
dv> pplot_tutorial()
+
........../themis/lib/dav_lib/examples/minites_cube.vicar: VICAR bip image: 21x10x167, 32 bits
+
./themis/lib/dav_lib/examples/minites_spectrum.vicar: VICAR bip image: 1x1x167, 32 bits
+
..........................................................
+
/themis/lib/dav_lib/examples/TES_emissivity_example.vic: VICAR bsq image: 40x1x143, 64 bits
+
data: 225x1x923 array of float, bsq format [830,700 bytes]
+
label: Text Buffer with 225 lines of text
+
    1: Andesine BUR-240 1
+
    2: Spodumene HS-210.4B 2
+
    3: Magnesiohastingsite HS-115.4B 3
+
    4: Wollastonite WAR-8884 4
+
    5: Albite WAR-0244 5
+
    6: Bronzite BUR-1920 6
+
    7: Pyroxmangite WAR-6894 7
+
    8: Forsterite BUR-3720A 8
+
    9: reject
+
    10: reject
+
xaxis: 1x1x923 array of float, bsq format [3,692 bytes]
+
........................................................
+
/themis/lib/dav_lib/examples/asudata.vicar: VICAR bsq image: 225x1x923, 32 bits
+
.......................................................
+
/themis/lib/dav_lib/examples/spectra_cube.vicar: VICAR bsq image: 10x1x923, 32 bits
+
data: 7x1x923 array of float, bsq format [25,844 bytes]
+
label: Text Buffer with 7 lines of text
+
    1: Andesine BUR-240 1
+
    2: Spodumene HS-210.4B 2
+
    3: Magnesiohastingsite HS-115.4B 3
+
    4: Wollastonite WAR-8884 4
+
    5: Albite WAR-0244 5
+
    6: Bronzite BUR-1920 6
+
    7: Pyroxmangite WAR-6894 7
+
xaxis: 1x1x923 array of float, bsq format [3,692 bytes]
+
doing broadband
+
...............................................................................
+
/themis/lib/dav_lib/library/script_files/instrument_parameters/aster_ir_spectral_response_cm.vic: VICAR bsq image: 6x1x401, 32 bits
+
doing broadband
+
...............................................................................
+
/themis/lib/dav_lib/library/script_files/instrument_parameters/tims_ir_spectral_response_avg_cm.vic: VICAR bsq image: 7x1x158, 64 bits
+
doing broadband
+
...............................................................................
+
/themis/lib/dav_lib/library/script_files/instrument_parameters/aster_ir_spectral_response_cm.vic: VICAR bsq image: 6x1x401, 32 bits
+
  
1. Simplest possible case: 1 vector, no colors, no labels - like xplot
+
Simplest possible case: 1 vector, no colors, no labels - like xplot
  "pplot(spectrum)"
+
  dv> pplot(spectrum)
  pausing
+
   
[[Image:pplot2_tutorial1.png|500px]]
+
[[Image:pplot2_tutorial1.png|500px]]
  
2. Simple case: 1 vector with user-input x-axis, no colors, no labels
+
2. Simple case: 1 vector with user-input x-axis, no colors, no labels
  "pplot(spectrum, xaxis=xlab1)"
+
  pplot(spectrum, xaxis=xlab1)
  pausing
+
   
[[Image:pplot2_tutorial2.png|500px]]
+
[[Image:pplot2_tutorial2.png|500px]]
  
3. Next simplest case: 1 array, user-input x-axis, no colors, no labels
+
3. Next simplest case: 1 array, user-input x-axis, no colors, no labels - will cycle colors automatically
    - will cycle colors automatically
+
  pplot(lab_array, xaxis=xlab1)
  "pplot(lab_array, xaxis=xlab1)"
+
   
  pausing
+
[[Image:pplot2_tutorial3.png|500px]]
[[Image:pplot2_tutorial3.png|500px]]
+
  
4. Array of spectra, 1 color (for all), 1 label, x and y axis labels, key in specfic location
+
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)
    Note: Order doesn't matter for colors and labels)
+
  pplot(lab_array, 'Lab Spectra', 5, xaxis=xlab1, xlabel = 'Wavenumber', ylabel = 'Emissivity', key= '1400, .91')
  "pplot(lab_array, 'Lab Spectra', 5, xaxis=xlab1, xlabel = 'Wavenumber', ylabel = 'Emissivity', key= '1400, .91')"
+
   
  pausing
+
[[Image:pplot2_tutorial4.png|500px]]
[[Image:pplot2_tutorial4.png|500px]]
+
  
5. Array of spectra, 1 color (for all), 1 label, standardized lab plot
+
5. Array of spectra, 1 color (for all), 1 label, standardized lab plot
  "pplot(lab_array, 5, 'Lab Spectra', lab1=1)"
+
  pplot(lab_array, 5, 'Lab Spectra', lab1=1)
 
  ...............................................................................
 
  ...............................................................................
  pausing
+
   
[[Image:pplot2_tutorial5.png|500px]]
+
[[Image:pplot2_tutorial5.png|500px]]
  
6. 1 array, 1 label, no colors specified - will auto cycle through colors and add index to label.
+
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
  Key in bottom right.  Standard Mini-TES plot
+
  pplot(array, 'Mini-TES Array', key = 'bottom right', mtes=1)
  "pplot(array, 'Mini-TES Array', key = 'bottom right', mtes=1)"
+
pausing
+
[[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
+
 
   
 
   
  "pplot({asudata[1:2], asterdata[1:2]}, xaxis={xlab1, xastercm}, {'Lab', 'ASTER'}, key = 'outside', \
+
  [[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
 +
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', \
 
  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')"
+
  ylabel='Emissivity', plot_title = 'Lab and ASTER Example')
  pausing
+
   
[[Image:pplot2_tutorial7.png|500px]]
+
[[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
+
8. 2 data elements (1 array & 1 vector), 2 colors, 2 labels - single color and single label for each data element
  "pplot({array, avg(array, xy)}, {1,2}, {'Spectra', 'Ave. Spectrum'}, xaxis=xmtes, x1=500, \
+
  pplot({array, avg(array, xy)}, {1,2}, {'Spectra', 'Ave. Spectrum'}, xaxis=xmtes, x1=500, \
  x2=1800, y1=.7, y2=1.02, cm=1)"
+
  x2=1800, y1=.7, y2=1.02, cm=1)
  pausing
+
   
[[Image:pplot2_tutorial8.png|500px]]
+
[[Image:pplot2_tutorial8.png|500px]]
  
9. ASU spectral structure example
+
9. ASU spectral structure example
  "pplot(spec_struc)"
+
  pplot(spec_struc)
  pausing
+
   
[[Image:pplot2_tutorial9.png|500px]]
+
[[Image:pplot2_tutorial9.png|500px]]
  
10. Resample example - lab, mtes, tes, and themis spectra
+
10. Resample example - lab, mtes, tes, and themis spectra
 
  doing broadband
 
  doing broadband
 
  .........................................................
 
  .........................................................
Line 114: Line 102:
 
  doing broadband
 
  doing broadband
 
  .........................................................
 
  .........................................................
  "pplot({asu.data[1], a1, t1, th1},{1,2,3,4}, {'Lab','ASTER', 'TIMS', 'THEMIS'}, key='1450,.96', \
+
  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)"
+
  xaxis={xlab1, xacm, xtcm, xthcm}, x1=500,  x2=1800, y1=.88, y2=1.01)
  pausing
+
   
[[Image:pplot2_tutorial10.png|500px]]
+
[[Image:pplot2_tutorial10.png|500px]]
  
11. write to ps and pdf files. TES default plot, wavenumber on bottom x axis, ps, pdf
+
11. write to ps and pdf files. TES default plot, wavenumber on bottom x axis, ps, pdf
  "pplot({tes_emiss[1:3,1]}, {'TES Array'}, key = '900, .9', tes=1, emiss=1, cm=1, \
+
  pplot({tes_emiss[1:3,1]}, {'TES Array'}, key = '900, .9', tes=1, emiss=1, cm=1, \
  ps=$TMPDIR+"/junk.ps", pdf=1)"
+
  ps=$TMPDIR+"/junk.ps", pdf=1)
 
  Outputting postscript to file: ./junk.ps
 
  Outputting postscript to file: ./junk.ps
 
  Wavelength on the top
 
  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:pplot2_tutorial11.png|500px]]
+
[[Image:pplot2_tutorial11.png|500px]]
  
Now I'll demonstrate the more esoteric functions and features
+
'''Now I'll demonstrate the more esoteric functions and features'''
3 vectors, 3 labels, no colors - will auto cycle through colors
+
"pplot({a,b,c}, {'V1', 'V2', 'V3'}, mtes=1)"
+
pausing
+
[[Image:pplot2_tutorial12.png|500px]]
+
  
2 data elements, 2 colors, 2 labels in structures - single color and single label for each data element
+
3 vectors, 3 labels, no colors - will auto cycle through colors
  "pplot({array, xx}, {1,2}, {'a', 'b'}, mtes=1)"
+
  pplot({a,b,c}, {'V1', 'V2', 'V3'}, mtes=1)
  pausing
+
   
[[Image:pplot2_tutorial13.png|500px]]
+
[[Image:pplot2_tutorial12.png|500px]]
  
Just 1 data element with 4 vectors in x, 4 labels, 4 colors
+
2 data elements, 2 colors, 2 labels in structures - single color and single label for each data element
  "pplot(array[1:4, 1], {1,3,5,6}, {'a', 'b', 'b', 'd'}, mtes=1)"
+
  plot({array, xx}, {1,2}, {'a', 'b'}, mtes=1)
  pausing
+
   
[[Image:pplot2_tutorial14.png|500px]]
+
[[Image:pplot2_tutorial13.png|500px]]
  
3 data elements, colors WERE specified, one color for each and 1 label for 'a', 'xx', 'yy'
+
Just 1 data element with 4 vectors in x, 4 labels, 4 colors
  "pplot({array,xx, yy}, {1,3,7}, {'a','xx', 'yy'}, mtes=1)"
+
  pplot(array[1:4, 1], {1,3,5,6}, {'a', 'b', 'b', 'd'}, mtes=1)
  pausing
+
   
[[Image:pplot2_tutorial15.png|500px]]
+
[[Image:pplot2_tutorial14.png|500px]]
  
  THEMIS default plot, wavelength on bottom x axis
+
3 data elements, colors WERE specified, one color for each and 1 label for 'a', 'xx', 'yy'
  "pplot(emthemis_cube, 'THEMIS', key = '1100, .96', themis=1, emiss=1)"
+
  pplot({array,xx, yy}, {1,3,7}, {'a','xx', 'yy'}, mtes=1)
  pausing
+
[[Image:pplot2_tutorial16.png|500px]]
+
[[Image:pplot2_tutorial15.png|500px]]
|
+
 
 +
THEMIS default plot, wavelength on bottom x axis
 +
  pplot(emthemis_cube, 'THEMIS', key = '1100, .96', themis=1, emiss=1)
 +
   
 +
[[Image:pplot2_tutorial16.png|500px]]
 
|
 
|
 
*[[pplot]]
 
*[[pplot]]
Line 166: Line 154:
 
*[[xplot]]
 
*[[xplot]]
 
*[[triplot]]
 
*[[triplot]]
|
 
*plot_tools.dvrc
 
|
 
1.04
 
 
}}
 
}}
[[category:Functions]]
+
[[category:Procedures]]
[[category:User Defined Functions]]
+
[[category:GnuPlot]]
+

Revision as of 16:29, 7 September 2010

Description

Run through a variety of pplot() cases.

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

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

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)

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

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

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

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

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

pplot(spec_struc)

pplot2 tutorial9.png

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

doing broadband
.........................................................
doing broadband
.........................................................
doing broadband
.........................................................
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)

pplot2 tutorial10.png

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

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

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

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

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'

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

pplot2 tutorial15.png

THEMIS default plot, wavelength on bottom x axis

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