Best Python code snippet using keyboard
TrackCombiner.py
Source:TrackCombiner.py
1import FWCore.ParameterSet.Config as cms2 3process = cms.Process("Mpl")4### standard MessageLoggerConfiguration5process.load("FWCore.MessageService.MessageLogger_cfi")6### Standard Configurations7process.load("Configuration.StandardSequences.Services_cff")8process.load('Configuration/StandardSequences/GeometryIdeal_cff')9process.load('Configuration/StandardSequences/Reconstruction_cff')10process.load('Configuration/StandardSequences/MagneticField_AutoFromDBCurrent_cff')11 12## Fitter-smoother: loosen outlier rejection as for first data-taking with LHC "collisions"13process.KFFittingSmootherWithOutliersRejectionAndRK.BreakTrajWith2ConsecutiveMissing = False14process.KFFittingSmootherWithOutliersRejectionAndRK.EstimateCut = 100015### Conditions16process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")17process.GlobalTag.globaltag = 'GR09_P_V6::All'18process.GlobalTag.globaltag = 'MC_53_V8::All'19### Track refitter specific stuff20process.load("RecoTracker.TrackProducer.TrackRefitters_cff") #the correct one21#process.load("RecoTracker.TrackProducer.RefitterWithMaterial_cff") #the one for backward compatibility22process.maxEvents = cms.untracked.PSet(23 input = cms.untracked.int32(-1)24)25process.source = cms.Source("PoolSource",26### tracks from collisions 27# fileNames = cms.untracked.vstring('rfio:/castor/cern.ch/user/c/chiochia/09_beam_commissioning/BSCskim_123151_Express.root') 28### reco mpl mc29 fileNames = cms.untracked.vstring('file:combiner.1000.root')30) 31#process.TRACKS = cms.OutputModule("PoolOutputModule",32# outputCommands = cms.untracked.vstring('drop *_*_*_*', 33# 'keep recoTracks_*_*_*',34# 'keep recoTrackExtras_*_*_*',35# 'keep TrackingRecHitsOwned_*_*_*'),36#37# fileName = cms.untracked.string('refitting.root')38# )39process.Combiner = cms.EDAnalyzer("TrackCombinerReco",40 Source=cms.string("generalTracks"),41 Output=cms.string("CombinedTracks.reco.1000.root"),42 Chi2Cut=cms.untracked.double(7.5),43 PtCut=cms.untracked.double(3.0),44 DeDxCut=cms.untracked.double(0),45 DefaultError=cms.untracked.double(0.05),46 ErrorFudge=cms.untracked.double(0.02)47)48process.refit_step = cms.Path(process.TrackRefitter)49process.combine_step = cms.Path(process.Combiner)50process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) )51process.p1 = cms.Schedule(process.refit_step,52 process.combine_step53 #process.TrackRefitterP554 #process.TrackRefitterBHM55)...
tree-recursion.py
Source:tree-recursion.py
...7 v1, v2 = t[coi[0]], t[coi[1]]8 t[coi[0]] = np.dot(v1, np.dot(W, v2))9 return t[co[-1][0]]10def theano_combine(t, co, W):11 def combine_step(coi, t, W):12 v1, v2 = t[coi[0]], t[coi[1]]13 res = T.dot(v1, T.dot(W, v2))14 t_new = T.set_subtensor(t[coi[0], :], res)15 return t_new16 outputs, updates = theano.scan(combine_step, sequences=[co], outputs_info=t, non_sequences=[W])17 result = outputs[-1][co[-1][0]]18 return result, updates19def test_numpy():20 tree = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1], [1, 1, 0], [0, 1, 1]], dtype=np.float32)21 combination_order = [[1, 2], [0, 1], [3, 4], [0, 3]]22 W_init = np.ones((3, 3, 3), dtype=np.float32)23 numpy_result = numpy_combine(tree, combination_order, W_init)24 print("numpy result: {}".format(numpy_result))25def test_theano():...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!