本文整理汇总了Python中Plotter.Plotter类的典型用法代码示例。如果您正苦于以下问题:Python Plotter类的具体用法?Python Plotter怎么用?Python Plotter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Plotter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: executeSimplePerceptron
def executeSimplePerceptron():
#fileParser = FileParser("./workspaceFacu/RedesNeuronales-TP1/src/OCR/input_and_or.txt") #open from arguments
fileParser = FileParser("./workspaceFacu/RedesNeuronales-TP1/src/OCR/input_ocr.txt") #open from arguments
#fileParser = FileParser('./workspaceFacu/RedesNeuronales-TP1/src/OCR/input_test.txt') #open from arguments
#fileParser = FileParser('./workspaceFacu/RedesNeuronales-TP1/src/OCR/input_test_with_testing_data.txt') #open from arguments
#fileParser = FileParser('./workspaceFacu/RedesNeuronales-TP1/src/OCR/input_test_with_same_testing_data.txt') #open from arguments
#fileParser = FileParser('./workspaceFacu/RedesNeuronales-TP1/src/OCR/input_martin.txt') #open from arguments
parameters = fileParser.parseInputFile()
#function = Exponential(0.5)
#function = Identity()
function = Sign()
VERBOSE = True
SHUFFLE_TRAINING_SET = True
neuralAlgorithm = SimplePerceptron(parameters, function, not SHUFFLE_TRAINING_SET, VERBOSE)
print 'ALGORITHM - Start'
neuralAlgorithm.train()
print 'ALGORITHM - Finish'
trainingInformation = neuralAlgorithm.getTrainingInformation()
errorFileName = './/..//graphics//error - ' + parameters.objective
validationFileName = './/..//graphics//validation - ' + parameters.objective
testingFileName = './/..//graphics//testing - ' + parameters.objective
SAVE_TO_FILE = True
SHOW = True
plotter = Plotter(errorFileName, validationFileName, testingFileName, not SAVE_TO_FILE)
plotter.plot(trainingInformation, SHOW)
示例2: calculate
def calculate(self, symbol=None):
quotes_list = symbol.get_EoD_quotes(
self.opts.get('fromdate'),
self.opts.get('todate')
)
self.price_list = quotes_list
Plotter.get_plot_buffer().append((self.name, self.price_list))
return self
示例3: visualizePredictions
def visualizePredictions(self, training_x, training_y, test_x, test_y):
#Input 1 or 2 D. Output 1 D.
assert (training_x.shape[1] == 1 or training_x.shape[1] == 2), \
"Invalid Dimensions for Plotting Results - Input: %d" %(training_x.shape[1])
plotter = Plotter()
plotter.plotPrediction(self, training_x, training_y, self.norm_test_x, self.norm_test_y)
plotter.plotExpertsPrediction(self, test_x, test_y)
plotter.plotExpertsCenters(self, training_x, training_y)
plotter.plotGaussians(self, training_x, training_y)
示例4: getSignalOverBackground
def getSignalOverBackground(analysis,region,period,cut,**kwargs):
doDataDriven = kwargs.pop('doDataDriven',True)
scalefactor = kwargs.pop('scalefactor','event.gen_weight*event.pu_weight*event.lep_scale*event.trig_scale')
nl = 3
sigMap = getSigMap(nl)
intLumiMap = getIntLumiMap()
mergeDict = getMergeDict(period)
channelBackground = getChannelBackgrounds(period)
channels, leptons = getChannels(nl)
saves = '%s_%s_%iTeV' % (analysis,region,period)
ntuples = getNtupleDirectory(analysis,region,period)
plotter = Plotter(region,ntupleDir=ntuples,saveDir=saves,period=period,rootName='plots_sOverB',mergeDict=mergeDict,scaleFactor=scalefactor,datadriven=doDataDriven)
plotter.initializeBackgroundSamples([sigMap[period][x] for x in channelBackground[region+'datadriven' if doDataDriven else region]])
plotter.initializeDataSamples([sigMap[period]['data']])
plotter.setIntLumi(intLumiMap[period])
sig = 0.
sigErr2 = 0.
bg = 0.
bgErr2 = 0.
for b in plotter.backgrounds:
val, err = plotter.getNumEntries(cut,b,doError=True)
if b=='WZJets':
sig += val
sigErr2 += err**2
else:
bg += val
bgErr2 += err**2
sigErr = sigErr2**0.5
bgErr = bgErr2**0.5
return sig/bg if bg else -1.
示例5: __init__
def __init__(self,image,plotfile,plotarea,shadescale):
Plotter.__init__(self,plotfile)
# set up
self.plotarea = plotarea
self.spacing = 5
self.image = image
self.scaleImage()
shadelevels = self.detectShades(shadescale)
print "auto leveled for ", shadescale, " to ", shadelevels
self.shades = { MODES.EW: (0,int(shadelevels[0])), #70
MODES.NS: (0,int(shadelevels[1])), #100
MODES.NWSE: (0,int(shadelevels[2])), #150
MODES.NESW: (0,int(shadelevels[3]))} #195
示例6: __init__
def __init__(self):
QtGui.QDialog.__init__(self)
self.setupUi(self)
self.datreader = DataReader()
self.Plotter = Plotter()
self.directory = os.getcwd()
self.WorkingD_label.setText(self.directory)
self.ShowFile_PB.clicked.connect(self.show_file_start) # shows first lines in the textbrowser
self.ReadSets_PB.clicked.connect(self.read_set) # reads all files that start with lineEdit and creates a dict in the Sets_Dict[set][file][column]
self.PlotFile_PB.clicked.connect(self.plotfile)
self.MAV_slider.valueChanged.connect(self.mav_valuechanged)
self.MAV_slider.sliderReleased.connect(self.mav_released)
self.LP_slider.sliderReleased.connect(self.lp)
self.LP_slider.valueChanged.connect(self.lp_valuechanged)
self.HP_slider.sliderReleased.connect(self.hp)
self.HP_slider.valueChanged.connect(self.hp_valuechanged)
#self.CutZeros.clicked.connect(self.cut_zeros_filedict)
self.PlotColumn_PB.clicked.connect(self.plotcolumn)
self.Clear_PB.clicked.connect(self.clear)
self.Export_PB.clicked.connect(self.export)
self.FFT_PB.clicked.connect(self.fft)
self.ReadLabBook.clicked.connect(self.readlabbook)
self.MAVEdit.returnPressed.connect(self.mav_released)
self.MVAREdit.returnPressed.connect(self.mvar)
self.MMMINEdit.returnPressed.connect(self.mmmin)
self.Corr_PB.clicked.connect(self.correlate)
self.Select_PB.clicked.connect(self.open_filedialog)
self.Pyro_PB.clicked.connect(self.read_pyro)
self.Log_PB.clicked.connect(self.log_scale)
self.Sets_Dict = dict() # contains [set1][file1][column1] - the data
self.Files_Dict = dict() # contains [filename 1]: 'set-filename'
self.Columns_Dict = dict() # contains[set-filename-column]: same
示例7: __init__
def __init__(self, parent):
'''
Constructor
'''
self.parent = parent
self.portfolioManager = PortfolioManager()
self.plotter = Plotter(parent)
示例8: getYieldsErrors
def getYieldsErrors(analysis,region,period,cut,**kwargs):
doDataDriven = kwargs.pop('doDataDriven',True)
scalefactor = kwargs.pop('scalefactor','event.gen_weight*event.pu_weight*event.lep_scale*event.trig_scale')
nl = 3
sigMap = getSigMap(nl)
intLumiMap = getIntLumiMap()
mergeDict = getMergeDict(period)
channelBackground = getChannelBackgrounds(period)
channels, leptons = getChannels(nl)
saves = '%s_%s_%iTeV' % (analysis,region,period)
ntuples = getNtupleDirectory(analysis,region,period)
plotter = Plotter(region,ntupleDir=ntuples,saveDir=saves,period=period,rootName='plots_statUnc',mergeDict=mergeDict,scaleFactor=scalefactor,datadriven=doDataDriven)
plotter.initializeBackgroundSamples([sigMap[period][x] for x in channelBackground[region+'datadriven' if doDataDriven else region]])
plotter.initializeDataSamples([sigMap[period]['data']])
plotter.setIntLumi(intLumiMap[period])
yields = {}
for chan in ['eee','eem','mme','mmm']:
yields[chan] = {}
chanCut = '{0} && channel=="{1}"'.format(cut,chan)
sig = 0.
sigErr2 = 0.
bg = 0.
bgErr2 = 0.
for b in plotter.backgrounds:
val, err = plotter.getNumEntries(chanCut,b,doError=True)
if b=='WZJets':
sig += val
sigErr2 += err**2
else:
bg += val
bgErr2 += err**2
sigErr = sigErr2**0.5
bgErr = bgErr2**0.5
data, dataErr = plotter.getDataEntries(chanCut,doError=True)
dataErr2 = dataErr**2
yields[chan]['sig'] = [sig, sigErr]
yields[chan]['bg'] = [bg, bgErr]
yields[chan]['data'] = [data, dataErr]
yields['wz'] = {}
for i in ['sig','bg','data']:
tot = sum([yields[chan][i][0] for chan in ['eee','eem','mme','mmm']])
totErr = sum([yields[chan][i][1]**2 for chan in ['eee','eem','mme','mmm']])**0.5
yields['wz'][i] = [tot, totErr]
return yields
示例9: main
def main():
plotter = Plotter("out.png", "The plot", "some", "thing", 10, 60)
plotter.addPlotItem("Source1", "#F01020", dataSource1)
plotter.addPlotItem("Source2", "#201020", dataSource2)
#plotter.begin()
stopEvent = threading.Event()
tweeter = TwitterPlotBot('api/app key', 'api/app secret',
'access key',
'access secret',
'#pause', '#resume', plotter, stopEvent, '@navin_bhaskar', 500, False)
time.sleep(120)
print "Plotting..."
tweeter.start()
time.sleep(1900)
print "Stopping it....."
stopEvent.set()
tweeter.join()
示例10: getBackgroundEstimation
def getBackgroundEstimation(analysis,region,period,cut,**kwargs):
doDataDriven = kwargs.pop('doDataDriven',True)
scalefactor = kwargs.pop('scalefactor','event.gen_weight*event.pu_weight*event.lep_scale*event.trig_scale')
nl = 3
sigMap = getSigMap(nl)
intLumiMap = getIntLumiMap()
mergeDict = getMergeDict(period)
channelBackground = getChannelBackgrounds(period)
channels, leptons = getChannels(nl)
saves = '%s_%s_%iTeV' % (analysis,region,period)
ntuples = getNtupleDirectory(analysis,region,period)
bgChannels = [sigMap[period][x] for x in channelBackground[region+'datadriven' if doDataDriven else region]]
plotter = Plotter(region,ntupleDir=ntuples,saveDir=saves,period=period,rootName='plots_bgEstimation',mergeDict=mergeDict,scaleFactor=scalefactor,datadriven=doDataDriven)
plotter.initializeBackgroundSamples(bgChannels)
plotter.initializeDataSamples([sigMap[period]['data']])
plotter.setIntLumi(intLumiMap[period])
estimates = {}
for chan in channels:
thisCut = '{0} && channel=="{1}"'.format(cut,chan)
estimates[chan] = {}
obs, obsErr = plotter.getDataEntries(thisCut,doError=True)
obsErr2 = obsErr**2
dd = 0.
ddErr2 = 0.
mc = 0.
mcErr2 = 0.
for bg in bgChannels + ['datadriven']:
val, err = plotter.getNumEntries(thisCut,bg,doError=True)
if bg in ['datadriven']:
dd += val
ddErr2 += err**2
else:
mc += val
mcErr2 += err**2
fromMC = [obs - mc, (obsErr2 + mcErr2)**0.5]
fromDD = [dd, ddErr2**0.5]
estimates[chan]['mc'] = fromMC
estimates[chan]['datadriven'] = fromDD
estimates['total'] = {}
estimates['total']['mc'] = [sum([estimates[x]['mc'][0] for x in channels]), sum([estimates[x]['mc'][1]**2 for x in channels])**0.5]
estimates['total']['datadriven'] = [sum([estimates[x]['datadriven'][0] for x in channels]), sum([estimates[x]['datadriven'][1]**2 for x in channels])**0.5]
return estimates
示例11: __init__
def __init__(self):
plott = Plotter()
QtGui.QMainWindow.__init__(self)
self.setWindowIcon(QtGui.QIcon('phyton.ico'))
self.setupUi(self)
self.fit = Fitter()
self.gen = Generator()
self.plot = Plotter()
self.fitted_args = []
self.chi2 = None
self.chi2Error = 0.5
示例12: __init__
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.plotHolder = Plotter()
self.layout = QtGui.QVBoxLayout()
self.data = 0
self.dataStr = 0
self.filePath = None
self.filePath2 = 0
self.setWindowTitle("FlightMadness")
self.setWindowIcon(QtGui.QIcon('phyton.ico'))
self.setupUi(self)
示例13: initialize
def initialize(self):
self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
self.setWidgetResizable(True)
self.widget = QtGui.QWidget()
self.setWidget(self.widget)
self.vbox = QtGui.QVBoxLayout()
self.vbox.setSpacing(15)
self.accel = Plotter('Beschleunigung', [-20, 20], 3, ['g', 'r', 'y'])
self.gyro = Plotter('Gyroskop', [-360, 360], 3, ['g', 'r', 'y'])
self.parser = Parser()
self.current_file = Testfile('')
self.vbox.addWidget(self.accel)
self.vbox.setAlignment(self.accel, QtCore.Qt.AlignTop)
self.vbox.addWidget(self.gyro)
self.vbox.setAlignment(self.gyro, QtCore.Qt.AlignTop)
self.vbox.addStretch()
self.widget.setLayout(self.vbox)
示例14: main
def main():
""" This is the enrty point for our application,
"TwitterBot" """
global plotter
plotter = Plotter(config.config["output file"], # The output file name
config.config["title"], # Title of the plot
config.config["xlabel"], # X axis label
config.config["ylabel"], # Y axis label
config.config["samples"], # Max number of samples to be taken
config.config["Log Interval"], # Log interval
)
# Now that we have the plotter, it is time to add items to it
for callback in CallBacks.callbacks:
plotter.addPlotItem(callback[0], callback[2], callback[1])
twitterBot = TwitterPlotBot(config.config["consumer key"],
config.config["consumer secret"],
config.config["access token"],
config.config["access token secret"],
config.config["stop plot cmd"],
config.config["resume plot cmd"],
plotter,
stopEvent,
config.config["screen id"],
config.config["Tweet Interval"],
False)
# Wait for some time until we have atleast one data point to plot
time.sleep(config.config["Log Interval"])
twitterBot.start()
while True:
pass
示例15: Plotter
'''
Created on 6 de abr de 2016
@author: manoe
'''
from Plotter import Plotter
if __name__ == '__main__':
p = Plotter([2,2], [-3,1])
print(p.valor(2))