コード例 #1
0
ファイル: wise_view.py プロジェクト: kazuakiyama/wise
def main():
    sh.init(libwise.get_version(), USAGE)

    preprocess = not sh.get_opt_bool('no-crop', 'n')
    align = not sh.get_opt_bool('no-align', None)
    show_mask = sh.get_opt_bool('show-mask', 'm')

    region_files = sh.get_opt_value('reg-file', 'r', multiple=True)
    regions = []
    try:
        regions = [imgutils.Region(file) for file in region_files]
    except:
        print "Error: failed to read a region file"
        sh.usage(True)

    args = sh.get_args(min_nargs=1)

    config = actions.get_config(False)
    ctx = wise.AnalysisContext(config)
    actions.select_files(ctx, args)

    wise.tasks.view_all(ctx,
                        preprocess=preprocess,
                        show_regions=regions,
                        show_mask=show_mask,
                        align=align)
コード例 #2
0
def main():
    sh.init(libwise.get_version(), USAGE)

    pa = sh.get_opt_bool('pa', 'p')
    fit = sh.get_opt_bool('fit', 'f')
    num = sh.get_opt_bool('num', 'n')
    min_link_size = sh.get_opt_value('min-link-size', 'm', default=2)
    sh.check(min_link_size, nputils.is_str_number, "min-link-size must be an integer")
    min_link_size = float(min_link_size)
    
    args = sh.get_args(min_nargs=2)
    name = args[0]
    ctx = actions.load(name)

    if ctx is None:
        print "No results saved with name %s" % name
        sh.usage(True)

    scales = args[1]

    try:
        scales = nputils.str2floatlist(scales)
    except:
        print "Error: invalid scales. Available scales: %s" % ctx.result.get_scales()
        sh.usage(True)

    fit_fct = None
    if fit:
        fit_fct = nputils.LinearFct
    fit_result = wise.tasks.plot_separation_from_core(ctx, scales=scales, num=num,
                        min_link_size=min_link_size, fit_fct=fit_fct, pa=pa)

    if fit:
        for link, fit_fct in fit_result.items():
            print "Fit result for link %s: %.2f +- %.2f mas / year" % (link.get_id(), fit_fct.a, fit_fct.ea)
コード例 #3
0
def main():
    sh.init(libwise.get_version(), USAGE)

    min_link_size = sh.get_opt_value('min-link-size', 'm', default=2)
    sh.check(min_link_size, nputils.is_str_number,
             "min-link-size must be an integer")
    min_link_size = float(min_link_size)

    args = sh.get_args(min_nargs=2)
    name = args[0]
    ctx = actions.load(name)

    if ctx is None:
        print "No results saved with name %s" % name
        sh.usage(True)

    scales = args[1]

    try:
        scales = nputils.str2floatlist(scales)
    except:
        print "Error: invalid scales. Available scales: %s" % ctx.result.get_scales(
        )
        sh.usage(True)

    wise.tasks.view_links(ctx, scales=scales, min_link_size=min_link_size)
コード例 #4
0
ファイル: wise_select_files.py プロジェクト: flomertens/wise
def main():
    sh.init(libwise.get_version(), USAGE)

    start_date = get_date(sh.get_opt_value('start-date', 's'), 'start-date')
    end_date = get_date(sh.get_opt_value('end-date', 'e'), 'end-date')
    filter_dates = [get_date(k, 'filter-date') for k in sh.get_opt_value('filter-date', 'f', multiple=True)]
    output_filename = sh.get_opt_value('output', 'o', default='files')

    args = sh.get_args(min_nargs=1)

    files = imgutils.fast_sorted_fits(args, start_date=start_date, 
                            end_date=end_date, filter_dates=filter_dates)

    print "Outputing %s files in '%s'" % (len(files), output_filename)

    with open(output_filename, 'w') as f:
        f.write("\n".join(files) + "\n")
コード例 #5
0
def main():
    sh.init(libwise.get_version(), USAGE)

    nsigma = float(sh.get_opt_value('nsigma', 'n', default=0))
    nsigma_connected = sh.get_opt_bool('nsigma_connected', 'c')
    output_filename = sh.get_opt_value('output', 'o', default='stack_img.fits')

    args = sh.get_args(min_nargs=1)

    config = actions.get_config(False)
    ctx = wise.AnalysisContext(config)
    actions.select_files(ctx, args)

    stack_img = ctx.build_stack_image(preprocess=False, nsigma=nsigma, nsigma_connected=nsigma_connected)
    stack_img.save(output_filename)

    print "Stacked images save to %s" % output_filename
コード例 #6
0
ファイル: wise_select_files.py プロジェクト: kazuakiyama/wise
def main():
    sh.init(libwise.get_version(), USAGE)

    start_date = get_date(sh.get_opt_value('start-date', 's'), 'start-date')
    end_date = get_date(sh.get_opt_value('end-date', 'e'), 'end-date')
    filter_dates = [
        get_date(k, 'filter-date')
        for k in sh.get_opt_value('filter-date', 'f', multiple=True)
    ]
    output_filename = sh.get_opt_value('output', 'o', default='files')

    args = sh.get_args(min_nargs=1)

    files = imgutils.fast_sorted_fits(args,
                                      start_date=start_date,
                                      end_date=end_date,
                                      filter_dates=filter_dates)

    print "Outputing %s files in '%s'" % (len(files), output_filename)

    with open(output_filename, 'w') as f:
        f.write("\n".join(files) + "\n")
コード例 #7
0
def main():
    sh.init(libwise.get_version(), USAGE)

    pa = sh.get_opt_bool('pa', 'p')
    fit = sh.get_opt_bool('fit', 'f')
    num = sh.get_opt_bool('num', 'n')
    min_link_size = sh.get_opt_value('min-link-size', 'm', default=2)
    sh.check(min_link_size, nputils.is_str_number,
             "min-link-size must be an integer")
    min_link_size = float(min_link_size)

    args = sh.get_args(min_nargs=2)
    name = args[0]
    ctx = actions.load(name)

    if ctx is None:
        print "No results saved with name %s" % name
        sh.usage(True)

    scales = args[1]

    try:
        scales = nputils.str2floatlist(scales)
    except:
        print "Error: invalid scales. Available scales: %s" % ctx.result.get_scales(
        )
        sh.usage(True)

    fit_fct = None
    if fit:
        fit_fct = nputils.LinearFct
    fit_result = wise.tasks.plot_separation_from_core(
        ctx,
        scales=scales,
        num=num,
        min_link_size=min_link_size,
        fit_fct=fit_fct,
        pa=pa)

    if fit:
        for link, fit_fct in fit_result.items():
            print "Fit result for link %s: %.2f +- %.2f mas / year" % (
                link.get_id(), fit_fct.a, fit_fct.ea)
コード例 #8
0
ファイル: wise_view.py プロジェクト: flomertens/wise
def main():
    sh.init(libwise.get_version(), USAGE)

    preprocess = not sh.get_opt_bool('no-crop', 'n')
    align = not sh.get_opt_bool('no-align', None)
    show_mask = sh.get_opt_bool('show-mask', 'm')

    region_files = sh.get_opt_value('reg-file', 'r', multiple=True)
    regions = []
    try:
        regions = [imgutils.Region(file) for file in region_files]
    except:
        print "Error: failed to read a region file"
        sh.usage(True)

    args = sh.get_args(min_nargs=1)

    config = actions.get_config(False)
    ctx = wise.AnalysisContext(config)
    actions.select_files(ctx, args)

    wise.tasks.view_all(ctx, preprocess=preprocess, show_regions=regions, 
                        show_mask=show_mask, align=align)
コード例 #9
0
ファイル: wise_view_links.py プロジェクト: flomertens/wise
def main():
    sh.init(libwise.get_version(), USAGE)

    min_link_size = sh.get_opt_value('min-link-size', 'm', default=2)
    sh.check(min_link_size, nputils.is_str_number, "min-link-size must be an integer")
    min_link_size = float(min_link_size)
    
    args = sh.get_args(min_nargs=2)
    name = args[0]
    ctx = actions.load(name)

    if ctx is None:
        print "No results saved with name %s" % name
        sh.usage(True)

    scales = args[1]

    try:
        scales = nputils.str2floatlist(scales)
    except:
        print "Error: invalid scales. Available scales: %s" % ctx.result.get_scales()
        sh.usage(True)

    wise.tasks.view_links(ctx, scales=scales, min_link_size=min_link_size)