@@ -0,0 +1,2798 @@
+%22%22%22%0A@author: Bryan Silverthorn %3Cbcs@cargo-cult.org%3E%0A%22%22%22%0A%0Aif __name__ == %22__main__%22:%0A    from borg.tools.plot_performance import main%0A%0A    raise SystemExit(main())%0A%0Afrom cargo.log import get_logger%0A%0Alog = get_logger(__name__, default_level = %22INFO%22)%0A%0Adef plot_trial(session, trial_row):%0A    %22%22%22%0A    Plot the specified trial.%0A    %22%22%22%0A%0A    # get the relevant attempts%0A    from sqlalchemy import and_%0A    from borg.data  import RunAttemptRow%0A%0A    attempt_rows =                                        %5C%0A        session                                           %5C%0A        .query(RunAttemptRow)                             %5C%0A        .filter(%0A            and_(%0A                RunAttemptRow.trials.contains(trial_row),%0A                RunAttemptRow.answer != None,%0A                ),%0A            )                                             %5C%0A        .order_by(RunAttemptRow.cost)%0A%0A    # break them into series%0A    attempts = %7B%7D%0A    budget   = None%0A%0A    for attempt_row in attempt_rows:%0A%0A        solver_name     = attempt_row.solver_name%0A        solver_attempts = attempts.get(solver_name, %5B%5D)%0A%0A        solver_attempts.append(attempt_row.cost)%0A%0A        attempts%5Bsolver_name%5D = solver_attempts%0A%0A        # determine the budget%0A        if budget is None:%0A            budget = attempt_row.budget%0A        else:%0A            if budget != attempt_row.budget:%0A                raise RuntimeError(%22multiple budgets in trial%22)%0A%0A    session.commit()%0A%0A    # plot the series%0A    import pylab%0A%0A    pylab.title(%22Solver Performance (Trial %25s)%22 %25 trial_row.uuid)%0A%0A    for (name, costs) in attempts.iteritems():%0A        x_values = %5B0.0%5D + %5Bc.as_s for c in costs%5D + %5Bbudget.as_s%5D%0A        y_values = range(len(costs) + 1) + %5Blen(costs)%5D%0A%0A        pylab.plot(x_values, y_values, label = name)%0A%0A    pylab.legend()%0A    pylab.show()%0A%0Adef main():%0A    %22%22%22%0A    Run the script.%0A    %22%22%22%0A%0A    # get command line arguments%0A    import borg.data%0A%0A    from cargo.flags import parse_given%0A%0A    (trial_uuid,) = parse_given(usage = %22%25prog %3Ctrial_uuid%3E %5Boptions%5D%22)%0A%0A    # set up logging%0A    from cargo.log import enable_default_logging%0A%0A    enable_default_logging()%0A%0A    get_logger(%22sqlalchemy.engine%22, level = %22DETAIL%22)%0A%0A    # connect to the database and go%0A    from cargo.sql.alchemy import SQL_Engines%0A%0A    with SQL_Engines.default:%0A        from cargo.sql.alchemy import make_session%0A        from borg.data         import research_connect%0A%0A        ResearchSession = make_session(bind = research_connect())%0A%0A        with ResearchSession() as session:%0A            # get the trial%0A            from borg.data import TrialRow%0A%0A            trial_row = session.query(TrialRow).get(trial_uuid)%0A%0A            if trial_row is None:%0A                raise ValueError(%22no such trial%22)%0A%0A            # and plot it%0A            plot_trial(session, trial_row)%0A%0A

Add a simple performance plotting tool.