コード例 #1
0
ファイル: mkpsf.py プロジェクト: R136a1-/MOP
def mkpsf(expnum, ccd, fversion):
    """Run the OSSOS makepsf script.

    """

    ## get image from the vospace storage area
    filename = storage.get_image(expnum, ccd, version=fversion)
    logging.info("Running mkpsf on %s %d" % (expnum, ccd))
    ## launch the makepsf script
    util.exec_prog(['jmpmakepsf.csh',
                          './',
                          filename,
                          'no'])

    ## place the results into VOSpace
    basename = os.path.splitext(filename)[0]

    ## confirm destination directory exists.
    destdir = os.path.dirname(
        storage.dbimages_uri(expnum, ccd, version=fversion,ext='fits'))
    logging.info("Checking that destination directories exist")
    storage.mkdir(destdir)


    for ext in ('mopheader', 'psf.fits',
                'zeropoint.used', 'apcor', 'fwhm', 'phot'):
        dest = storage.dbimages_uri(expnum, ccd, version=fversion, ext=ext)
        source = basename + "." + ext
        logging.info("Copying %s -> %s" % ( source, dest))
        storage.remove(dest)
        storage.copy(source, dest)

    return
コード例 #2
0
ファイル: sep_phot.py プロジェクト: nhammar/MainBeltComets
def find_objects_by_phot(family_name, aperture, thresh, imagetype):
    """
    For a given family name and object name, preforms photometry and identifies object in the image.
    If only a family name is given, does the same for all objects in that family
    """

    # get CADC authentification
    username = raw_input("CADC username: "******"CADC password: "******"\n {} --- Searching for asteroid {} in image {} ".format(row, table['Object'][row], table['Image'][row])

        expnum = (table['Image'][row]).strip('{}'.format(imagetype))
        if expnum in tkbad_list:
            print '-- Bad exposure'

        else:
            postage_stamp_filename = "{}_{}_{:8f}_{:8f}.fits".format(table['Object'][row], table['Image'][row],
                                                                     table['RA'][row], table['DEC'][row])

            if not storage.exists('{}/{}'.format(vos_dir, postage_stamp_filename)):
                print '-- Cutout not found, creating new cutout'
                get_stamps.cutout(username, password, family_name, table['Object'][row], table['Image'][row],
                                  table['RA'][row], table['DEC'][row], _RADIUS)
            if not storage.exists('{}/{}'.format(vos_dir, postage_stamp_filename)):
                with open('{}/{}/{}'.format(_OUTPUT_DIR, family_name, _OUTPUT_VOS_ERR), 'a') as outfile:
                    outfile.write('{} {}\n'.format(table['Object'][row], table['Image'][row]))
            else:
                success = False
                attempts = 0
                while (success is False) and (attempts < 3):
                    success = iterate_thru_images(family_name, str(table['Object'][row]), table['Image'][row], username,
                                                  password, aperture, thresh)
                    attempts += 1
                    if attempts == 3:
                        print ' >>>> Last attempt \n'