Exemplo n.º 1
0
def main():
    """Run main function."""
    # Usage: python a01_jedisim_config.py -z 1.5
    parser = argparse.ArgumentParser('Create bulge disk weights text file.')
    parser.add_argument('-z',
                        '--redshift',
                        type=float,
                        default='1.5',
                        help='Redshift of the simulated galaxy.')
    FLAGS, unparsed = parser.parse_known_args()

    # Variables
    config_template = 'physics_settings/template_config.sh'
    z = FLAGS.redshift

    # Generate config files
    gen_config_files(
        z, config_template
    )  # physics_settings/configb.sh, configd.sh and configm.sh

    # Now generate lens file for jedidistort.
    config = config_dict(config_template)
    lens_file = 'physics_settings/lens.txt'
    x = config['lens_x']
    y = config['lens_y']
    lens_type = config['lens_type']
    p1 = config['lens_p1']
    p2 = config['lens_p2']
    gen_lens_file(lens_file, x, y, lens_type, p1,
                  p2)  # physics_settings/lens.txt
Exemplo n.º 2
0
def main():
    config = config_dict(path.expanduser('~/.exchange.cfg'))
    password = open(path.expanduser('~/.exchange.pass'), 'r').read()

    app = CalendarApp(config['exchange']['server'],
                      config['exchange']['user'],
                      password)

    print app(None, lambda x, y: None)
Exemplo n.º 3
0
def main():
    config = config_dict(path.expanduser('~/.exchange.cfg'))
    password = open(path.expanduser('~/.exchange.pass'), 'r').read()

    try:
        app = CalendarApp(config['exchange']['server'],
                          config['exchange']['user'],
                          password)

        make_server(config['local_server']['address'],
                    config['local_server']['port'], app).serve_forever()
    except KeyboardInterrupt:
        print '\n All done, shutting down.'