CMS 3D CMS Logo

Functions | Variables
tablePrinter Namespace Reference

Functions

def indent (rows, hasHeader=False, headerChar='-', delim='| ', justify='center', separateRows=False, prefix='', postfix='', wrapfunc=lambda x:x)
 

Variables

 data
 
 delim
 
 False
 
 hasHeader
 
 headerwidth
 
 labels
 
 lumidata
 
 lumifooter
 
 lumiheader
 
 postfix
 
 prefix
 
 rows
 
 separateRows
 
 True
 
 width
 
 wrapfunc
 

Function Documentation

def tablePrinter.indent (   rows,
  hasHeader = False,
  headerChar = '-',
  delim = ' | ',
  justify = 'center',
  separateRows = False,
  prefix = '',
  postfix = '',
  wrapfunc = lambda x:x 
)
Indents a table by column.
- rows: A sequence of sequences of items, one sequence per row.
- hadHeader: True if the first row consists of the column's names.
- headerChar: Character to be used for the row separator line
(if hasHeader==True or separateRows==True).
- delim: The column delimiter.
- justify: Determines how are data justified in their column.
Valid values are 'left','right','center'.
- separateRows: True if rows are to be separated by a line of 'headerChar's.
- prefix: A string prepended to each printed row.
- postfix: A string appended to each printed row.
- wrapfunc: A function f(text) for wrapping text; each element in the table is first wrapped by this function.

Definition at line 11 of file tablePrinter.py.

References genParticles_cff.map, SiStripPI.max, edm.print(), split, str, wrapfunc, and ComparisonHelper.zip().

11  separateRows=False,prefix='',postfix='',wrapfunc=lambda x:x):
12  """
13  Indents a table by column.
14  - rows: A sequence of sequences of items, one sequence per row.
15  - hadHeader: True if the first row consists of the column's names.
16  - headerChar: Character to be used for the row separator line
17  (if hasHeader==True or separateRows==True).
18  - delim: The column delimiter.
19  - justify: Determines how are data justified in their column.
20  Valid values are 'left','right','center'.
21  - separateRows: True if rows are to be separated by a line of 'headerChar's.
22  - prefix: A string prepended to each printed row.
23  - postfix: A string appended to each printed row.
24  - wrapfunc: A function f(text) for wrapping text; each element in the table is first wrapped by this function.
25  """
26  #nested function
27  #closure for breaking logical rows to physical, using wrapfunc
28  def rowWrapper(row):
29  newRows=[wrapfunc(item).split('\n') for item in row]
30  #print 'newRows: ',newRows
31  #print 'map result: ',map(None,*newRows)
32  #print 'rowwrapped: ',[[substr or '' for substr in item] for item in map(None,*newRows)]
33  return [[substr or '' for substr in item] for item in map(None,*newRows)]
34  # break each logical row into one or more physical ones
35  logicalRows = [rowWrapper(row) for row in rows]
36  # columns of physical rows
37  columns = map(None,*reduce(operator.add,logicalRows))
38  # get the maximum of each column by the string length of its items
39  maxWidths = [max([len(str(item)) for item in column]) for column in columns]
40  rowSeparator = headerChar * (len(prefix) + len(postfix) + sum(maxWidths) + len(delim)*(len(maxWidths)-1))
41  # select the appropriate justify method
42  justify = {'center':str.center,'right':str.rjust,'left':str.ljust}[justify.lower()]
43  output=cStringIO.StringIO()
44  if separateRows: print(rowSeparator, file=output)
45  for physicalRows in logicalRows:
46  for row in physicalRows:
47  print(prefix+delim.join([justify(str(item),width) for (item,width) in zip(row,maxWidths)])+postfix, file=output)
48  if separateRows or hasHeader: print(rowSeparator, file=output); hasHeader=False
49  return output.getvalue()
50 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
#define str(s)
double split
Definition: MVATrainer.cc:139

Variable Documentation

tablePrinter.data

Definition at line 54 of file tablePrinter.py.

tablePrinter.delim
tablePrinter.False

Definition at line 75 of file tablePrinter.py.

tablePrinter.hasHeader

Definition at line 61 of file tablePrinter.py.

tablePrinter.headerwidth

Definition at line 74 of file tablePrinter.py.

tablePrinter.labels

Definition at line 53 of file tablePrinter.py.

Referenced by BTagPerformanceAnalyzerOnData.analyze(), BTagPerformanceAnalyzerMC.analyze(), AlCaElectronsTest.analyze(), SiPixelHitEfficiencySource.analyze(), SiPixelTrackResidualSource.analyze(), HLTPrescaleRecorder.beginRun(), DigiInvestigatorHistogramMaker.book(), DigiVertexCorrHistogramMaker.book(), DigiVtxPosCorrHistogramMaker.book(), DigiPileupCorrHistogramMaker.book(), DigiLumiCorrHistogramMaker.book(), DigiBXCorrHistogramMaker< T >.book(), ecaldqm::MESetEcal.book(), cscdqm::Collection.book(), PSMonitor.bookHistograms(), pat::TauJetCorrFactors.correctionLabels(), pat::JetCorrFactors.correctionLabels(), pat::TauJetCorrFactors.correctionLabelString(), pat::JetCorrFactors.correctionLabelString(), HLTMuonValidator.dqmBeginRun(), HLTMuonOfflineAnalyzer.dqmBeginRun(), TriggerBxMonitor.dqmBeginRun(), TriggerRatesMonitor.dqmBeginRun(), HLTConfigData.dump(), HLTPrescaleRecorder.endRun(), TauDQMHistPlotter.endRun(), GenericTriggerEventFlag.expressionsFromDB(), HLTConfigData.extract(), TrackingNtuple.fillSeeds(), TrackingNtuple.fillTracks(), EcalSimpleUncalibRecHitFilter.filter(), EcalMIPRecHitFilter.filter(), ecaldqm::binning.formAxis(), hcaldqm::quantity::FEDQuantity.getLabels(), hcaldqm::quantity::CrateQuantity.getLabels(), hcaldqm::quantity::RunNumber.getLabels(), hcaldqm::quantity::EventType.getLabels(), hcaldqm::quantity.getLabels_Crate(), hcaldqm::quantity.getLabels_CrateuTCA(), hcaldqm::quantity.getLabels_CrateVME(), hcaldqm::quantity.getLabels_FED(), hcaldqm::quantity.getLabels_FEDuTCA(), hcaldqm::quantity.getLabels_FEDuTCASlot(), hcaldqm::quantity.getLabels_FEDVME(), hcaldqm::quantity.getLabels_FEDVMESpigot(), hcaldqm::quantity.getLabels_FiberCh(), hcaldqm::quantity.getLabels_FiberChuTCATP(), hcaldqm::quantity.getLabels_FiberuTCA(), hcaldqm::quantity.getLabels_FiberuTCAFiberCh(), hcaldqm::quantity.getLabels_FiberuTCATP(), hcaldqm::quantity.getLabels_FiberuTCATPFiberChuTCATP(), hcaldqm::quantity.getLabels_FiberVME(), hcaldqm::quantity.getLabels_FiberVMEFiberCh(), hcaldqm::quantity.getLabels_ieta(), hcaldqm::quantity.getLabels_SLB(), hcaldqm::quantity.getLabels_SLBCh(), hcaldqm::quantity.getLabels_SLBSLBCh(), hcaldqm::quantity.getLabels_SlotuTCA(), hcaldqm::quantity.getLabels_Subdet(), hcaldqm::quantity.getLabels_SubdetPM(), hcaldqm::quantity.getLabels_TTieta(), hcaldqm::quantity.getLabels_TTieta2x3(), hcaldqm::quantity.getLabels_TTSubdet(), hcaldqm::quantity.getLabels_TTSubdetPM(), edm::service::PrescaleService.getPrescaleTable(), Point.GetSigmaDeltaMu(), HCalSD.HCalSD(), edm::EDConsumerBase.labelsForToken(), rpcdqm::utils.labelYAxisRing(), main(), hitfit.make_constraint_intermed(), edm::PrincipalGetAdapter.makeFailToGetException(), TrackerHitAssociator.makeMaps(), PlotCombiner.makePlot(), TopSingleLeptonHLTValidation.monitorPath(), B2GHadronicHLTValidation.monitorPath(), B2GDoubleLeptonHLTValidation.monitorPath(), B2GSingleLeptonHLTValidation.monitorPath(), TopDiLeptonHLTValidation.monitorPath(), MultiplicityTimeCorrelations.MultiplicityTimeCorrelations(), MultiTrackValidator.MultiTrackValidator(), ecaldqm::binning::AxisSpecs.operator=(), PixelUpdateLines(), PlotPixelMultVtxPos(), FastTimerService.postBeginJob(), TrackListCombiner.produce(), TrackRefitter.produce(), HIPixelTrackFilterProducer.produce(), GenTrackMatcher.produce(), ReducedESRecHitCollectionProducer.produce(), HIProtoTrackFilterProducer.produce(), EcalEBTrigPrimProducer.produce(), ReducedRecHitCollectionProducer.produce(), EcalTrigPrimProducer.produce(), HITrackClusterRemover.produce(), L1GlobalTriggerRecordProducer.produce(), pat::TriggerObjectStandAlone.psetID(), TopSingleLepton_miniAOD::MonitorEnsemble.selectionPath(), SingleTopTChannelLepton_miniAOD::MonitorEnsemble.selectionPath(), HLTOfflineDQMTopSingleLepton::MonitorSingleLepton.selectionPath(), HLTOfflineDQMTopDiLepton::MonitorDiLepton.selectionPath(), SingleTopTChannelLepton::MonitorEnsemble.selectionPath(), TopSingleLepton::MonitorEnsemble.selectionPath(), TopDiLeptonOffline::MonitorEnsemble.selectionPath(), DTLocalTriggerTask.setQLabels(), DTLocalTriggerBaseTask.setQLabels(), DTLocalTriggerTask.setQLabelsTheta(), DTLocalTriggerBaseTask.setQLabelsTheta(), MVAJetTagPlotter.tagInfoRequirements(), TauDQMHistPlotter.TauDQMHistPlotter(), edm::PrincipalGetAdapter.throwAmbiguousException(), edm::EDConsumerBase.updateLookup(), MeasurementTrackerEventProducer.updatePhase2OT(), MeasurementTrackerEventProducer.updatePixels(), MeasurementTrackerEventProducer.updateStrips(), ecaldqm::binning::AxisSpecs.~AxisSpecs(), and DigiBXCorrHistogramMaker< EventWithHistory >.~DigiBXCorrHistogramMaker().

tablePrinter.lumidata
tablePrinter.lumifooter

Definition at line 76 of file tablePrinter.py.

tablePrinter.lumiheader

Definition at line 73 of file tablePrinter.py.

Referenced by lumi::Lumi2DB.retrieveData().

tablePrinter.postfix
tablePrinter.prefix

Definition at line 65 of file tablePrinter.py.

Referenced by MuonGeometrySanityCheck.analyze(), PrimaryVertexAnalyzer4PUSlimmed.bookHistograms(), DQMGenericTnPClient.calculateEfficiency(), PrimaryVertexAnalyzer4PUSlimmed.calculatePurityAndFillHistograms(), ChamberLocationSpec.chamberLocationName(), tensorflow::NTSession.CreateGraphs(), tensorflow::TBBSession.CreateGraphs(), GeneralHLTOffline.dqmBeginRun(), SusyPostProcessor.dqmEndJob(), MonitorElement.Fill(), SiPixelActionExecutor.fillFEDErrorSummary(), PrimaryVertexAnalyzer4PUSlimmed.fillGenAssociatedRecoVertexHistograms(), SiPixelActionExecutor.fillGrandBarrelSummaryHistos(), SiPixelActionExecutor.fillGrandEndcapSummaryHistos(), FastTimerServiceClient.fillPathSummaryPlots(), PrimaryVertexAnalyzer4PUSlimmed.fillResolutionAndPullHistograms(), SiPixelActionExecutor.fillSummary(), CondDBESSource.fillTagCollectionFromDB(), HcalLaserEventFilter.GetCMSSWVersion(), PhysicsTools::Calibration::VarProcessor.getInstanceName(), L1GtPsbSetupConfigOnlineProd.getRequiredValue(), FWTGeoRecoGeometryESProducer.GetTopHolder(), HcalRecHitsDQMClient.HcalRecHitsEndjob(), FillInfo.is25nsBunchSpacing(), LHCInfo.is25nsBunchSpacing(), cscdqm::Collection.load(), main(), TMultiDimFet.MakeRealCode(), dqm::DQMFileSaverOnline.makeSnapshot(), MTDTopologyMode.MTDStringToEnumParser(), MuonGeometrySanityCheck.MuonGeometrySanityCheck(), RawFile.open(), FRDStreamSource.openFile(), MonitorElement.packScalarData(), HcalLedAnalysis.ProcessCalibEvent(), CmsShowSearchFiles.sendToWebBrowser(), ElectronDqmAnalyzerBase.setBookPrefix(), ElectronDqmHarvesterBase.setBookPrefix(), PFBlockAlgo.setLinkers(), CommonAnalyzer.setPrefix(), CmsShowSearchFiles.showPrefixes(), TauTagValidation.stripDiscriminatorLabel(), and deep_tau::TauWPThreshold.TauWPThreshold().

tablePrinter.rows
tablePrinter.separateRows

Definition at line 65 of file tablePrinter.py.

tablePrinter.True

Definition at line 65 of file tablePrinter.py.

tablePrinter.width

Definition at line 62 of file tablePrinter.py.

tablePrinter.wrapfunc

Definition at line 65 of file tablePrinter.py.

Referenced by dataformats.indent(), and indent().