示例#1
0
def run_simulation(params):
    """Run a set of simulations using various parameter sets.

    Args: params: A dict-like object that will be unpacked as the arguments to
        schedule.make_schedule. In other words, it should be key-value pairs
        defining the state variables for the simulations. The "interventions"
        value should be an iterable of `Intervention` instances.

    Returns: A pandas.DataFrame with three columns - step_number,
        elapsed_time, and software_development_rate.
    """
    attributes = ['software_development_rate']

    output_stream = StringIO()
    schedule = make_schedule(**params)

    simulate(schedule, step, output_stream, attributes)
    output_stream.seek(0)

    frame = pandas.read_table(output_stream)

    # This cleans up the null initial rate
    frame.ix[0, 'software_development_rate'] = 0

    return frame
示例#2
0
def main(argv=None):
    if argv is None:
        argv = sys.argv[1:]

    arguments = docopt(__doc__, argv=argv, version="Brooks 0.5")

    schedule_file_path = arguments['<schedule>']
    loader = importlib.machinery.SourceFileLoader("schedule", schedule_file_path)
    schedule = loader.load_module()

    attributes = arguments['<attribute>']

    with open_out_stream(arguments['--output']) as output_stream:
        simulate(schedule, step, output_stream, attributes)

    return 0
示例#3
0
def main(argv=None):
    if argv is None:
        argv = sys.argv[1:]

    arguments = docopt(__doc__, argv=argv, version="Brooks 0.5")

    schedule_file_path = arguments['<schedule>']
    loader = importlib.machinery.SourceFileLoader("schedule",
                                                  schedule_file_path)
    schedule = loader.load_module()

    attributes = arguments['<attribute>']

    with open_out_stream(arguments['--output']) as output_stream:
        simulate(schedule, step, output_stream, attributes)

    return 0