Esempio n. 1
0
def main(flg_fig):
    # Init
    if flg_fig == 'all':
        flg_fig = np.sum( np.array( [2**ii for ii in range(1)] )) # Skipping fig_chk_nhi
    else:
        flg_fig = int(flg_fig)

    # COS-Dwarf Images
    if (flg_fig % 2**1) >= 2**0:
        fig_cos_dwarfs_images()

    # LRG finder
    if (flg_fig % 2**2) >= 2**1:
        # LRG Finder (out of order to avoid PDF issues)
        coord = xra.to_coord( (176.1888,7.24901) )
        finder.main(['LRG', coord], imsize=1.*u.arcmin, show_circ=False)

    # z~1 QPQ finder
    if (flg_fig % 2**3) >= 2**2:
        # LRG Finder (out of order to avoid PDF issues)
        coord = xra.to_coord( (26.62542, 0.25583))
        finder.main(['z1QPQ', coord], imsize=1.*u.arcmin, show_circ=False)

    # All Halos
    if (flg_fig % 2**4) >= 2**3:
        fig_all_halo_images()
Esempio n. 2
0
def finder():
    reload(x_r)
    reload(xf)
    # SDSS
    xf.main(['TST', '10:31:38.87', '+25:59:02.3'],radec=1, imsize=8.)#,BW=1)
    # DSS
    xf.main(['TST2', '10:31:38.87', '-25:59:02.3'],radec=1, DSS=1, imsize=8.,BW=1)
    return
Esempio n. 3
0
def finder():
    reload(x_r)
    reload(xf)
    # SDSS
    xf.main(['TST', '10:31:38.87', '+25:59:02.3'], radec=1, imsize=8.)  #,BW=1)
    # DSS
    xf.main(['TST2', '10:31:38.87', '-25:59:02.3'],
            radec=1,
            DSS=1,
            imsize=8.,
            BW=1)
    return
Esempio n. 4
0
def wiki(targs, keys, fndr_pth=None, dbx_pth=None, outfil=None, skip_finder=False):
    """
    Generate a Wiki table for Lick observing.
    Should work for any of the Wiki pages

    Parameters:
    ----------
    targs: Table (RA, DEC keys required)
    keys: List
      List of keys to include in the Table + order
    fndr_pth: string
      Folder for finder charts
    dbx_pth: string
      Dropbox path for the finders
    skip_finder: False
      Skip making the finders

    Writes a file to disk that can be pasted into the Wiki
    """
    reload(x_finder)
    # Outfil
    if outfil is None:
        outfil = 'tmp_wiki.txt'
    f = open(outfil, 'w')

    # Finders?
    if not fndr_pth is None:
        if dbx_pth is None:
            dbx_pth = './'
            dbx_folder = './'
        else: # Expecting Public
            ifind = dbx_pth.find('Observing/')
            if ifind == -1:
                xdb.set_trace()
            else:
                dbx_folder = os.getenv('DROPBOX_DIR')+'/Public/'+dbx_pth[ifind:]
        #
        print('lick.wiki: Will copy finders to {:s}'.format(dbx_folder))
        # Get name tag
        name_tag = get_name_tag(targs.dtype.names)
        # Type
        #if isinstance(targs['RA'][0], basestring):
        #    radec = 1 # : separated strings
        #else:
        #    radec = 2 # decimal degrees
        # Finders
        fndr_files = []
        for targ in targs:
            # Finder
            #xdb.set_trace()
            if not skip_finder:
                x_finder.main([targ[name_tag], targ['RA'], targ['DEC']], fpath=fndr_pth)
            # Copy? + Save
            fil1 = fndr_pth+targ[name_tag]+'.pdf'
            fil2 = dbx_folder
            if not skip_finder:
                subprocess.call(["cp", fil1, dbx_folder])
            fndr_files.append(dbx_pth+targ[name_tag]+'.pdf')
        
    # Header
    lin = '||' 
    for key in keys:
        lin = lin+str(key)+'||'
    if 'fndr_files' in locals():
        lin=lin+'finder||comment||'
    f.write(str(lin+'\n'))
    
    # Targets
    for ii,targ in enumerate(targs):
        lin = '||' 
        for key in keys:
            lin = lin+str(targ[key])+'||'
        # Finder chart
        if 'fndr_files' in locals():
            lin = lin+'['+fndr_files[ii]+' pdf_finder]|| ||' # Lick formatting is different
        # Write
        f.write(str(lin+'\n'))

    # Close
    print('lick.wiki: Wrote {:s}'.format(outfil))
    f.close()
Esempio n. 5
0
def wiki(targs, keys, fndr_pth=None, dbx_pth=None, outfil=None):
    """
    Generate a Wiki table for Keck observing.
    Should work for any of the Wiki pages

    Parameters:
    ----------
    targs: Table (RA, DEC keys required)
    keys: List
      List of keys to include in the Table + order
    fndr_pth: string
      Folder for finder charts
    dbx_pth: string
      Dropbox path for the finders

    Writes a file to disk that can be pasted into the Wiki
    """
    reload(x_finder)
    # Outfil
    if outfil is None:
        outfil = 'tmp_wiki.txt'
    f = open(outfil, 'w')

    # Finders?
    if not fndr_pth is None:
        if dbx_pth is None:
            dbx_pth = './'
            dbx_folder = './'
        else:  # Expecting Public
            ifind = dbx_pth.find('Observing/')
            if ifind == -1:
                xdb.set_trace()
            else:
                dbx_folder = os.getenv(
                    'DROPBOX_DIR') + '/Public/' + dbx_pth[ifind:]
        #
        print('keck.wiki: Will copy finders to {:s}'.format(dbx_folder))
        # Get name tag
        name_tag = get_name_tag(targs.dtype.names)
        # Finders
        fndr_files = []
        for targ in targs:
            x_finder.main([targ[name_tag], targ['RA'], targ['DEC']],
                          radec=1,
                          fpath=fndr_pth)
            # Copy? + Save
            fil1 = fndr_pth + targ[name_tag] + '.pdf'
            fil2 = dbx_folder
            subprocess.call(["cp", fil1, dbx_folder])
            fndr_files.append(dbx_pth + targ[name_tag] + '.pdf')

    # Header
    lin = '||'
    for key in keys:
        lin = lin + str(key) + '||'
    if 'fndr_files' in locals():
        lin = lin + 'finder||'
    f.write(str(lin + '\n'))

    # Targets
    for ii, targ in enumerate(targs):
        lin = '||'
        for key in keys:
            lin = lin + str(targ[key]) + '||'
        # Finder chart
        if 'fndr_files' in locals():
            lin = lin + '[[' + fndr_files[
                ii] + '| pdf_finder]]||'  # Lick formatting is different
        # Write
        f.write(str(lin + '\n'))

    # Close
    print('keck.wiki: Wrote {:s}'.format(outfil))
    f.close()
Esempio n. 6
0
def wiki(targs, keys, fndr_pth=None, dbx_pth=None, outfil=None, offset=None, BW=False, show_spec=False):
    """
    Generate a Wiki table for Keck observing.
    Should work for any of the Wiki pages

    Parameters:
    ----------
    targs: Table (RA, DEC keys required)
    keys: List
      List of keys to include in the Table + order
    fndr_pth: string
      Folder for finder charts
    dbx_pth: string
      Dropbox path for the finders
    offset : tuple
      tag, tag for RA,DEC of offset objects

    Writes a file to disk that can be pasted into the Wiki
    """
    reload(x_finder)
    # Outfil
    if outfil is None:
        outfil = "tmp_wiki.txt"
    f = open(outfil, "w")

    # Finders?
    if not fndr_pth is None:
        if dbx_pth is None:
            dbx_pth = "./"
            dbx_folder = "./"
        else:  # Expecting Public
            ifind = dbx_pth.find("Observing/")
            if ifind == -1:
                xdb.set_trace()
            else:
                dbx_folder = os.getenv("DROPBOX_DIR") + "/Public/" + dbx_pth[ifind:]
        #
        print("keck.wiki: Will copy finders to {:s}".format(dbx_folder))
        # Get name tag
        name_tag = get_name_tag(targs.dtype.names)
        # Finders
        fndr_files = []
        for targ in targs:
            if offset is not None:
                show_another = (targ[offset[0]], targ[offset[1]])
            else:
                show_another = None

            x_finder.main(
                [targ[name_tag], targ["RA"], targ["DEC"]],
                radec=1,
                fpath=fndr_pth,
                BW=BW,
                show_spec=show_spec,
                show_another=show_another,
            )
            # Copy? + Save
            nm = "".join(targ[name_tag].split())
            fil1 = fndr_pth + nm + ".pdf"
            fil2 = dbx_folder
            subprocess.call(["cp", fil1, dbx_folder])
            fndr_files.append(dbx_pth + nm + ".pdf")

    # Header
    lin = "||"
    for key in keys:
        lin = lin + str(key) + "||"
    if "fndr_files" in locals():
        lin = lin + "finder||"
    f.write(str(lin + "\n"))

    # Targets
    for ii, targ in enumerate(targs):
        lin = "||"
        for key in keys:
            lin = lin + str(targ[key]) + "||"
        # Finder chart
        if "fndr_files" in locals():
            lin = lin + "[[" + fndr_files[ii] + "| pdf_finder]]||"  # Lick formatting is different
        # Write
        f.write(str(lin + "\n"))

    # Close
    print("keck.wiki: Wrote {:s}".format(outfil))
    f.close()
Esempio n. 7
0
def wiki(targs,
         keys,
         fndr_pth=None,
         dbx_pth=None,
         outfil=None,
         skip_make=False,
         offset=None,
         BW=False,
         show_spec=False,
         use_png=False):
    """
    Generate a Wiki table for Keck observing.
    Should work for any of the Wiki pages

    Parameters:
    ----------
    targs: Table (RA, DEC keys required)
    keys: List
      List of keys to include in the Table + order
    fndr_pth: string
      Folder for finder charts
    dbx_pth: str
      Dropbox path for the finders -- NOT RECOMMENDED UNLESS YOU HAVE A ZILLION
    offset : tuple
      tag, tag for RA,DEC of offset objects

    Writes a file to disk that can be pasted into the Wiki
    """
    #reload(x_finder)
    # Outfil
    if outfil is None:
        outfil = 'tmp_wiki.txt'
    f = open(outfil, 'w')

    # Finders?
    if not fndr_pth is None:
        if dbx_pth is None:
            dbx_pth = './'
            dbx_folder = './'
        else:  # Expecting Public
            ifind = dbx_pth.find('Observing/')
            if ifind == -1:
                xdb.set_trace()
            else:
                dbx_folder = os.getenv(
                    'DROPBOX_DIR') + '/Public/' + dbx_pth[ifind:]
        #
        print('keck.wiki: Will copy finders to {:s}'.format(dbx_folder))
        # Get name tag
        name_tag = get_name_tag(targs.dtype.names)
        # Finders
        fndr_files = []
        for targ in targs:
            if offset is not None:
                show_another = (targ[offset[0]], targ[offset[1]])
            else:
                show_another = None

            if use_png:
                exte = '.png'
                ext2 = 'PNG'
            else:
                exte = '.pdf'
                ext2 = 'PDF'
            if not skip_make:
                x_finder.main([targ[name_tag], targ['RA'], targ['DEC']],
                              radec=1,
                              fpath=fndr_pth,
                              BW=BW,
                              show_spec=show_spec,
                              show_another=show_another,
                              OUT_TYPE=ext2)
            # Copy? + Save
            nm = "".join(targ[name_tag].split())
            fil1 = fndr_pth + nm + exte
            fil2 = dbx_folder
            if not skip_make:
                subprocess.call(["cp", fil1, dbx_folder])
            fndr_files.append(dbx_pth + nm + exte)

    # Header
    lin = '||'
    for key in keys:
        lin = lin + str(key) + '||'
    if 'fndr_files' in locals():
        lin = lin + 'finder||'
    f.write(str(lin + '\n'))

    # Targets
    for ii, targ in enumerate(targs):
        lin = '||'
        for key in keys:
            lin = lin + str(targ[key]) + '||'
        # Finder chart
        if 'fndr_files' in locals():
            lin = lin + '[[' + fndr_files[
                ii] + '| pdf_finder]]||'  # Lick formatting is different
        # Write
        f.write(str(lin + '\n'))

    # Close
    print('keck.wiki: Wrote {:s}'.format(outfil))
    f.close()