 |
Show two reverse Gamma distributions with a shift
Source code name: "signal_gamma1.py"
Programming language: Python
Topic: Statistics/Descriptive
DMelt Version 1. Last modified: 09/26/2015. License: Pro
https://datamelt.org/code/cache/signal_gamma1_4936.py
To run this script using the DMelt IDE,
copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.
from java.awt import Color
from jhplot import *
from org.apache.commons.math3.distribution import GammaDistribution
def func(min,max):
logz=GammaDistribution(3,1)
f=P1D("Gamma")
step=(max-min)/1000.0
for i in range(200):
xx=min+step*i
x=min+5*step*i
f.add(x+15, -900*logz.density(xx) )
return f
def func1(min,max):
logz=GammaDistribution(3,1)
f=P1D("Gamma")
step=(max-min)/1000.0
for i in range(200):
xx=min+step*i
x=min+5*step*i
f.add(x+40, -1400*logz.density(xx) )
return f
c1 = HPlot('Gamma')
c1.visible();
c1.setRange(0.1,200,-500,10)
c1.setLegend(0)
c1.setMarginLeft(90)
c1.setNameX("Time [ns]")
c1.setNameY("mV")
# c1.setAutoRange()
p=func(0.1,200) # plot between 1 and 200
p.setStyle('l')
p.setPenWidth(4)
p.setColor(Color.blue)
c1.draw(p)
p1=func1(0.1,200) # plot between 1 and 200
p1.setStyle('l')
p1.setPenWidth(4)
p1.setColor(Color.red)
c1.draw(p1)
#c1.export("signal_gamma1.pdf")
#c1.export("signal_gamma1.png")
You see the box below because you did not login.