Differences

This shows you the differences between two versions of the page.

Link to this comparison view

documentation:language_reference:objects:spectra:methods:multiplybyenergy [2016/09/29 10:53] – created Maurits W. Haverkortdocumentation:language_reference:objects:spectra:methods:multiplybyenergy [2016/10/10 09:41] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== MultiplyByEnergy ======
  
 +###
 +If //G// is a spectra object then //G.MultiplyByEnergy()// Multiplies a spectrum //G($\omega$)// by its energy, i.e. //G<sub>new</sub>($\omega$) = $\omega\times$G($\omega$)//. //G.MultiplyByEnergy// is similar to the function [[documentation:language_reference:objects:spectra:functions:multiplybyenergy|Spectra.MultiplyByEnergy]] with the difference that it does not make a copy of the spectra object.
 +###
 +
 +===== Example =====
 +
 +###
 +Take the spectrum defined in the file [[documentation:language_reference:objects:spectra:start|definitions.Quanty]] and multiply it with its energy.
 +###
 +
 +==== Input ====
 +
 +<code Quanty Example.Quanty>
 +dofile("definitions.Quanty")
 + 
 +G.Print({{"file","Spectra.dat"}})
 +G.MultiplyByEnergy()
 +G.Print({{"file","Spectra.MultiplyByEnergy.dat"}})
 + 
 + 
 +gnuplotScript = gnuplotHead .. [[
 +set output "Spectra.MultiplyByEnergy.ps"
 +plot "Spectra.dat"  using 1:(-$3  ) title 'T1' with lines ls  1,\
 +     "Spectra.MultiplyByEnergy.dat"  using 1:(-$3) title 'T1 * Energy' with lines ls  2
 +]]
 + 
 +file = io.open("Spectra.MultiplyByEnergy.gnuplot", "w")
 +file:write(gnuplotScript)
 +file:close()
 + 
 +os.execute("gnuplot Spectra.MultiplyByEnergy.gnuplot")
 +os.execute("convert -density 1024 Spectra.MultiplyByEnergy.ps -resize 1024 Spectra.MultiplyByEnergy.png")
 +</code>
 +
 +==== Result ====
 +The resulting picture is:
 +
 +{{:documentation:language_reference:objects:spectra:methods:spectra.multiplybyenergy.png?nolink |}}
 +
 +
 +===== Available functions =====
 +{{indexmenu>../functions/#1}}
 +
 +===== Available methods =====
 +{{indexmenu>.#1}}
Print/export