Beispiel #1
0
events = ntc.createNTuple(full_path, hdus[1])

print "Names of the columns"
labels = events.getLabels()
print labels

from hippo import Display

#
# Create the  displays.
#

hist = Display("Histogram", events, ("energy",))
hist.setLog("x", True)
hist.setLog("y", True)
canvas.addDisplay(hist)

color = Display("Color Plot", events, ("GLON", "GLAT"))
color.setRange("z", 0.5, 150.0)
color.setLog("z", True)
canvas.addDisplay(color)

contour = Display("Contour Plot", events, ("time", "GLON"))
canvas.addDisplay(contour)

profile = Display("Profile", events, ("time", "energy"))
canvas.addDisplay(profile)

print "Created the plots shown on the HippoDraw main page."
 @author Paul F. Kunz <*****@*****.**>

"""
import random
from time import sleep

from load_hippo import app, canvas

from hippo import Display, NTuple, NTupleController

# Create static histogram and add it to canvas.
sthist = Display ( "Static Histogram" )
sthist.setTitle ( "Gaussian Distribution (static hist)" )
sthist.setLabel ( 'x', 'X' )
sthist.setRange ( 'x', 0, 100)
sthist.setBinWidth ( 'x', 1. )
canvas.addDisplay ( sthist )

# Create second static histogram and add it to canvas
sthists = Display ( "Static Histogram" )
sthists.setTitle ( "Gaussian Distribution (low statistics)" )
sthists.setLabel ( 'x', 'X' )
sthists.setRange ( 'x', 0, 100)
sthists.setBinWidth ( 'x', 1. )
canvas.addDisplay ( sthists )

# Create empty NTuple and set the column label.
# Setting the column labels sets the number of columns
ntuple = NTuple ( )
ntuple.setTitle ( 'Gaussian Distribution' )
Beispiel #3
0
events = ntc.createNTuple(full_path, hdus[1])

print "Names of the columns"
labels = events.getLabels()
print labels

from hippo import Display

#
# Create the  displays.
#

hist = Display("Histogram", events, ('energy', ))
hist.setLog('x', True)
hist.setLog('y', True)
canvas.addDisplay(hist)

color = Display("Color Plot", events, ('GLON', 'GLAT'))
color.setRange('z', 0.5, 150.)
color.setLog('z', True)
canvas.addDisplay(color)

contour = Display("Contour Plot", events, ('time', 'GLON'))
canvas.addDisplay(contour)

profile = Display("Profile", events, ('time', 'energy'))
canvas.addDisplay(profile)

print "Created the plots shown on the HippoDraw main page."
Beispiel #4
0
#
# If GemConditionsWord == 7., then fill element with `nbrTkrTriggered',
# otherwise with -1
#
daSvac [ label_TowerTkrTrigGemCond ] = \
       numarray.choose ( t, ( nbrTkrTriggered, -1 ) )
daSvac [ label_TowerCalLeTrigGemCond ] = \
       numarray.choose ( t, ( nbrCalLeTriggered, -1 ) )
tend = time.time()
print "Took %f seconds create the 4 new columns with 500,000 rows each" % \
      (tend -tstart)
        
#
# The rest is standard procedure
#
tkrtrighist = Display ("Histogram", daSvac, (label_TkrTriggered,) )
canvas.addDisplay ( tkrtrighist )
tkrtrighist.setLog ( 'y', True)

calletrighist = Display ("Histogram", daSvac, (label_CalLeTriggered, ) )
canvas.addDisplay ( calletrighist )
calletrighist.setLog ( 'y', True)

tkrtrighist_gemcond = Display ( "Histogram", daSvac,
                                (label_TowerTkrTrigGemCond, ) )
canvas.addDisplay ( tkrtrighist_gemcond )
tkrtrighist_gemcond.setRange ( 'x', 0, 16)
tkrtrighist_gemcond.setLog ( 'y', True)
print tkrtrighist_gemcond.numberOfEntries()

Beispiel #5
0
canvas.addDisplay ( hist )

# Set the Y axis on log scale of better viewing
hist.setLog ( 'y', True )

# Add a cut from data in another column
from hippo import Cut
hits_cut = Cut ( ntuple, ('TkrTotalHits',) )
canvas.addDisplay ( hits_cut )
hits_cut.setLog ( 'y', True )

hits_cut.addTarget ( hist )
hits_cut.setCutRange ( 4, 110, 'x' )

# Change the range of the displayed data
hist.setRange ( 'x', 40, 700 )

# fit a function to the histogram
from hippo import Function
datarep = hist.getDataRep ()

exp1 = Function ( "Exponential", datarep )
exp1.addTo ( hist )

exp1.fit ()

# Print the results of the fit
pnames = exp1.parmNames ()
print pnames

parms = exp1.parameters ()