Beispiel #1
0
def PIPELINE(path):
    '''The **OASIS Pipeline**. Runs all **OASIS** functions in succession.
    
    :param str path: Path of data file tree (contains the **configs**, **data**, **psf**, **residuals**, **sources**, **templates** directories). Use a comma-separated list for mapping to multiple datasets.
    :returns: All-in-one difference imaging pipeline. Raw science images are placed in the **data** directory, and residual images and source catalogs are outputted into the **residuals** and **sources** directories, respectively.
    
    '''
    paths = (path.replace(' ', '')).split(',')
    del path
    for path in paths:
        startTime = time.time()
        if os.path.exists(path) == True:
            initialize.create(path)
            location = path + '/data'
            mask.MASK(path)
            sat = check_saturation.check_saturate(location)
            if sat == 0:
                ref_image(location)
                align_astroalign.align2(location)
            else:
                check = input(
                    "-> Saturated images found\n-> Move saturated images to OASIS archive? (y/n): "
                )
                if check == 'y':
                    check_saturation.move_arch(sat)
                    ref_image(location)
                    align_astroalign.align2(location)
                elif check == 'n':
                    ref_image(location)
                    align_astroalign.align2(location)
                else:
                    print("-> Error: Unknown input")
                    sys.exit()
            print("-> Combining images using swarp method...")
            psf.PSF(path)
            combine_swarp.swarp(location)
            psf.PSF(path)
            print("\n-> Subtracting images using AIS method...")
            subtract_ais.isis_sub(path)
            optimize.perform_optimization(path)
            print("-> Running SExtractor on residuals...")
            extract.EXTRACT(path, method='indiv')
            MR.MR(path)
            extract.EXTRACT(path, method='MR')
            endTime = time.time()
            print("-> Finished!\n-> Total runtime: %.2f seconds\n" %
                  (endTime - startTime))
        else:
            print(
                "\n-> Error: Unknown path entered\n-> Please enter the path to an existing exposure time directory\n-> Exiting...\n"
            )
            sys.exit()
Beispiel #2
0
def PIPELINE():
    get_check = input("-> Get data or analyze existing data? (get/analyze): ")
    if get_check == 'get':
        get.GET()
    elif get_check == 'analyze':
        location = input("-> Enter path to data directory: ")
        sat = check_saturation.check_saturate(location)
        if sat == 0:
            ref_image(location)
            align_astroalign.align2(location)
        else:
            check = input(
                "-> Saturated images found, continue image alignment? (y/n): ")
            if check == 'y':
                move = input(
                    "-> Move saturated images to SDI archives before continuing? (y/n): "
                )
                if move == 'y':
                    check_saturation.move_arch(sat)
                    ref_image(location)
                    align_astroalign.align2(location)
                else:
                    ref_image(location)
                    align_astroalign.align2(location)
        method = input(
            "-> Choose combination method-- numpy (default) or swarp: ")
        if method == "swarp":
            combine_swarp.swarp(location)
        elif method == "numpy" or method == "":
            combine_numpy.combine_median(location)
        else:
            print("-> Error: unknown method entered")
        path = location[:-5]
        sub_method = input(
            "\n-> Choose subtraction method-- ais (default) or hotpants: ")
        if sub_method == '' or sub_method == 'ais':
            subtract_ais.isis_sub(path)
        elif sub_method == 'hotpants':
            subtract_hotpants.hotpants(path)
        else:
            print("\n-> Error: Unknown method")
        ask = input("-> Run sextractor on residual images? (y/n): ")
        if ask == 'y':
            extract.SEXTRACTOR(path)
        elif ask != 'y' and ask != 'n':
            print("-> Error: unknown input")
Beispiel #3
0
def ALIGN():
    location = input("-> Enter path to data directory: ")
    sat = check_saturation.check_saturate(location)
    if sat == 0:
        ref_image(location)
        align_astroalign.align2(location)
    else:
        check = input("-> Saturated images found, continue image alignment? (y/n): ")
        if check == 'y':
            move = input("-> Move saturated images to SDI archives before continuing? (y/n): ")
            if move == 'y':
                check_saturation.move_arch(sat)
                ref_image(location)
                align_astroalign.align2(location)
            elif move == 'n':
                ref_image(location)
                align_astroalign.align2(location)
            else:
                print("-> Unknown input: must be y or n")
        elif check =='n':
            pass
        else:
            print("-> Unknown input: must be y or n")
Beispiel #4
0
def ALIGN(path, align_method='standard'):
    '''Registers all science images to their reference image. If no reference image exists, one is chosen (see documentation for details).
    
    :param str path: Path of data file tree (contains the **configs**, **data**, **psf**, **residuals**, **sources**, **templates** directories). Use a comma-separated list for mapping to multiple datasets.
    :param str align_method: Method of alignment. Can be either *standard* or *fakes*. Default is *standard*. The *fakes* method should be used only for simulations, as it bypasses registration and only performs photometric alignment.
    :returns: Aligns all science images are aligned to the reference image to subpixel precision. A succesful alignment changes an image's suffix from *_U_* to *_A_*.
    
    '''
    paths = (path.replace(' ', '')).split(',')
    del path
    for path in paths:
        if os.path.exists(path):
            location = path + '/data'
            mask.MASK(path)
            sat = check_saturation.check_saturate(location)
            if sat == 0:
                ref_image(location)
                align_astroalign.align2(location, method=align_method)
            else:
                check = input(
                    "-> Saturated images found, continue image alignment? (y/n): "
                )
                if check == 'y':
                    print("-> Moving saturated images to OASIS archives...")
                    check_saturation.move_arch(sat)
                    ref_image(location)
                    align_astroalign.align2(location, method=align_method)
                elif check == 'n':
                    pass
                else:
                    print("-> Unknown input: must be y or n")
                    sys.exit()
        else:
            print(
                "\n-> Error: Unknown path entered\n-> Please enter the path to an existing exposure time directory\n-> Exiting...\n"
            )
            sys.exit()
Beispiel #5
0
     get.GET()
 elif get_check == 'analyze':
     location = input("-> Enter path to data directory: ")
     sat = check_saturation.check_saturate(location)
     if sat == 0:
         ref_image(location)
         align_astroalign.align2(location)
     else:
         check = input(
             "-> Saturated images found, continue image alignment? (y/n): ")
         if check == 'y':
             move = input(
                 "-> Move saturated images to SDI archives before continuing? (y/n): "
             )
             if move == 'y':
                 check_saturation.move_arch(sat)
                 ref_image(location)
                 align_astroalign.align2(location)
             else:
                 ref_image(location)
                 align_astroalign.align2(location)
     method = input(
         "-> Choose combination method-- numpy (default) or swarp: ")
     if method == "swarp":
         combine_swarp.swarp(location)
     elif method == "numpy" or method == "":
         combine_numpy.combine_median(location)
     else:
         print("-> Error: unknown method entered")
     path = location[:-5]
     sub_method = input(