示例#1
0
    def testOutputExecTimeGraphs(self):
        m = mox.Mox()

        m.StubOutWithMock(main, "write_to_file")
        m.StubOutWithMock(main, "system")

        main.problems = ["problem"]
        main.variations = ["seq"]
        main.languages = ["language"]

        main.threads = [999]
        main.results = {999: {"problem": {"seq": {"language": {0: 100}}}}}

        main.write_to_file(
            "../../../ufrgs/tc/images/graph-exec-time-seq-0.perf",
            "=cluster;language\ncolors=black,yellow,red,med_blue,light_green,cyan\n=table\nyformat=%g\n=norotate\nxscale=1\nmax=150.000000\nylabel=Sequential execution time in seconds for input 0\nproblem 100.0000000000\n",
        )
        main.system(
            "../../../ufrgs/tc/bargraph.pl -fig ../../../ufrgs/tc/images/graph-exec-time-seq-0.perf | fig2dev -L ppm -m 4 > ../../../ufrgs/tc/images/graph-exec-time-seq-0.ppm"
        )
        main.system("mogrify -reverse -flatten ../../../ufrgs/tc/images/graph-exec-time-seq-0.ppm")
        main.system("mogrify -resize 700x700 -format png ../../../ufrgs/tc/images/graph-exec-time-seq-0.ppm")
        main.write_to_file(
            "../../../ufrgs/tc/chapters/graph-exec-time-0.tex",
            "\\begin{figure}[htbp]\n  %\\centering\n  \\includegraphics[width=125mm]{images/graph-exec-time-seq-0.png}\n  \\caption{Sequential Execution Time}\n  \\label{fig:exec:time:seq:0}\n\\end{figure}\n",
        )

        m.ReplayAll()
        main.create_graph("exec-time", main.results[999], "", use_subfigure=False)
        m.VerifyAll()
        m.UnsetStubs()
示例#2
0
文件: test.py 项目: pascalj/dash-apps
  def testOutputExecTimeGraphs(self):
    m = mox.Mox()

    m.StubOutWithMock(main, 'write_to_file')
    m.StubOutWithMock(main, 'system')

    main.problems = ['problem']
    main.variations = ['seq']
    main.languages = ['language']

    main.threads = [999]
    main.results = {
        999: {'problem': {
            'seq': {'language': {0: 100}}}}}

    main.write_to_file('output/images/graph-exec-time-seq-0.perf', '=cluster;language\ncolors=black,yellow,red,med_blue,light_green,cyan\n=table\nyformat=%g\n=norotate\nxscale=1\nmax=150.000000\nylabel=Sequential execution time in seconds for input 0\nproblem 100.0000000000\n')
    main.system('output/bargraph.pl -fig output/images/graph-exec-time-seq-0.perf | fig2dev -L ppm -m 4 > output/images/graph-exec-time-seq-0.ppm')
    main.system('mogrify -reverse -flatten output/images/graph-exec-time-seq-0.ppm')
    main.system('mogrify -resize 700x700 -format png output/images/graph-exec-time-seq-0.ppm')
    main.write_to_file('output/chapters/graph-exec-time-0.tex',
        '\\begin{figure}[htbp]\n  %\\centering\n  \\includegraphics[width=125mm]{images/graph-exec-time-seq-0.png}\n  \\caption{Sequential Execution Time}\n  \\label{fig:exec:time:seq:0}\n\\end{figure}\n')

    m.ReplayAll()
    main.create_graph("exec-time", main.results[999], '', use_subfigure=False)
    m.UnsetStubs()
    m.VerifyAll()
示例#3
0
 def test_output_3(self):
     g = create_graph('test_output_3.txt')
     result = g.identify_cycle()
     self.assertEqual(result, ([40, 4, 29, 27, 9, 73, 70, 123, 66, 55, 136, 87, 112, 109, 95, 46, 40]), 'An error '
                                                                                                        'occurred '
                                                                                                        'while '
                                                                                                        'processing '
                                                                                                        'your '
                                                                                                        'request')
def main():
    data_path = raw_input("Enter data directory path:  ")
    x_axis_min = raw_input("Enter x-axis minimum (for system height):  ")
    x_axis_max = raw_input("Enter x-axis maximum (for system height):  ")
    x2_axis_max = raw_input("Enter x-axis maximum (for time):  ")
    y_axis_max = raw_input("Enter y-axis maximum (for ls resistance):  ")
    time_v_res = raw_input("Plot Time v Resistance? (y/n):  ")
    tol_path = os.getcwd()
    for path, subdirs, files in os.walk(data_path):
        for file in files:
            file_path = os.path.join(data_path, file)
            file_name = file.split('.')[0]
            is_csv = True if file.split('.')[1] == 'csv' else False
            if is_csv:
                print 'Working on: ' + file_path
                data = np.genfromtxt(file_path, delimiter=',', dtype=str)
                test_style = data[1, 0]
                ca_number = data[1, 1]
                part_sn = data[1, 2]
                part_model = data[1, 3]
                hours_description = data[7, 0]
                main_side = 'True' if 'MS' in part_model else 'False'
                wet_test = 'True' if test_style == 'Wet Test' else 'False'
                if 'MLS' in part_model:
                    ls_series = 'MLS'
                elif 'E70' in part_model or 'E71' in part_model:
                    ls_series = 'E7x'
                elif 'F15' in part_model or 'F16' in part_model:
                    ls_series = 'F1x'
                elif 'F25' in part_model or 'F26' in part_model:
                    ls_series = 'F2x'
                else:
                    ls_series = 'unknown'
                plot_time_v_res = 'True' if time_v_res == 'y' else 'False'
                create_graph(
                    file_path, tol_path, main_side, wet_test, x_axis_min,
                    x_axis_max, x2_axis_max, y_axis_max, 10, ls_series,
                    ca_number + ' ' + part_model + ' ' + part_sn + ' ' +
                    test_style + ' ' + hours_description, plot_time_v_res)
    print 'Batch graph creation complete.'
示例#5
0
"""
Copyright (C) 2021 John C. Allwein 'johnnyapol' ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from main import CovidData, load_previous, create_graph

if __name__ == "__main__":
    data = load_previous()
    print("Got data: ", data)

    data = create_graph(data.get_rolling_iterator(), showDayNums=True)
    with open("graph.png", "wb") as f:
        f.write(data.read())

    print("Done")
示例#6
0
from graph_tool.all import *
from SCCFinder import SCCFinder
from main import create_graph, N, M

graph = create_graph(N, M)
scc_finder = SCCFinder(graph)
SCCs = scc_finder.execute()
comp, hist = label_components(graph)


def test_size():
    assert len(hist) == len(SCCs)


def test_label():
    # Extract indeces from vertices of SCCs from our algorithm
    SCCs_indeces = map(lambda SCC: [int(v) for v in SCC], SCCs)
    test_scc = set()
    for scc in SCCs_indeces:
        test_scc.add(frozenset(scc))

    # Extract SCCs from labels coming from graph-tool algorithm
    true_scc_dict = dict.fromkeys(list(set(comp.a)), None)
    for i, x in enumerate(comp.a):
        if true_scc_dict[x] is None:
            true_scc_dict[x] = [i]
        else:
            true_scc_dict[x].append(i)

    # From dictionary to set
    true_scc = set()
示例#7
0
"""
Copyright (C) 2021 John C. Allwein 'johnnyapol' ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from main import CovidData, load_previous, create_graph

if __name__ == "__main__":
    data = load_previous()
    print("Got data: ", data)

    data = create_graph(data)
    with open("graph.png", "wb") as f:
        f.write(data.read())

    print("Done")
示例#8
0
 def test_output_1(self):
     g = create_graph('test_output_1.txt')
     result = g.identify_cycle()
     self.assertEqual(result, ([0, 5, 10]), 'An error occurred while processing your request')
示例#9
0
 def test_output_2(self):
     g = create_graph('test_output_2.txt')
     result = g.identify_cycle()
     self.assertEqual(result, ([46, 70, 73, 163, 125, 98, 20, 127, 131, 154, 46, 62, 167]), 'An error occurred while'
                                                                                            'processing your request')