コード例 #1
0
ファイル: grapher.py プロジェクト: derekbraun/homogamy
                        help='manual y axis formatter string')
    parser.add_argument('--yscale',
                        action='store',
                        default='linear',
                        help='manual y axis formatter string')
    args = parser.parse_args()
    if len(sys.argv) == 1:
        parser.print_help(sys.stderr)
        sys.exit(1)

    experiments = []
    print('Reading file(s)...')
    for filename in args.filenames:
        # Check to see if each individual file exists
        if os.path.isfile(filename):
            experiments.append(fileio.Experiment(filename))
            print('   {}'.format(filename))
        else:
            print('   File {} not found.'.format(filename))
            exit()

    # if only one file, do a contour plot
    if len(args.filenames) == 1:
        print('Writing contour plot using {}'.format(args.rcfname))
        e = experiments[0]
        default_title='pop size={:,}   fitness={:.1f}   homogamy={:.1f}'\
              ''.format(int(e.constant_pop_size),
                        float(e.aa_fitness),
                        float(e.aa_homogamy))
        rc = {'axes.titlesize': 10}
        X = e.select('gen', 0)
コード例 #2
0
                        type = float,
                        default = aa_HOMOGAMY,
                        help = 'deaf-deaf assortative mating (homogamy) ' \
                               '(default {}).'.format(aa_HOMOGAMY))
    parser.add_argument('-f', '--fitness',
                        action = 'store',
                        type = float,
                        default = aa_FITNESS,
                        help = 'the relative reproductive fitness of deaf ' \
                               'individuals (default {}).'.format(aa_FITNESS))
    args = parser.parse_args()

    experiment = fileio.Experiment(constant_pop_size=args.pop_size,
                                   a=a_FREQ,
                                   aa_fitness=args.fitness,
                                   aa_homogamy=args.homogamy,
                                   deaf=DEAF_FREQ,
                                   generations=GENERATIONS,
                                   simuPOP_version=sim.__version__)

    experiment.cpu = subprocess.check_output(['/usr/sbin/sysctl', "-n", \
                                     "machdep.cpu.brand_string"]).decode().strip() + \
                                     " ({} threads)".format(multiprocessing.cpu_count())

    if not (args.write or args.overwrite):
        # just show the results from the quick sample run and exit
        sample_run = simuAssortativeMatingWithFitness(experiment)
        print(experiment.metadata())
        numcols = sample_run['headers'][1:].index("gen") + 1
        for h in sample_run['headers'][0:numcols]:
            print("{h:>9}".format(h=h), end=' ')