parser.add_argument('input', help='path to input data dir', type=str) parser.add_argument('-o', '--output', help='output dir', type=str, default=os.path.join(cwd, 'phot_out')) parser.add_argument('-m', '--movie', help='make movie of extracted images', type=bool, default=True) parser.add_argument('-a', '--aor', help='aor name', type=str, default=None) args = parser.parse_args() data_dir = os.path.abspath(args.input) if data_dir.startswith('r'): _, aor = os.path.split(args.input) else: aor = args.aor pickle_dir = os.path.join(args.output, 'pickles') plot_dir = os.path.join(args.output, 'plots') mkdirs(pickle_dir, plot_dir) # FIXME: make more pythonic # read data time, cube = read_data(data_dir) # make movie if args.movie: movie_dir = os.path.join(out_dir, 'movies') outpath = os.path.join(movie_dir, '{}_frames.mp4'.format(aor)) make_movie(cube, outpath, fps=60)
par['setup']['chain_length'] = args.length par['setup']['two_stage'] = args.twostage par['setup']['burn_in'] = 500 # FIXME should be in YAML file or from argparse ep = pld.Exoplanet(par, geom=args.geometry) if args.midtime: ep.guess_mid_time() base_name = '{}_{}_{}'.format(ep.star, ep.planet, ep.aor) # FIXME: should move this to Exoplanet constructor, i.e. ep.base_name # create output dir output_dir = os.path.join(args.output, base_name) util.mkdirs(output_dir) # FIXME: must be a more pythonic way to do this # fit ep.fit_pld() ep.fit_astro() ep.fit_mle(tol=1e-12, quiet=False) # FIXME: should be in YAML file or argparse ep.lm_astro() # plot name = base_name + '_fit_mle.pdf' outpath = os.path.join(output_dir, name) ep.plot(outpath=outpath) # dump binned/corrected time and flux name = base_name + '_corrected.txt' outpath = os.path.join(output_dir, name)