Пример #1
0
def makeReport(inputFileName, outputDir, projectDir):

    print '\n Processing input file ' + inputFileName, 'Time:', time.asctime()

    #try :
    # For each input file create a separate subfolder for all the related files
    [inputId, subFolder] = CheckFolders.MakeSubfolder(inputFileName, outputDir)

    # Move the prefilled Tex files into the subfolder
    BuildTex.MoveFiles(subFolder, projectDir)  

    # Parse the input file  
    [graphData, statData] = ParseInput.dataFromFile(inputFileName, inputId, outputDir, subFolder)

    # Compute the statistics values and build the charts
    StatValues.computeValues(subFolder, statData)

    orgSize = len(statData)
    if orgSize < 8 :
        print '\nNo graph data!'
        BuildTex.SimplifyResult(subFolder)
    else :
        try :
            # Create graphs for the reports 
            graphObject = BuildGraphs.makeGraphObject(graphData)
            BuildGraphs.BuildAllGraphs(inputId, subFolder, graphObject)
        except Exception as e:
            print e.message

    # Create PDF
    if orgSize > 37 :
        BuildTex.insertTables(subFolder, orgSize)
        BuildTex.splitTables(subFolder, orgSize)
    BuildTex.CreatePdf(outputDir, subFolder, inputId, inputFileName)
Пример #2
0
def BuildAllGraphs(inputId, subFolder, G0):

    # Save the number of employee into the Tex file
    BuildTex.addMacros(subFolder, 'nTotal', str(len(G0.nodes())))

    print '\nBuilding ', subFolder + '\\graph4a.png'
    G4a = aGraphObject(G0, [4,8], 'orange')
    G4a.draw(subFolder + '\\graph4a.png')
    
    G4b = aSymGraphObject(G0, [4,8], 'red')
    G4b.draw(subFolder + '\\graph4b.png')

    G51a = aGraphObject(G0, [5,7], 'blue')
    G51a.draw(subFolder + '\\graph5_1a.png')

    G51b = aSymGraphObject(G0, [5,7], '#808080')
    G51b.draw(subFolder + '\\graph5_1b.png')

    G52a = aGraphObject(G0, [3,6], 'darkgreen')
    G52a.draw(subFolder + '\\graph5_2a.png')

    G52b = aSymGraphObject(G0, [3,6], 'darkgreen')
    G52b.draw(subFolder + '\\graph5_2b.png')

    G53 = aGraphObject(G0, [3,5,6,7], '#448888')
    G53.draw(subFolder + '\\graph5_3.png')
Пример #3
0
def computeTeachCat(subFolder, statData):
    values = StatValues.extractAnswers(statData, [19])
    keys = [str(i + 55) for i in range(5)]
    stat = [values.count(key) for key in keys]
    print '\nTeacher categories:', values, stat
    BuildTex.addMacros(subFolder, 'numTechCatA', str(stat[0]))
    BuildTex.addMacros(subFolder, 'numTechCatB', str(stat[1]))
    BuildTex.addMacros(subFolder, 'numTechCatC', str(stat[2]))
    BuildTex.addMacros(subFolder, 'numTechCatD', str(stat[3]))
    BuildTex.addMacros(subFolder, 'numTechCatE', str(stat[4]))
Пример #4
0
def computeTeachCat(subFolder, statData) :
    values = StatValues.extractAnswers(statData, [19])
    keys = [str(i+55) for i in range(5)]
    stat = [values.count(key) for key in keys]
    print '\nTeacher categories:', values, stat
    BuildTex.addMacros(subFolder, 'numTechCatA', str(stat[0]))
    BuildTex.addMacros(subFolder, 'numTechCatB', str(stat[1]))
    BuildTex.addMacros(subFolder, 'numTechCatC', str(stat[2]))
    BuildTex.addMacros(subFolder, 'numTechCatD', str(stat[3]))
    BuildTex.addMacros(subFolder, 'numTechCatE', str(stat[4]))
Пример #5
0
def MakeTitlePage(firstLine, subFolder) :

    [orgId, orgName] = firstLine.split('\t')

    orgName.replace('quot;','')
    orgName =  orgName.decode("CP1251").encode("UTF-8")
    BuildTex.addMacros(subFolder,'fullName', orgName)

    orgId = orgId.split('=')[1]
    BuildTex.addMacros(subFolder,'internalId', orgId)
Пример #6
0
def ComputeAll(subFolder, statData) :

    BuildTex.MakeTitlePage(subFolder, statData)
    BuildTex.buildNamesList(subFolder, statData)

    computeAllBossTeacher(subFolder, statData)
    computeParticipatedManWomen(subFolder, statData)
    computeAge(subFolder, statData)
    computeEducation(subFolder, statData)
    computeWorkYears(subFolder, statData)
    computeWorkHereYears(subFolder, statData)
    computeTeachCat(subFolder, statData)
Пример #7
0
def ComputeAll(subFolder, statData):

    BuildTex.MakeTitlePage(subFolder, statData)
    BuildTex.buildNamesList(subFolder, statData)

    computeAllBossTeacher(subFolder, statData)
    computeParticipatedManWomen(subFolder, statData)
    computeAge(subFolder, statData)
    computeEducation(subFolder, statData)
    computeWorkYears(subFolder, statData)
    computeWorkHereYears(subFolder, statData)
    computeTeachCat(subFolder, statData)
Пример #8
0
def BuildAllGraphs(inputId, subFolder, G0):

    # Save the graph data 
    saveFullGraphData(subFolder, G0)
    buildGraph7a(subFolder, G0)
    buildGraph7b(subFolder, G0)
    buildGraph81a(subFolder, G0)
    buildGraph81b(subFolder, G0)
    buildGraph82a(subFolder, G0)
    buildGraph82b(subFolder, G0)
    BuildTex.addMacros(subFolder, 'linksnodes', str(len(G0.nodes())))

    print '\n Building graphs complete'
Пример #9
0
def BuildAllGraphs(inputId, subFolder, G0):

    # Save the graph data
    saveFullGraphData(subFolder, G0)
    buildGraph7a(subFolder, G0)
    buildGraph7b(subFolder, G0)
    buildGraph81a(subFolder, G0)
    buildGraph81b(subFolder, G0)
    buildGraph82a(subFolder, G0)
    buildGraph82b(subFolder, G0)
    BuildTex.addMacros(subFolder, 'linksnodes', str(len(G0.nodes())))

    print '\n Building graphs complete'
Пример #10
0
def makeReport(inputFileName, outputDir, projectDir):

    print '\n Processing input file ' + inputFileName, 'Time:', time.asctime()

    #try :
    # For each input file create a separate subfolder for all the related files
    [inputId, subFolder] = CheckFolders.MakeSubfolder(inputFileName, outputDir)

    # Move the prefilled Tex files into the subfolder
    BuildTex.MoveFiles(subFolder, projectDir)

    # Parse the input file
    [graphData, statData] = ParseInput.dataFromFile(inputFileName, inputId,
                                                    outputDir, subFolder)

    # Compute the statistics values and build the charts
    StatValues.computeValues(subFolder, statData)

    orgSize = len(statData)
    if orgSize < 8:
        print '\nNo graph data!'
        BuildTex.SimplifyResult(subFolder)
    else:
        try:
            # Create graphs for the reports
            graphObject = BuildGraphs.makeGraphObject(graphData)
            BuildGraphs.BuildAllGraphs(inputId, subFolder, graphObject)
        except Exception as e:
            print e.message

    # Create PDF
    if orgSize > 37:
        BuildTex.insertTables(subFolder, orgSize)
        BuildTex.splitTables(subFolder, orgSize)
    BuildTex.CreatePdf(outputDir, subFolder, inputId, inputFileName)
Пример #11
0
def computeBossTeacher(subFolder) :
    fileName =  subFolder + '\\nameslist.tex' # Teacher names to be included in report
    f = open(fileName, 'r')
    boss = 0
    teacher = 0
    for line in f.readlines() :
        pos = line.find(',')
        l = len(line) - pos
        print 'Boss:', pos, l, line
        if l > 80  :
            boss += 1
        else :
            teacher += 1

    BuildTex.addMacros(subFolder, 'numBoss', str(boss))
    BuildTex.addMacros(subFolder, 'numTeacher', str(teacher))

    f.close()
Пример #12
0
def BuildAllGraphs(inputId, subFolder, G0):

    # Comment according to the size
    BuildTex.addSizeComments(subFolder, len(G0.nodes()))

    # Save the graph data
    saveFullGraphData(subFolder, G0)
    buildGraph7a(subFolder, G0)
    buildGraph7b(subFolder, G0)
    buildGraph7c(subFolder, G0)
    buildGraph81a(subFolder, G0)
    buildGraph82a(subFolder, G0)
    buildGraph81b(subFolder, G0)
    buildGraph82b(subFolder, G0)
    buildGraph83a(subFolder, G0)
    buildGraph83b(subFolder, G0)
    buildGraph83c(subFolder, G0)

    print '\n Building graphs complete'
Пример #13
0
def computeParticipatedManWomen(subFolder, statData) :
    values = StatValues.extractAnswers(statData, [9])
    men = values.count('14')
    women = values.count('15')
    BuildTex.addMacros(subFolder, 'nParticipated', str(men+women))
    BuildTex.addMacros(subFolder, 'numMen', str(men))
    BuildTex.addMacros(subFolder, 'numWomen', str(women))
Пример #14
0
def compute31a(subFolder, statData):  # aggregate
    print '\nComputing values for slide 3.1.1.'
    values = StatValues.extractAnswers(statData, [43])

    yesNum = values.count('103') + values.count('104')
    noNum = values.count('105') + values.count('106')
    [yesNumP, noNumP] = StatValues.percent([yesNum, noNum])

    BuildTex.addMacros(subFolder, 'valCAAyesNum', str(yesNum))
    BuildTex.addMacros(subFolder, 'valCAAnoNum', str(noNum))
    BuildTex.addMacros(subFolder, 'valCAAyesNumP', str(yesNumP))
    BuildTex.addMacros(subFolder, 'valCAAnoNumP', str(noNumP))

    BuildCharts.YesNoPie(subFolder + '\\pie311.png', yesNumP, noNumP)
Пример #15
0
def compute23d(subFolder, statData): # aggregate
    print '\nComputing values for slide 2.3.4.'
    values = StatValues.extractAnswers(statData, [30])

    yesNum = values.count('83') + values.count('84')
    noNum = values.count('85') + values.count('86')
    [yesNumP, noNumP] = StatValues.percent([yesNum,noNum])

    BuildTex.addMacros(subFolder, 'valBCDyesNum', str(yesNum))
    BuildTex.addMacros(subFolder, 'valBCDnoNum', str(noNum))
    BuildTex.addMacros(subFolder, 'valBCDyesNumP', str(yesNumP))
    BuildTex.addMacros(subFolder, 'valBCDnoNumP', str(noNumP))

    BuildCharts.YesNoPie(subFolder + '\\pie234.png', yesNumP, noNumP)
Пример #16
0
def compute23b(subFolder, statData): # aggregate
    print '\nComputing values for slide 2.3.2.'
    values = StatValues.extractAnswers(statData, [52])

    yesNum = values.count('99') + values.count('100')
    noNum = values.count('101') + values.count('102')
    [yesNumP, noNumP] = StatValues.percent([yesNum,noNum])

    BuildTex.addMacros(subFolder, 'valBCByesNum', str(yesNum))
    BuildTex.addMacros(subFolder, 'valBCBnoNum', str(noNum))
    BuildTex.addMacros(subFolder, 'valBCByesNumP', str(yesNumP))
    BuildTex.addMacros(subFolder, 'valBCBnoNumP', str(noNumP))

    BuildCharts.YesNoPie(subFolder + '\\pie232.png', yesNumP, noNumP)
Пример #17
0
def compute23a(subFolder, statData): # aggregate
    print '\nComputing values for slide 2.3.1.'
    values = StatValues.extractAnswers(statData, [23])

    yesNum = values.count('61')
    noNum = values.count('62')
    [yesNumP, noNumP] = StatValues.percent([yesNum,noNum])

    BuildTex.addMacros(subFolder, 'valBCAyesNum', str(yesNum))
    BuildTex.addMacros(subFolder, 'valBCAnoNum', str(noNum))
    BuildTex.addMacros(subFolder, 'valBCAyesNumP', str(yesNumP))
    BuildTex.addMacros(subFolder, 'valBCAnoNumP', str(noNumP))

    BuildCharts.YesNoPie(subFolder + '\\pie231.png', yesNumP, noNumP)
Пример #18
0
def compute31a(subFolder, statData): # aggregate
    print '\nComputing values for slide 3.1.1.'
    values = StatValues.extractAnswers(statData, [43])

    yesNum = values.count('103') + values.count('104')
    noNum = values.count('105') + values.count('106')
    [yesNumP, noNumP] = StatValues.percent([yesNum,noNum])

    BuildTex.addMacros(subFolder, 'valCAAyesNum', str(yesNum))
    BuildTex.addMacros(subFolder, 'valCAAnoNum', str(noNum))
    BuildTex.addMacros(subFolder, 'valCAAyesNumP', str(yesNumP))
    BuildTex.addMacros(subFolder, 'valCAAnoNumP', str(noNumP))

    BuildCharts.YesNoPie(subFolder + '\\pie311.png', yesNum, noNum)
Пример #19
0
def compute42c(subFolder, statData):  # one question
    print '\nComputing values for slide 4.2.c.'
    values = StatValues.extractAnswers(statData, [54])

    yesNum = values.count('87') + values.count('88')
    noNum = values.count('89') + values.count('90')
    [yesNumP, noNumP] = StatValues.percent([yesNum, noNum])

    BuildTex.addMacros(subFolder, 'valDBCyesNum', str(yesNum))
    BuildTex.addMacros(subFolder, 'valDBCnoNum', str(noNum))
    BuildTex.addMacros(subFolder, 'valDBCyesNumP', str(yesNumP))
    BuildTex.addMacros(subFolder, 'valDBCnoNumP', str(noNumP))

    BuildCharts.YesNoPie(subFolder + '\\pie42_c_.png', yesNumP, noNumP)
Пример #20
0
def compute23a(subFolder, statData):  # aggregate
    print '\nComputing values for slide 2.3.1.'
    values = StatValues.extractAnswers(statData, [23])

    yesNum = values.count('61')
    noNum = values.count('62')
    [yesNumP, noNumP] = StatValues.percent([yesNum, noNum])

    BuildTex.addMacros(subFolder, 'valBCAyesNum', str(yesNum))
    BuildTex.addMacros(subFolder, 'valBCAnoNum', str(noNum))
    BuildTex.addMacros(subFolder, 'valBCAyesNumP', str(yesNumP))
    BuildTex.addMacros(subFolder, 'valBCAnoNumP', str(noNumP))

    BuildCharts.YesNoPie(subFolder + '\\pie231.png', yesNumP, noNumP)
Пример #21
0
def compute42c(subFolder, statData): # one question 
    print '\nComputing values for slide 4.2.c.'
    values = StatValues.extractAnswers(statData, [54])

    yesNum = values.count('87') + values.count('88')
    noNum = values.count('89') + values.count('90')
    [yesNumP, noNumP] = StatValues.percent([yesNum,noNum])

    BuildTex.addMacros(subFolder, 'valDBCyesNum', str(yesNum))
    BuildTex.addMacros(subFolder, 'valDBCnoNum', str(noNum))
    BuildTex.addMacros(subFolder, 'valDBCyesNumP', str(yesNumP))
    BuildTex.addMacros(subFolder, 'valDBCnoNumP', str(noNumP))

    BuildCharts.YesNoPie(subFolder + '\\pie42_c_.png', yesNumP, noNumP)
Пример #22
0
def computeParticipatedManWomen(subFolder, statData):
    values = StatValues.extractAnswers(statData, [9])
    men = values.count('14')
    women = values.count('15')
    BuildTex.addMacros(subFolder, 'nParticipated', str(men + women))
    BuildTex.addMacros(subFolder, 'numMen', str(men))
    BuildTex.addMacros(subFolder, 'numWomen', str(women))
Пример #23
0
def compute23b(subFolder, statData):  # aggregate
    print '\nComputing values for slide 2.3.2.'
    values = StatValues.extractAnswers(statData, [52])

    yesNum = values.count('99') + values.count('100')
    noNum = values.count('101') + values.count('102')
    [yesNumP, noNumP] = StatValues.percent([yesNum, noNum])

    BuildTex.addMacros(subFolder, 'valBCByesNum', str(yesNum))
    BuildTex.addMacros(subFolder, 'valBCBnoNum', str(noNum))
    BuildTex.addMacros(subFolder, 'valBCByesNumP', str(yesNumP))
    BuildTex.addMacros(subFolder, 'valBCBnoNumP', str(noNumP))

    BuildCharts.YesNoPie(subFolder + '\\pie232.png', yesNumP, noNumP)
Пример #24
0
def compute23d(subFolder, statData):  # aggregate
    print '\nComputing values for slide 2.3.4.'
    values = StatValues.extractAnswers(statData, [30])

    yesNum = values.count('83') + values.count('84')
    noNum = values.count('85') + values.count('86')
    [yesNumP, noNumP] = StatValues.percent([yesNum, noNum])

    BuildTex.addMacros(subFolder, 'valBCDyesNum', str(yesNum))
    BuildTex.addMacros(subFolder, 'valBCDnoNum', str(noNum))
    BuildTex.addMacros(subFolder, 'valBCDyesNumP', str(yesNumP))
    BuildTex.addMacros(subFolder, 'valBCDnoNumP', str(noNumP))

    BuildCharts.YesNoPie(subFolder + '\\pie234.png', yesNumP, noNumP)
Пример #25
0
def computeAllBossTeacher(subFolder, statData):
    values = StatValues.extractAnswers(statData, [8])
    boss = values.count('201') + values.count('202')
    teacher = values.count('203')

    BuildTex.addMacros(subFolder, 'nTotal', str(len(statData)))
    BuildTex.addMacros(subFolder, 'numBoss', str(boss))
    BuildTex.addMacros(subFolder, 'numTeacher', str(teacher))
Пример #26
0
def compute32a(subFolder, statData):  # aggregate
    print '\nComputing values for slide 3.2.1.'
    values = StatValues.extractAnswers(statData, [40, 41, 42])
    values = StatValues.joinLists(values)

    yesNum = values.count('99') + values.count('100')
    noNum = values.count('101') + values.count('102')
    [yesNumP, noNumP] = StatValues.percent([yesNum, noNum])

    BuildTex.addMacros(subFolder, 'valCBAyesNum', str(yesNum))
    BuildTex.addMacros(subFolder, 'valCBAnoNum', str(noNum))
    BuildTex.addMacros(subFolder, 'valCBAyesNumP', str(yesNumP))
    BuildTex.addMacros(subFolder, 'valCBAnoNumP', str(noNumP))

    BuildCharts.YesNoPie(subFolder + '\\pie321.png', yesNumP, noNumP)
Пример #27
0
def compute71(subFolder, statData):  # aggregate
    print "\nComputing values for slide 7.1."
    values = StatValues.extractAnswers(statData, [56, 57])
    values = StatValues.joinLists(values)

    yesNum = values.count("87") + values.count("88")
    noNum = values.count("89") + values.count("90")
    [yesNumP, noNumP] = StatValues.percent([yesNum, noNum])

    BuildTex.addMacros(subFolder, "valGAyesNum", str(yesNum))
    BuildTex.addMacros(subFolder, "valGAnoNum", str(noNum))
    BuildTex.addMacros(subFolder, "valGAyesNumP", str(yesNumP))
    BuildTex.addMacros(subFolder, "valGAnoNumP", str(noNumP))

    BuildCharts.YesNoPie(subFolder + "\\pie71.png", yesNumP, noNumP)
Пример #28
0
def compute21a(subFolder, statData): # aggregate
    print '\nComputing values for slide 2.1.1.'
    values = StatValues.extractAnswers(statData, [38,39])
    values = StatValues.joinLists(values)

    yesNum = values.count('87') + values.count('88')
    noNum = values.count('89') + values.count('90')
    [yesNumP, noNumP] = StatValues.percent([yesNum,noNum])

    BuildTex.addMacros(subFolder, 'valBAAyesNum', str(yesNum))
    BuildTex.addMacros(subFolder, 'valBAAnoNum', str(noNum))
    BuildTex.addMacros(subFolder, 'valBAAyesNumP', str(yesNumP))
    BuildTex.addMacros(subFolder, 'valBAAnoNumP', str(noNumP))

    BuildCharts.YesNoPie(subFolder + '\\pie211.png', yesNum, noNum)
Пример #29
0
def compute32a(subFolder, statData): # aggregate
    print '\nComputing values for slide 3.2.1.'
    values = StatValues.extractAnswers(statData, [40,41,42])
    values = StatValues.joinLists(values)

    yesNum = values.count('99') + values.count('100')
    noNum = values.count('101') + values.count('102')
    [yesNumP, noNumP] = StatValues.percent([yesNum,noNum])

    BuildTex.addMacros(subFolder, 'valCBAyesNum', str(yesNum))
    BuildTex.addMacros(subFolder, 'valCBAnoNum', str(noNum))
    BuildTex.addMacros(subFolder, 'valCBAyesNumP', str(yesNumP))
    BuildTex.addMacros(subFolder, 'valCBAnoNumP', str(noNumP))

    BuildCharts.YesNoPie(subFolder + '\\pie321.png', yesNum, noNum)
Пример #30
0
def computeAllBossTeacher(subFolder, statData) :
    values = StatValues.extractAnswers(statData, [8])
    boss = values.count('201') + values.count('202')
    teacher = values.count('203')

    BuildTex.addMacros(subFolder, 'nTotal', str(len(statData)))
    BuildTex.addMacros(subFolder, 'numBoss', str(boss))
    BuildTex.addMacros(subFolder, 'numTeacher', str(teacher))
Пример #31
0
def compute22a(subFolder, statData): # aggregate
    print '\nComputing values for slide 2.2.1.'
    values = StatValues.extractAnswers(statData, [28,29,46,47])
    values = StatValues.joinLists(values)

    yesNum = values.count('83') + values.count('84')
    noNum = values.count('85') + values.count('86')
    [yesNumP, noNumP] = StatValues.percent([yesNum,noNum])

    BuildTex.addMacros(subFolder, 'valBBAyesNum', str(yesNum))
    BuildTex.addMacros(subFolder, 'valBBAnoNum', str(noNum))
    BuildTex.addMacros(subFolder, 'valBBAyesNumP', str(yesNumP))
    BuildTex.addMacros(subFolder, 'valBBAnoNumP', str(noNumP))

    BuildCharts.YesNoPie(subFolder + '\\pie221.png', yesNum, noNum)
Пример #32
0
def compute74(subFolder, statData): # by question
    print '\nComputing values for slide 7.4.'
    values = StatValues.extractAnswers(statData, [56,57])
    values = StatValues.joinListsByQuestion(values)

    yesNum = [ val.count('87') + val.count('88') for val in values ]
    noNum = [ val.count('89') + val.count('90') for val in values ]

    BuildTex.addMacros(subFolder, 'valGDyesNumA', str(yesNum[0]))
    BuildTex.addMacros(subFolder, 'valGDyesNumB', str(yesNum[1]))
    BuildTex.addMacros(subFolder, 'valGDnoNumA', str(noNum[0]))
    BuildTex.addMacros(subFolder, 'valGDnoNumB', str(noNum[1]))

    BuildCharts.YesNoPie(subFolder + '\\pie74a.png', yesNum[0], noNum[0])
    BuildCharts.YesNoPie(subFolder + '\\pie74b.png', yesNum[1], noNum[1])
Пример #33
0
def compute21a(subFolder, statData):  # aggregate
    print '\nComputing values for slide 2.1.1.'
    values = StatValues.extractAnswers(statData, [38, 39])
    values = StatValues.joinLists(values)

    yesNum = values.count('87') + values.count('88')
    noNum = values.count('89') + values.count('90')
    [yesNumP, noNumP] = StatValues.percent([yesNum, noNum])

    BuildTex.addMacros(subFolder, 'valBAAyesNum', str(yesNum))
    BuildTex.addMacros(subFolder, 'valBAAnoNum', str(noNum))
    BuildTex.addMacros(subFolder, 'valBAAyesNumP', str(yesNumP))
    BuildTex.addMacros(subFolder, 'valBAAnoNumP', str(noNumP))

    BuildCharts.YesNoPie(subFolder + '\\pie211.png', yesNumP, noNumP)
Пример #34
0
def compute22a(subFolder, statData):  # aggregate
    print '\nComputing values for slide 2.2.1.'
    values = StatValues.extractAnswers(statData, [28, 29, 46, 47])
    values = StatValues.joinLists(values)

    yesNum = values.count('83') + values.count('84')
    noNum = values.count('85') + values.count('86')
    [yesNumP, noNumP] = StatValues.percent([yesNum, noNum])

    BuildTex.addMacros(subFolder, 'valBBAyesNum', str(yesNum))
    BuildTex.addMacros(subFolder, 'valBBAnoNum', str(noNum))
    BuildTex.addMacros(subFolder, 'valBBAyesNumP', str(yesNumP))
    BuildTex.addMacros(subFolder, 'valBBAnoNumP', str(noNumP))

    BuildCharts.YesNoPie(subFolder + '\\pie221.png', yesNumP, noNumP)
Пример #35
0
def compute74(subFolder, statData):  # by question
    print "\nComputing values for slide 7.4."
    values = StatValues.extractAnswers(statData, [56, 57])
    values = StatValues.joinListsByQuestion(values)

    yesNum = [val.count("87") + val.count("88") for val in values]
    noNum = [val.count("89") + val.count("90") for val in values]

    BuildTex.addMacros(subFolder, "valGDyesNumA", str(yesNum[0]))
    BuildTex.addMacros(subFolder, "valGDyesNumB", str(yesNum[1]))
    BuildTex.addMacros(subFolder, "valGDnoNumA", str(noNum[0]))
    BuildTex.addMacros(subFolder, "valGDnoNumB", str(noNum[1]))

    BuildCharts.YesNoPie(subFolder + "\\pie74a.png", yesNum[0], noNum[0])
    BuildCharts.YesNoPie(subFolder + "\\pie74b.png", yesNum[1], noNum[1])
Пример #36
0
def computeWorkHereYears(subFolder, statData):
    values = extractAnswers(statData, [17])
    years = map(extractNumber, values)
    print '\nExperience:', values, years
    [expA, expB, expC, expD] = [0,0,0,0]
    for y in years :
        if y < 5 :
            expA += 1
        elif y < 11 :
            expB += 1
        elif y < 21 :
            expC += 1
        else:
            expD += 1 
    BuildTex.addMacros(subFolder, 'numExpHereA', str(expA))
    BuildTex.addMacros(subFolder, 'numExpHereB', str(expB))
    BuildTex.addMacros(subFolder, 'numExpHereC', str(expC))
    BuildTex.addMacros(subFolder, 'numExpHereD', str(expD))
Пример #37
0
def computeAge(subFolder, statData):
    values = StatValues.extractAnswers(statData, [14])
    years = map(StatValues.toNumber, values)
    print '\nYears:', years
    ages = [(2014 - y) for y in years]
    print 'Ages:', ages
    [young, mid, senior, old] = [0, 0, 0, 0]
    for age in ages:
        if age < 25 and age > 12:
            young += 1
        elif age < 36:
            mid += 1
        elif age < 56:
            senior += 1
        elif age >= 56 and age < 120:
            old += 1
    BuildTex.addMacros(subFolder, 'numYoung', str(young))
    BuildTex.addMacros(subFolder, 'numMidAge', str(mid))
    BuildTex.addMacros(subFolder, 'numSenior', str(senior))
    BuildTex.addMacros(subFolder, 'numOld', str(old))
Пример #38
0
def computeWorkYears(subFolder, statData):
    values = StatValues.extractAnswers(statData, [16])
    years = map(StatValues.toNumber, values)
    print '\nExperience:', values, years
    [expA, expB, expC, expD] = [0, 0, 0, 0]
    for y in years:
        if y < 0:
            expA = expA
        elif y < 5:
            expA += 1
        elif y < 11:
            expB += 1
        elif y < 21:
            expC += 1
        elif y >= 21 and y < 100:
            expD += 1
    BuildTex.addMacros(subFolder, 'numExpA', str(expA))
    BuildTex.addMacros(subFolder, 'numExpB', str(expB))
    BuildTex.addMacros(subFolder, 'numExpC', str(expC))
    BuildTex.addMacros(subFolder, 'numExpD', str(expD))
Пример #39
0
def computeAge(subFolder, statData) :
    values = StatValues.extractAnswers(statData, [14])
    years = map(StatValues.toNumber, values)
    print '\nYears:', years
    ages = [(2014 - y) for y in years]
    print 'Ages:', ages
    [young, mid, senior, old] = [0,0,0,0]
    for age in ages :
        if age < 25 and age > 12:
            young += 1
        elif age < 36 :
            mid += 1
        elif age < 56 :
            senior += 1
        elif age >= 56 and age < 120:
            old += 1 
    BuildTex.addMacros(subFolder, 'numYoung', str(young))
    BuildTex.addMacros(subFolder, 'numMidAge', str(mid))
    BuildTex.addMacros(subFolder, 'numSenior', str(senior))
    BuildTex.addMacros(subFolder, 'numOld', str(old))
Пример #40
0
def computeWorkYears(subFolder, statData) :
    values = StatValues.extractAnswers(statData, [16])
    years = map(StatValues.toNumber, values)
    print '\nExperience:', values, years
    [expA, expB, expC, expD] = [0,0,0,0]
    for y in years :
        if y<0 :
            expA = expA
        elif y < 5 :
            expA += 1
        elif y < 11 :
            expB += 1
        elif y < 21 :
            expC += 1
        elif y>=21 and y<100:
            expD += 1 
    BuildTex.addMacros(subFolder, 'numExpA', str(expA))
    BuildTex.addMacros(subFolder, 'numExpB', str(expB))
    BuildTex.addMacros(subFolder, 'numExpC', str(expC))
    BuildTex.addMacros(subFolder, 'numExpD', str(expD))
Пример #41
0
def makeReport(inputFileName, outputDir, projectDir):

    print '\n Processing input file ', inputFileName, 'Time:', time.asctime()

    #try :
    # For each input file create a separate subfolder for all the related files
    [inputId, subFolder] = CheckFolders.MakeSubfolder(inputFileName, outputDir)

    # Move the prefilled Tex files into the subfolder
    BuildTex.MoveFiles(subFolder, projectDir)

    # Parse the input file
    [graphData, statData] = ParseInput.dataFromFile(inputFileName, inputId,
                                                    outputDir, subFolder)

    # Compute the statistics values and build the charts
    # StatValues.computeValues(subFolder, statData)

    try:
        # Create graphs for the reports
        graphObject = BuildGraphs.makeGraphObject(graphData)
        BuildGraphs.BuildAllGraphs(inputId, subFolder, graphObject)
    except Exception as e:
        print e.message

    # get socio numbers
    fsocio = open(projectDir + '\\socio_table.txt', 'a')
    ftex = open(subFolder + '\\commands.tex', 'r')
    data = statData[0].split('\t')
    schoolInfo = [data[i].split('=')[1] for i in range(7)]
    fsocio.write(inputId + '\t' + '\t'.join(schoolInfo))
    for i1 in range(7):
        ftex.readline()
    for line in ftex.readlines():
        res = line.split('}')
        res[0] = res[0].replace('\\newcommand{\\links', '')
        res[1] = res[1].replace('{', '')
        print 'Socio numbers', res
        fsocio.write('\t' + res[1])

    fsocio.write('\n')
    ftex.close()
    fsocio.close()
Пример #42
0
def compute22e(subFolder, statData):  # aggregate (1 question)
    print '\nComputing values for slide 2.2.5.'
    values = StatValues.extractAnswers(statData, [49])

    ansA = values.count('115')
    ansB = values.count('116')
    ansC = values.count('117')
    ansD = values.count('118')
    [ansAp, ansBp, ansCp, ansDp] = StatValues.percent([ansA, ansB, ansC, ansD])

    BuildTex.addMacros(subFolder, 'valBBEansA', str(ansA))
    BuildTex.addMacros(subFolder, 'valBBEansB', str(ansB))
    BuildTex.addMacros(subFolder, 'valBBEansC', str(ansC))
    BuildTex.addMacros(subFolder, 'valBBEansD', str(ansD))
    BuildTex.addMacros(subFolder, 'valBBEansAp', str(ansAp))
    BuildTex.addMacros(subFolder, 'valBBEansBp', str(ansBp))
    BuildTex.addMacros(subFolder, 'valBBEansCp', str(ansCp))
    BuildTex.addMacros(subFolder, 'valBBEansDp', str(ansDp))

    BuildCharts.Pie(subFolder + '\\pie225.png', [ansAp, ansBp, ansCp, ansDp])
Пример #43
0
def compute22d(subFolder, statData):  # by question
    print '\nComputing values for slide 2.2.4.'
    values = StatValues.extractAnswers(statData, [28, 29, 46, 47])
    values = StatValues.joinListsByQuestion(values)

    yesNum = [val.count('83') + val.count('84') for val in values]
    noNum = [val.count('85') + val.count('86') for val in values]

    BuildTex.addMacros(subFolder, 'valBBDyesNumA', str(yesNum[0]))
    BuildTex.addMacros(subFolder, 'valBBDyesNumB', str(yesNum[1]))
    BuildTex.addMacros(subFolder, 'valBBDyesNumC', str(yesNum[2]))
    BuildTex.addMacros(subFolder, 'valBBDyesNumD', str(yesNum[3]))
    BuildTex.addMacros(subFolder, 'valBBDnoNumA', str(noNum[0]))
    BuildTex.addMacros(subFolder, 'valBBDnoNumB', str(noNum[1]))
    BuildTex.addMacros(subFolder, 'valBBDnoNumC', str(noNum[2]))
    BuildTex.addMacros(subFolder, 'valBBDnoNumD', str(noNum[3]))

    BuildCharts.YesNoPie(subFolder + '\\pie224a.png', yesNum[0], noNum[0])
    BuildCharts.YesNoPie(subFolder + '\\pie224b.png', yesNum[1], noNum[1])
    BuildCharts.YesNoPie(subFolder + '\\pie224c.png', yesNum[2], noNum[2])
    BuildCharts.YesNoPie(subFolder + '\\pie224d.png', yesNum[3], noNum[3])
Пример #44
0
def compute22c(subFolder, statData):  # by category - q19
    print '\nComputing values for slide 2.2.3.'
    values = StatValues.extractAnswers(statData, [19, 28, 29, 46, 47])
    values = StatValues.joinListsByCategory(values)

    yesNum = [val.count('83') + val.count('84') for val in values]
    noNum = [val.count('85') + val.count('86') for val in values]

    BuildTex.addMacros(subFolder, 'valBBCyesNumA', str(yesNum[0]))
    BuildTex.addMacros(subFolder, 'valBBCyesNumB', str(yesNum[1]))
    BuildTex.addMacros(subFolder, 'valBBCyesNumC', str(yesNum[2]))
    BuildTex.addMacros(subFolder, 'valBBCyesNumD', str(yesNum[3]))
    BuildTex.addMacros(subFolder, 'valBBCyesNumE', str(yesNum[4]))
    BuildTex.addMacros(subFolder, 'valBBCnoNumA', str(noNum[0]))
    BuildTex.addMacros(subFolder, 'valBBCnoNumB', str(noNum[1]))
    BuildTex.addMacros(subFolder, 'valBBCnoNumC', str(noNum[2]))
    BuildTex.addMacros(subFolder, 'valBBCnoNumD', str(noNum[3]))
    BuildTex.addMacros(subFolder, 'valBBCnoNumE', str(noNum[4]))

    BuildCharts.YesNoPie(subFolder + '\\pie223a.png', yesNum[0], noNum[0])
    BuildCharts.YesNoPie(subFolder + '\\pie223b.png', yesNum[1], noNum[1])
    BuildCharts.YesNoPie(subFolder + '\\pie223c.png', yesNum[2], noNum[2])
    BuildCharts.YesNoPie(subFolder + '\\pie223d.png', yesNum[3], noNum[3])
    BuildCharts.YesNoPie(subFolder + '\\pie223e.png', yesNum[4], noNum[4])
Пример #45
0
def buildGraph81b(subFolder, G0):
    print '\nBuilding ', subFolder + '\\graph8_1b.txt'
    G81b = aSymGraphObject(G0, [5, 7], '#808080')
    saveToFile(G81b, subFolder + '\\graph8_1b.txt')
    BuildTex.addMacros(subFolder, 'links71s', str(len(G81b.edges())))
Пример #46
0
def compute22e(subFolder, statData): # aggregate (1 question)
    print '\nComputing values for slide 2.2.5.'
    values = StatValues.extractAnswers(statData, [49])

    ansA = values.count('115') 
    ansB = values.count('116')
    ansC = values.count('117') 
    ansD = values.count('118')
    [ansAp, ansBp, ansCp, ansDp] = StatValues.percent([ansA, ansB, ansC, ansD])

    BuildTex.addMacros(subFolder, 'valBBEansA', str(ansA))
    BuildTex.addMacros(subFolder, 'valBBEansB', str(ansB))
    BuildTex.addMacros(subFolder, 'valBBEansC', str(ansC))
    BuildTex.addMacros(subFolder, 'valBBEansD', str(ansD))
    BuildTex.addMacros(subFolder, 'valBBEansAp', str(ansAp))
    BuildTex.addMacros(subFolder, 'valBBEansBp', str(ansBp))
    BuildTex.addMacros(subFolder, 'valBBEansCp', str(ansCp))
    BuildTex.addMacros(subFolder, 'valBBEansDp', str(ansDp))
    
    BuildCharts.Pie(subFolder + '\\pie225.png', [ansA, ansB, ansC, ansD])
Пример #47
0
def compute42a(subFolder, statData): # one question 
    print '\nComputing values for slide 4.2.a'
    values = StatValues.extractAnswers(statData, [37])
    ansA = values.count('95') 
    ansB = values.count('96')
    ansC = values.count('97') 
    ansD = values.count('98')
    [ansAp, ansBp, ansCp, ansDp] = StatValues.percent([ansA, ansB, ansC, ansD])

    BuildTex.addMacros(subFolder, 'valDBAansA', str(ansA))
    BuildTex.addMacros(subFolder, 'valDBAansB', str(ansB))
    BuildTex.addMacros(subFolder, 'valDBAansC', str(ansC))
    BuildTex.addMacros(subFolder, 'valDBAansD', str(ansD))
    BuildTex.addMacros(subFolder, 'valDBAansAp', str(ansAp))
    BuildTex.addMacros(subFolder, 'valDBAansBp', str(ansBp))
    BuildTex.addMacros(subFolder, 'valDBAansCp', str(ansCp))
    BuildTex.addMacros(subFolder, 'valDBAansDp', str(ansDp))
    
    BuildCharts.Pie(subFolder + '\\pie42_a_.png', [ansAp, ansBp, ansCp, ansDp])
Пример #48
0
def dataFromFile(inputFileName, inputId, outputFolder, subFolder):

    # extract input file Id 
    inputId = os.path.basename(inputFileName).split('.')[0].split('_')[1]
    subFolder = outputFolder + '\\' + inputId + '_files'
    
    resFileName =  subFolder + '\\nameslist.tex' # Teacher names to be included in report
    f_in = open(inputFileName, 'r')
    f_namelist = open(resFileName, 'w')
    f_data = open(subFolder + '\\data.txt', 'w')
  
    graphData = []
    statData = []

    statDataDict = dict()
    for i in range(9,60) :
        statDataDict['q' + str(i)] = []
    localId = 0 # id of a peson in his orhanization


    print 'Parse input initialized'

    # use the first line of the input file to build title page
    firstLine = f_in.readline()
    MakeTitlePage(firstLine, subFolder)

    for line in  f_in:
        
        seq =  line.split('\t') #  Id - LocalId - full name - answers - comment

        if (len(seq)>3): # exclude lines with no data
            if (len(seq[3])) > 20: # the answers
                id = seq[1]
                localId += 1
                name = seq[2]
                dataString = seq[3].replace('" ','"') 
                age = extractAge(dataString)
                edgeGroups = extractEdges(dataString) # nine sequences of edge targets for the nine questions

                graphData.append([ id, str(localId), name, age, edgeGroups ])

                # Save the name list into the Tex file
                resLine = '\item [' + str(localId) + '] ' + name + '\n'
                f_namelist.write(resLine.decode("CP1251").encode("UTF-8"))

                # Now extract the statistical data
                data = seq[3]
                data = data.replace('s:1:','').replace('s:2:','').replace('s:3:','').replace('s:4:','').replace('s:5:','').replace('s:6:','').replace('s:7:','').replace('s:8:','')
                data = data.replace('i:0;','').replace('i:1;','').replace('i:2;','').replace('i:3;','').replace('i:4;','').replace('i:5;','')
                data = data.replace('a:0:','').replace('a:1:','').replace('a:2:','').replace('a:3:','').replace('a:4:','').replace('a:5:','')
                data = data.replace(';"Q_','*"q').replace(';','=').replace('*',';').replace('}"Q_','};"q').replace('{"Q_','{;"q').replace(';','\t')
                ln = data.find('q6') - 2
                data = data[7:ln]
                data = data.replace('"','')

                statData.append(data)

                f_data.write( data + '\n')

                for i in range(9,60) :
                    q = 'q' + str(i)
                    p_start = data.find(q)
                    if p_start >= 0 :
                        s = data[p_start:(p_start+100)].split('\t')[0]
                        s = s.split('=')[1]
                        if s.find('{') == -1 :
                            statDataDict[q]= statDataDict[q] + [s]
    
    print '\nStat data', statData

    f_in.close()
    f_namelist.close()
    f_data.close()

    # Save the number of participated
    BuildTex.addMacros(subFolder, 'nParticipated', str(len(graphData)))

    return [graphData, statData]
Пример #49
0
def buildGraph82b(subFolder, G0):
    print '\nBuilding ', subFolder + '\\graph8_2b.txt'
    G82b = aSymGraphObject(G0, [3, 6], 'darkgreen')
    saveToFile(G82b, subFolder + '\\graph8_2b.txt')
    BuildTex.addMacros(subFolder, 'links72s', str(len(G82b.edges())))
Пример #50
0
def compute21c(subFolder, statData): # by category - q19
    print '\nComputing values for slide 2.1.3.'
    values = StatValues.extractAnswers(statData, [19, 38,39])
    values = StatValues.joinListsByCategory(values)

    yesNum = [ val.count('87') + val.count('88') for val in values ]
    noNum = [ val.count('89') + val.count('90') for val in values ]

    BuildTex.addMacros(subFolder, 'valBACyesNumA', str(yesNum[0]))
    BuildTex.addMacros(subFolder, 'valBACyesNumB', str(yesNum[1]))
    BuildTex.addMacros(subFolder, 'valBACyesNumC', str(yesNum[2]))
    BuildTex.addMacros(subFolder, 'valBACyesNumD', str(yesNum[3]))
    BuildTex.addMacros(subFolder, 'valBACyesNumE', str(yesNum[4]))
    BuildTex.addMacros(subFolder, 'valBACnoNumA', str(noNum[0]))
    BuildTex.addMacros(subFolder, 'valBACnoNumB', str(noNum[1]))
    BuildTex.addMacros(subFolder, 'valBACnoNumC', str(noNum[2]))
    BuildTex.addMacros(subFolder, 'valBACnoNumD', str(noNum[3]))
    BuildTex.addMacros(subFolder, 'valBACnoNumE', str(noNum[4]))

    BuildCharts.YesNoPie(subFolder + '\\pie213a.png', yesNum[0], noNum[0])
    BuildCharts.YesNoPie(subFolder + '\\pie213b.png', yesNum[1], noNum[1])
    BuildCharts.YesNoPie(subFolder + '\\pie213c.png', yesNum[2], noNum[2])
    BuildCharts.YesNoPie(subFolder + '\\pie213d.png', yesNum[3], noNum[3])
    BuildCharts.YesNoPie(subFolder + '\\pie213e.png', yesNum[4], noNum[4])
Пример #51
0
def compute21b(subFolder, statData): # by age - q14
    print '\nComputing values for slide 2.1.2.'
    values = StatValues.extractAnswers(statData, [14, 38,39])
    values = StatValues.joinListsByAge(values)

    yesNum = [ val.count('87') + val.count('88') for val in values ]
    noNum = [ val.count('89') + val.count('90') for val in values ]

    BuildTex.addMacros(subFolder, 'valBAByesNumA', str(yesNum[0]))
    BuildTex.addMacros(subFolder, 'valBAByesNumB', str(yesNum[1]))
    BuildTex.addMacros(subFolder, 'valBAByesNumC', str(yesNum[2]))
    BuildTex.addMacros(subFolder, 'valBAByesNumD', str(yesNum[3]))

    BuildTex.addMacros(subFolder, 'valBABnoNumA', str(noNum[0]))
    BuildTex.addMacros(subFolder, 'valBABnoNumB', str(noNum[1]))
    BuildTex.addMacros(subFolder, 'valBABnoNumC', str(noNum[2]))
    BuildTex.addMacros(subFolder, 'valBABnoNumD', str(noNum[3]))

    BuildCharts.YesNoPie(subFolder + '\\pie212a.png', yesNum[0], noNum[0])
    BuildCharts.YesNoPie(subFolder + '\\pie212b.png', yesNum[1], noNum[1])
    BuildCharts.YesNoPie(subFolder + '\\pie212c.png', yesNum[2], noNum[2])
    BuildCharts.YesNoPie(subFolder + '\\pie212d.png', yesNum[3], noNum[3])
Пример #52
0
def compute42b(subFolder, statData): # one question 
    print '\nComputing values for slide 4.2.b.'
    values = StatValues.extractAnswers(statData, [45])
    ansA = values.count('107') 
    ansB = values.count('108')
    ansC = values.count('109') 
    ansD = values.count('110')
    ansE = values.count('111')
    [ansAp, ansBp, ansCp, ansDp, ansEp] = StatValues.percent([ansA, ansB, ansC, ansD, ansE])

    BuildTex.addMacros(subFolder, 'valDBBansA', str(ansA))
    BuildTex.addMacros(subFolder, 'valDBBansB', str(ansB))
    BuildTex.addMacros(subFolder, 'valDBBansC', str(ansC))
    BuildTex.addMacros(subFolder, 'valDBBansD', str(ansD))
    BuildTex.addMacros(subFolder, 'valDBBansE', str(ansE))
    BuildTex.addMacros(subFolder, 'valDBBansAp', str(ansAp))
    BuildTex.addMacros(subFolder, 'valDBBansBp', str(ansBp))
    BuildTex.addMacros(subFolder, 'valDBBansCp', str(ansCp))
    BuildTex.addMacros(subFolder, 'valDBBansDp', str(ansDp))
    BuildTex.addMacros(subFolder, 'valDBBansEp', str(ansEp))
    
    BuildCharts.Pie(subFolder + '\\pie42_b_.png', [ansAp, ansBp, ansCp, ansDp, ansEp])
Пример #53
0
def compute21d(subFolder, statData): # by question
    print '\nComputing values for slide 2.1.4.'
    values = StatValues.extractAnswers(statData, [35,38,39,50,55])
    values = StatValues.joinListsByQuestion(values)

    yesNum = [ val.count('87') + val.count('88') for val in values ]
    noNum = [ val.count('89') + val.count('90') for val in values ]

    BuildTex.addMacros(subFolder, 'valBADyesNumA', str(yesNum[0]))
    BuildTex.addMacros(subFolder, 'valBADyesNumB', str(yesNum[1]))
    BuildTex.addMacros(subFolder, 'valBADyesNumC', str(yesNum[2]))
    BuildTex.addMacros(subFolder, 'valBADyesNumD', str(yesNum[3]))
    BuildTex.addMacros(subFolder, 'valBADyesNumE', str(yesNum[4]))
    BuildTex.addMacros(subFolder, 'valBADnoNumA', str(noNum[0]))
    BuildTex.addMacros(subFolder, 'valBADnoNumB', str(noNum[1]))
    BuildTex.addMacros(subFolder, 'valBADnoNumC', str(noNum[2]))
    BuildTex.addMacros(subFolder, 'valBADnoNumD', str(noNum[3]))
    BuildTex.addMacros(subFolder, 'valBADnoNumE', str(noNum[4]))

    BuildCharts.YesNoPie(subFolder + '\\pie214a.png', yesNum[0], noNum[0])
    BuildCharts.YesNoPie(subFolder + '\\pie214b.png', yesNum[1], noNum[1])
    BuildCharts.YesNoPie(subFolder + '\\pie214c.png', yesNum[2], noNum[2])
    BuildCharts.YesNoPie(subFolder + '\\pie214d.png', yesNum[3], noNum[3])
    BuildCharts.YesNoPie(subFolder + '\\pie214e.png', yesNum[4], noNum[4])
Пример #54
0
def compute22d(subFolder, statData): # by question
    print '\nComputing values for slide 2.2.4.'
    values = StatValues.extractAnswers(statData, [28,29,46,47])
    values = StatValues.joinListsByQuestion(values)

    yesNum = [ val.count('83') + val.count('84') for val in values ]
    noNum = [ val.count('85') + val.count('86') for val in values ]

    BuildTex.addMacros(subFolder, 'valBBDyesNumA', str(yesNum[0]))
    BuildTex.addMacros(subFolder, 'valBBDyesNumB', str(yesNum[1]))
    BuildTex.addMacros(subFolder, 'valBBDyesNumC', str(yesNum[2]))
    BuildTex.addMacros(subFolder, 'valBBDyesNumD', str(yesNum[3]))
    BuildTex.addMacros(subFolder, 'valBBDnoNumA', str(noNum[0]))
    BuildTex.addMacros(subFolder, 'valBBDnoNumB', str(noNum[1]))
    BuildTex.addMacros(subFolder, 'valBBDnoNumC', str(noNum[2]))
    BuildTex.addMacros(subFolder, 'valBBDnoNumD', str(noNum[3]))

    BuildCharts.YesNoPie(subFolder + '\\pie224a.png', yesNum[0], noNum[0])
    BuildCharts.YesNoPie(subFolder + '\\pie224b.png', yesNum[1], noNum[1])
    BuildCharts.YesNoPie(subFolder + '\\pie224c.png', yesNum[2], noNum[2])
    BuildCharts.YesNoPie(subFolder + '\\pie224d.png', yesNum[3], noNum[3])
Пример #55
0
def compute23c(subFolder, statData):  # aggregate (1 question)
    print '\nComputing values for slide 2.3.3.'
    values = StatValues.extractAnswers(statData, [53])

    ansA = values.count('120')
    ansB = values.count('121')
    ansC = values.count('122')
    [ansAp, ansBp, ansCp] = StatValues.percent([ansA, ansB, ansC])

    BuildTex.addMacros(subFolder, 'valBCCansA', str(ansA))
    BuildTex.addMacros(subFolder, 'valBCCansB', str(ansB))
    BuildTex.addMacros(subFolder, 'valBCCansC', str(ansC))
    BuildTex.addMacros(subFolder, 'valBCCansAp', str(ansAp))
    BuildTex.addMacros(subFolder, 'valBCCansBp', str(ansBp))
    BuildTex.addMacros(subFolder, 'valBCCansCp', str(ansCp))

    BuildCharts.Pie(subFolder + '\\pie233.png', [ansAp, ansBp, ansCp])
Пример #56
0
def compute21c(subFolder, statData):  # by category - q19
    print '\nComputing values for slide 2.1.3.'
    values = StatValues.extractAnswers(statData, [19, 38, 39])
    values = StatValues.joinListsByCategory(values)

    yesNum = [val.count('87') + val.count('88') for val in values]
    noNum = [val.count('89') + val.count('90') for val in values]

    BuildTex.addMacros(subFolder, 'valBACyesNumA', str(yesNum[0]))
    BuildTex.addMacros(subFolder, 'valBACyesNumB', str(yesNum[1]))
    BuildTex.addMacros(subFolder, 'valBACyesNumC', str(yesNum[2]))
    BuildTex.addMacros(subFolder, 'valBACyesNumD', str(yesNum[3]))
    BuildTex.addMacros(subFolder, 'valBACyesNumE', str(yesNum[4]))
    BuildTex.addMacros(subFolder, 'valBACnoNumA', str(noNum[0]))
    BuildTex.addMacros(subFolder, 'valBACnoNumB', str(noNum[1]))
    BuildTex.addMacros(subFolder, 'valBACnoNumC', str(noNum[2]))
    BuildTex.addMacros(subFolder, 'valBACnoNumD', str(noNum[3]))
    BuildTex.addMacros(subFolder, 'valBACnoNumE', str(noNum[4]))

    BuildCharts.YesNoPie(subFolder + '\\pie213a.png', yesNum[0], noNum[0])
    BuildCharts.YesNoPie(subFolder + '\\pie213b.png', yesNum[1], noNum[1])
    BuildCharts.YesNoPie(subFolder + '\\pie213c.png', yesNum[2], noNum[2])
    BuildCharts.YesNoPie(subFolder + '\\pie213d.png', yesNum[3], noNum[3])
    BuildCharts.YesNoPie(subFolder + '\\pie213e.png', yesNum[4], noNum[4])
Пример #57
0
def compute21b(subFolder, statData):  # by age - q14
    print '\nComputing values for slide 2.1.2.'
    values = StatValues.extractAnswers(statData, [14, 38, 39])
    values = StatValues.joinListsByAge(values)

    yesNum = [val.count('87') + val.count('88') for val in values]
    noNum = [val.count('89') + val.count('90') for val in values]

    BuildTex.addMacros(subFolder, 'valBAByesNumA', str(yesNum[0]))
    BuildTex.addMacros(subFolder, 'valBAByesNumB', str(yesNum[1]))
    BuildTex.addMacros(subFolder, 'valBAByesNumC', str(yesNum[2]))
    BuildTex.addMacros(subFolder, 'valBAByesNumD', str(yesNum[3]))

    BuildTex.addMacros(subFolder, 'valBABnoNumA', str(noNum[0]))
    BuildTex.addMacros(subFolder, 'valBABnoNumB', str(noNum[1]))
    BuildTex.addMacros(subFolder, 'valBABnoNumC', str(noNum[2]))
    BuildTex.addMacros(subFolder, 'valBABnoNumD', str(noNum[3]))

    BuildCharts.YesNoPie(subFolder + '\\pie212a.png', yesNum[0], noNum[0])
    BuildCharts.YesNoPie(subFolder + '\\pie212b.png', yesNum[1], noNum[1])
    BuildCharts.YesNoPie(subFolder + '\\pie212c.png', yesNum[2], noNum[2])
    BuildCharts.YesNoPie(subFolder + '\\pie212d.png', yesNum[3], noNum[3])
Пример #58
0
def buildGraph7a(subFolder, G0):
    print '\nBuilding ', subFolder + '\\graph7a.txt'
    G7a = aGraphObject(G0, [4, 8], 'red')
    saveToFile(G7a, subFolder + '\\graph7a.txt')
    BuildTex.addMacros(subFolder, 'links6', str(len(G7a.edges())))
Пример #59
0
def compute21d(subFolder, statData):  # by question
    print '\nComputing values for slide 2.1.4.'
    values = StatValues.extractAnswers(statData, [35, 38, 39, 50, 55])
    values = StatValues.joinListsByQuestion(values)

    yesNum = [val.count('87') + val.count('88') for val in values]
    noNum = [val.count('89') + val.count('90') for val in values]

    BuildTex.addMacros(subFolder, 'valBADyesNumA', str(yesNum[0]))
    BuildTex.addMacros(subFolder, 'valBADyesNumB', str(yesNum[1]))
    BuildTex.addMacros(subFolder, 'valBADyesNumC', str(yesNum[2]))
    BuildTex.addMacros(subFolder, 'valBADyesNumD', str(yesNum[3]))
    BuildTex.addMacros(subFolder, 'valBADyesNumE', str(yesNum[4]))
    BuildTex.addMacros(subFolder, 'valBADnoNumA', str(noNum[0]))
    BuildTex.addMacros(subFolder, 'valBADnoNumB', str(noNum[1]))
    BuildTex.addMacros(subFolder, 'valBADnoNumC', str(noNum[2]))
    BuildTex.addMacros(subFolder, 'valBADnoNumD', str(noNum[3]))
    BuildTex.addMacros(subFolder, 'valBADnoNumE', str(noNum[4]))

    BuildCharts.YesNoPie(subFolder + '\\pie214a.png', yesNum[0], noNum[0])
    BuildCharts.YesNoPie(subFolder + '\\pie214b.png', yesNum[1], noNum[1])
    BuildCharts.YesNoPie(subFolder + '\\pie214c.png', yesNum[2], noNum[2])
    BuildCharts.YesNoPie(subFolder + '\\pie214d.png', yesNum[3], noNum[3])
    BuildCharts.YesNoPie(subFolder + '\\pie214e.png', yesNum[4], noNum[4])
Пример #60
0
def buildGraph7b(subFolder, G0):
    print '\nBuilding ', subFolder + '\\graph7b.txt'
    G7b = aSymGraphObject(G0, [4, 8], 'red')
    saveToFile(G7b, subFolder + '\\graph7b.txt')
    BuildTex.addMacros(subFolder, 'links6s', str(len(G7b.edges())))