当前位置: 首页>>代码示例>>Python>>正文


Python vizier.Vizier类代码示例

本文整理汇总了Python中astroquery.vizier.Vizier的典型用法代码示例。如果您正苦于以下问题:Python Vizier类的具体用法?Python Vizier怎么用?Python Vizier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Vizier类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_hip

def get_hip(name):
    """
    Given a star's Bayer designation, queries
    VizieR and attempts to locate a Hipparcos
    star ID at the location.

    Returns an integer HIP ID if found, or None otherwise

    Maintains a .hip_cache_stars file to speed up lookups;
    you can delete the .hip_cache_stars file to perform
    fresh lookups.
    """
    # Search the Hipparcos catalog, and only return results that include
    # a HIP (Hipparcos) column, sorting the results by magnitude.  The
    # top result is almost certainly the star we want.
    v = Vizier(catalog='I/239/hip_main', columns=["HIP", "+Vmag"])

    try:
        result = v.query_object(name)
    except EOFError:
        # if we get no results we might get an EOFError
        return None
    try:
        table = result['I/239/hip_main']
    except TypeError:
        # A TypeError means that the results didn't include anything from
        # the I/239/hip_main catalog.  The "in" operator doesn't seem to
        # work with Table objects.
        return None
    else:
        return table['HIP'][0]
开发者ID:Stellarium,项目名称:stellarium,代码行数:31,代码来源:generate_star_names.py

示例2: panstarrs_query

def panstarrs_query(ra_deg, dec_deg, rad_deg, maxmag=20,
                    maxsources=10000):
    """
    Query PanSTARRS @ VizieR using astroquery.vizier
    :param ra_deg: RA in degrees
    :param dec_deg: Declination in degrees
    :param rad_deg: field radius in degrees
    :param maxmag: upper limit G magnitude (optional)
    :param maxsources: maximum number of sources
    :return: astropy.table object
    """
    vquery = Vizier(columns=['objID', 'RAJ2000', 'DEJ2000',
                             'e_RAJ2000', 'e_DEJ2000',
                             'gmag', 'e_gmag',
                             'rmag', 'e_rmag',
                             'imag', 'e_imag',
                             'zmag', 'e_zmag',
                             'ymag', 'e_ymag'],
                    column_filters={"gmag":
                                    ("<%f" % maxmag)},
                    row_limit=maxsources)

    field = coord.SkyCoord(ra=ra_deg, dec=dec_deg,
                           unit=(u.deg, u.deg),
                           frame='icrs')
    return vquery.query_region(field,
                               width=("%fd" % rad_deg),
                               catalog="II/349/ps1")[0]
开发者ID:rfinn,项目名称:Virgo,代码行数:28,代码来源:getzp.py

示例3: query_nvss

def query_nvss(options, ra0, dec0, s=">0.0", proj='SIN'):
	'''
	query_nvss: module which queries the NVSS using the Vizier protocol. 
	inputs: ra0, dec0, s="<20"
	ra0 = the central ra in degrees
	dec0 = the central dec in degrees
	s = the flux cutoff
	returns L, M (relative coordinates in degrees), N (number of sources), S (1.4GHz Flux
	Density in mJy)
	'''
	v = Vizier(column_filters={"S1.4":s})
	v.ROW_LIMIT = 10000
	result = v.query_region(coord.SkyCoord(ra=ra0, dec=dec0, unit=(u.deg, u.deg), frame='icrs'), 
	    radius=Angle(1, "deg"), catalog='NVSS')
	ra = result[0]['_RAJ2000']
	dec = result[0]['_DEJ2000']
	N = len(result[0])
	if proj.upper()=='SIN':
		L = (ra-ra0)*pl.cos(dec*deg2rad)
		M = dec-dec0
	if proj.upper()=='NCP':
		L = 57.2957795*pl.cos(deg2rad*dec)*pl.sin(deg2rad*(ra-ra0))
		M = 57.2957795*(pl.cos(deg2rad*dec0) - pl.cos(deg2rad*dec)*pl.cos(deg2rad*(ra-ra0)))/pl.sin(deg2rad*dec0) 
	S = result[0]['S1.4']
	ascii.write(result[0], options.outfile+'.dat', format='tab') 
	ann_writer(options, result[0])
	return L, M, N, S
开发者ID:foxmouldy,项目名称:apercal,代码行数:27,代码来源:mk-nvss-lsm.py

示例4: get_catalog

def get_catalog(object):
    from astroquery.vizier import Vizier
    viz = Vizier( columns=['Star', '*'])
    star = object.replace('_', ' ') + '*'
    try:
        return viz.query_constraints(catalog='II/183A/table2',Star=star)[0]
    except IndexError:
        return None
开发者ID:majkelx,项目名称:astwro,代码行数:8,代码来源:ds9_io_test.py

示例5: galaxies_in_box

def galaxies_in_box(center, ra_span, dec_span):

    """
    This function ...
    :param center:
    :param ra_span:
    :param dec_span:
    :return:
    """

    # Initialize a list to contain the galaxies
    names = []

    # Other way ?? Much more results ?
    #ra_radius = 0.5 * ra_span.value
    #dec_radius = 0.5 * dec_span.value
    #radius = math.sqrt(ra_radius**2 + dec_radius**2)
    #result_table = Ned.query_region(center, radius=radius)

    # Create a new Vizier object and set the row limit to -1 (unlimited)
    viz = Vizier(keywords=["galaxies", "optical"])
    viz.ROW_LIMIT = -1

    # Debugging
    log.debug("Querying the HYPERLEDA catalog ...")

    # Query Vizier and obtain the resulting table
    result = viz.query_region(center.to_astropy(), width=ra_span, height=dec_span, catalog=["VII/237"])

    # I noticed something strange happening once; where there were no entries in the result,
    # with the following parameters:
    #   center = (149.07614359, 69.24847936)
    #   ra_span = 1.600000128 deg
    #   dec_span = 1.3966667784 deg
    #   catalog = ["VII/237"]
    # When ra_span was only slightly changed (e.g. change the last digit to a '7'), output was normal
    # Thus, it seems that the query goes wrong with specific values of the width (and/or height), in which
    # case changing the value very slightly resolves the problem...
    # I am baffled by this and I see no reasonable explanation.
    if len(result) == 0:

        ra_span *= 1.0 + 1e-5
        result = viz.query_region(center.to_astropy(), width=ra_span, height=dec_span, catalog=["VII/237"])

    table = result[0]

    # Loop over the rows in the table
    for entry in table:
        name = "PGC " + str(entry["PGC"])
        coordinate = SkyCoordinate(ra=entry["_RAJ2000"], dec=entry["_DEJ2000"], unit="deg", frame="fk5")
        namepluscoordinate = (name, coordinate)
        names.append(namepluscoordinate)

    # Return the list of galaxies
    return names
开发者ID:Stargrazer82301,项目名称:CAAPR,代码行数:55,代码来源:catalogs.py

示例6: serendipitous_variablestars

def serendipitous_variablestars(catalogs, display=True):
    """match catalogs with VSX catalog using astroquery.Vizier
    """

    if display:
        print('# match frames with variable star database... ', end=' ',
              flush=True)
    logging.info('match frames with variable star database')

    # derive center and radius of field of view of all images
    ra_deg, dec_deg, rad_deg = skycenter(catalogs)
    logging.info('FoV center (%.7f/%+.7f) and radius (%.2f deg) derived' %
                 (ra_deg, dec_deg, rad_deg))

    # derive observation midtime of sequence
    midtime = np.average([cat.obstime[0] for cat in catalogs])

    # setup Vizier query
    # note: column filters uses original Vizier column names
    # -> green column names in Vizier

    logging.info(('query Vizier for VSX at %7.3f/%+8.3f in '
                  + 'a %.2f deg radius') %
                 (ra_deg, dec_deg, rad_deg))

    field = coord.SkyCoord(ra=ra_deg, dec=dec_deg, unit=(u.deg, u.deg),
                           frame='icrs')

    vquery = Vizier(columns=['Name', 'RAJ2000', 'DEJ2000'])
    try:
        data = vquery.query_region(field,
                                   width=("%fd" % rad_deg),
                                   catalog="B/vsx/vsx")[0]
    except IndexError:
        if display:
            print('no data available from VSX')
            logging.error('no data available from VSX')
            return []

    objects = []
    for cat_idx, cat in enumerate(catalogs):
        for star in data:
            objects.append({'ident': star['Name'],
                            'obsdate.jd': cat.obstime[0],
                            'cat_idx': cat_idx,
                            'ra_deg': star['RAJ2000'],
                            'dec_deg': star['DEJ2000']})

    if display:
        print(len(objects)/len(catalogs), 'variable stars found')

    return objects
开发者ID:mommermi,项目名称:photometrypipeline,代码行数:52,代码来源:pp_distill.py

示例7: fetch_objects_in_box

def fetch_objects_in_box(box, catalog, keywords, radius, limit=None, column_filters=None):

    """
    This function ...
    :param box:
    :param catalog:
    :param keywords:
    :param radius:
    :param limit:
    :param column_filters:
    :return:
    """

    # Define the center coordinate for the box
    coordinate = SkyCoordinate(ra=box[0], dec=box[1], unit="deg", frame="fk5") # frame: icrs, fk5... ?

    # Make a Vizier object
    if column_filters is None:
        viz = Vizier(columns=['_RAJ2000', '_DEJ2000','B-V', 'Vmag', 'Plx'], keywords=keywords)
    else:
        viz = Vizier(columns=['_RAJ2000', '_DEJ2000','B-V', 'Vmag', 'Plx'], column_filters=column_filters, keywords=keywords)

    # No limit on the number of entries
    viz.ROW_LIMIT = limit if limit is not None else -1

    # Query the box of our image frame
    result = viz.query_region(coordinate.to_astropy(), width=box[3] * Unit("deg"), height=box[2] * Unit("deg"), catalog=catalog)

    region_string = "# Region file format: DS9 version 3.0\n"
    region_string += "global color=green\n"

    # Result may contain multiple tables (for different catalogs)
    for table in result:

        # For every entry in the table
        for entry in table:

            # Get the right ascension and the declination
            ra = entry[0]
            dec = entry[1]

            # Create a string with the coordinates of the star
            regline = "fk5;circle(%s,%s,%.2f\")\n" % (ra, dec, radius)

            # Add the parameters of this star to the region string
            region_string += regline

    # Return the region
    return regions.parse(region_string)
开发者ID:Stargrazer82301,项目名称:CAAPR,代码行数:49,代码来源:catalogs.py

示例8: get_galaxy_s4g_one_component_info

def get_galaxy_s4g_one_component_info(name):

    """
    This function ...
    :param name:
    :return:
    """

    # The Vizier querying object
    vizier = Vizier()
    vizier.ROW_LIMIT = -1

    # Get the "galaxies" table
    result = vizier.query_object(name, catalog=["J/ApJS/219/4/galaxies"])

    # No results?
    if len(result) == 0: return None, None, None, None, None, None

    # Get table
    table = result[0]

    # PA: [0.2/180] Outer isophote position angle
    # e_PA: [0/63] Standard deviation in PA
    # Ell:  [0.008/1] Outer isophote ellipticity
    # e_Ell: [0/0.3] Standard deviation in Ell

    # PA1: Elliptical isophote position angle in deg
    # n: Sersic index
    # Re: effective radius in arcsec

    # Tmag: total magnitude

    s4g_name = table["Name"][0]

    pa = Angle(table["PA"][0] - 90., "deg")
    pa_error = Angle(table["e_PA"][0], "deg")

    ellipticity = table["Ell"][0]
    ellipticity_error = table["e_Ell"][0]

    n = table["n"][0]

    re = table["Re"][0] * u("arcsec")

    mag = table["Tmag"][0]

    # Return the results
    return s4g_name, pa, ellipticity, n, re, mag
开发者ID:SKIRT,项目名称:PTS,代码行数:48,代码来源:catalogs.py

示例9: __init__

    def __init__(self, config=None):
    
        """
        The constructor ...
        """

        # Call the constructor of the base class
        super(SEDFetcher, self).__init__(config, "modeling")

        # -- Attributes --

        # The name of the galaxy
        self.galaxy_name = None

        # The NGC ID of the galaxy
        self.ngc_id = None

        # The Vizier querying object
        self.vizier = Vizier(keywords=["galaxies"])
        self.vizier.ROW_LIMIT = -1

        # The observed SED
        self.seds = dict()

        # The filters
        self.filters = dict()
开发者ID:Stargrazer82301,项目名称:CAAPR,代码行数:26,代码来源:sedfetching.py

示例10: catalog_search

def catalog_search(frame_wcs, shape, desired_catalog,
                   ra_column='RAJ2000',
                   dec_column='DEJ2000',
                   radius=0.5,
                   clip_by_frame=True):
    """
    Description: This function takes coordinate data from an image and a
    catalog name and returns the positions of those stars.
    Preconditions:frame_wcs is a WCS object, shape is tuple, list or array of
    numerical values, desired_catalog is a string and radius is a numerical
    value.
    Postconditions:
    """
    rad = radius * units.deg
    # Find the center of the frame
    center_coord = frame_wcs.all_pix2world([[shape[1] / 2, shape[0] / 2]], 0)
    center = SkyCoord(center_coord, frame='icrs', unit='deg')

    # Get catalog via cone search
    Vizier.ROW_LIMIT = -1  # Set row_limit to have no limit
    cat = Vizier.query_region(center, radius=rad, catalog=desired_catalog)
    # Vizier always returns list even if there is only one element. Grab that
    # element.
    cat = cat[0]
    cat_coords = SkyCoord(ra=cat[ra_column], dec=cat[dec_column])
    if clip_by_frame:
        in_fov = in_frame(frame_wcs, cat_coords)
    else:
        in_fov = np.ones([len(cat_coords)], dtype=np.bool)
    x, y = frame_wcs.all_world2pix(cat_coords.ra, cat_coords.dec, 0)
    return (cat[in_fov], x[in_fov], y[in_fov])
开发者ID:glowing-waffle,项目名称:glowing-waffles,代码行数:31,代码来源:catalog_search.py

示例11: selected_catalog

def selected_catalog( ra, dec, FOV_base, FOV_height, catalog ):

     '''

     Vizier.query_region in selected FoV. The hist of the apparent blue magnitude
     and the sky coordinates are provided if GWGC catalog is selected

     '''

     from astroquery.vizier import Vizier 

     import astropy.coordinates as coord
     import astropy.units as u

     import aladinSAMP

     # setting rows limit
     Vizier.ROW_LIMIT = None

     # no reduced query size (rq)
     reduce_query_size = 1
     FOV_base_reduced, FOV_height_reduced = FOV_base * reduce_query_size, FOV_height * reduce_query_size

     FOV_base_str, FOV_height_str = str( FOV_base_reduced ) + 'd', str( FOV_height_reduced ) + 'd'

     result = Vizier.query_region(coord.SkyCoord(ra = ra, dec = dec, unit = (u.deg, u.deg), frame='icrs'),
                                  width = FOV_height_str, height = FOV_base_str, catalog = [ catalog ])

     result.pprint()
     print result.values()
开发者ID:juliet934,项目名称:GWsky,代码行数:30,代码来源:query_FOV.py

示例12: query_color

    def query_color(self,
                    ra,
                    dec,
                    radius=0.01,
                    min_mag=10,
                    max_mag=20,
                    max_sources=100):
        """

        Query NOMAD object
        @param ra: RA of field center for search, format: degrees or hh:mm:ss
        @type ra: str
        @param dec: DEC of field center for search, format: degrees or hh:mm:ss
        @type dec: str
        @param radius: Radius.
        @type radius: float
        @param min_mag: Minimum magnitude value of query.
        @type min_mag: float
        @param max_mag: Maximum magnitude value of query.
        @type max_mag: float
        @param max_sources: Maximum strs to be queried..
        @type max_sources: int
        @return: astropy.table
        """

        c = coord.SkyCoord(ra,
                           dec,
                           unit=(u.deg, u.deg),
                           frame='icrs')
        r = radius * u.deg

        vquery = Vizier(columns=['NOMAD1',
                                 'RAJ2000',
                                 'DEJ2000',
                                 'Bmag',
                                 'Vmag',
                                 'Rmag'],
                        column_filters={"Rmag":
                                        (">{:f}".format(min_mag)),
                                        "Rmag":
                                        ("<{:f}".format(max_mag))},
                        row_limit=max_sources)

        result = vquery.query_region(c, radius=r, catalog="NOMAD")[0]

        return(result)
开发者ID:yucelkilic,项目名称:astrolib,代码行数:46,代码来源:catalog.py

示例13: query_vizier

 def query_vizier(self, catalog='APASS'):
     '''
     Uses the astroquery environment to get the data from Vizier.
     Possible selection of catalogues:
     
     '''    
     result = Vizier.query_region("%.6f %.6f"%(self.ra, self.dec), radius=Angle(self.rad, "deg"), \
         catalog=catalog) #column_filters={"rmag":">%s"%self.minmag,"rmag":"<%s"%self.maxmag }
     return result[0]
开发者ID:nblago,项目名称:utils,代码行数:9,代码来源:QueryCatalogue.py

示例14: green_catalog_download

def green_catalog_download():
    # This allows easy access to Vizier tables:
    # https://astroquery.readthedocs.org/en/latest/vizier/vizier.html
    from astroquery.vizier import Vizier
    Vizier.ROW_LIMIT = -1
    # This is the 2014-05 version of Green's catalog
    # http://vizier.u-strasbg.fr/viz-bin/VizieR?-source=VII/272
    results = Vizier.get_catalogs(['VII/272'])
    table = results[0]
    return table
开发者ID:JouvinLea,项目名称:gammapy-extra,代码行数:10,代码来源:make_green.py

示例15: calc_frame_phot_correction

def calc_frame_phot_correction(objects, cat_file, vizier_var, phot_var, cat_name='SDSS', 
                                separation=2*u.arcsec, fields=['*']):
    positions = coords.SkyCoord(objects['ra'], objects['dec'], frame='icrs', unit='deg')
    
    print('Querying Vizier')
    v_cat = Vizier(columns=fields, catalog=catalog_info[cat_name]['vizier name'])
    result = v_cat.query_region(positions, radius=separation)
    # Vizier returns a table list with a table for each catalog
    # Since we have only chosen one catalog, we take the first (and only) table
    catalog = result[0] 
    catalog.rename_column('_RAJ2000','ra')
    catalog.rename_column('_DEJ2000','dec')
    catalog.rename_column(vizier_var, phot_var)
    # remove results that have bad photometry
    #catalog = catalog[catalog[phot_var]>-9000]
    
    # only keep the catalog entries that are primary stars
    catalog = catalog[catalog['cl']==catalog_info[cat_name]['class']['star']]
    catalog = (catalog[catalog[catalog_info[cat_name]['mode']] ==
                        catalog_info[cat_name]['modes']['primary']])

    print('Finding matches for catalog stars')
    # find the corresonding object for each entry in the catalog array
    dr = coords.Angle(separation).to('degree').value
    cat_coords = coords.SkyCoord(catalog['ra'], catalog['dec'], frame='icrs', unit='deg')
    matches, d2d, d3d = cat_coords.match_to_catalog_sky(positions)
    match_col = Column(matches)
    catalog['matches'] = match_col
    
    # Remove all sources with duplicate entries (there can be a difference between
    # the astropy catalog match and the match from Vizier in a few rare cases)
    duplicates = np.where(np.bincount(match_col)>1)[0]
    for duplicate in duplicates:
        match_col[np.where(match_col==duplicate)]=-1
    catalog = catalog[match_col>=0]    

    catalog = catalog.group_by('matches')
    print('Total matches:', len(catalog.groups.keys['matches']))
    
    cat_array=np.array(catalog)
    np.save(cat_file, cat_array)
    print('Saving file',cat_file)
    return catalog
开发者ID:fred3m,项目名称:astro_pypelines,代码行数:43,代码来源:photometry.py


注:本文中的astroquery.vizier.Vizier类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。