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


Python astropy.coordinates方法代码示例

本文整理汇总了Python中astropy.coordinates方法的典型用法代码示例。如果您正苦于以下问题:Python astropy.coordinates方法的具体用法?Python astropy.coordinates怎么用?Python astropy.coordinates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在astropy的用法示例。


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

示例1: _get_frames

# 需要导入模块: import astropy [as 别名]
# 或者: from astropy import coordinates [as 别名]
def _get_frames():
    """
    By reading the schema files, get the list of all the frames we can
    save/load.
    """
    search = os.path.join(SCHEMA_PATH, 'coordinates', 'frames', '*.yaml')
    files = glob.glob(search)

    names = []
    for fpath in files:
        path, fname = os.path.split(fpath)
        frame, _ = fname.split('-')
        # Skip baseframe because we cannot directly save / load it.
        # Skip icrs because we have an explicit tag for it because there are
        # two versions.
        if frame not in ['baseframe', 'icrs']:
            names.append(frame)

    return names 
开发者ID:holzschu,项目名称:Carnets,代码行数:21,代码来源:frames.py

示例2: _find_bands

# 需要导入模块: import astropy [as 别名]
# 或者: from astropy import coordinates [as 别名]
def _find_bands(self, dec):
        """ Select the band or bands which encompass the provided footprint.

        The footprint will be a ndarray mask with pixel value of 1 where the exposures are located,
        and with a fully defined WCS to convert pixel positions to sky coordinates.

        """
        if not isinstance(dec, list) and not isinstance(dec, np.ndarray):
            dec = [dec]

        # Select all bands that overlap
        # find dec zones where rings.dec_min <= dec <= rings.dec_max
        maxb = dec[0] <= self.rings.field('dec_max')
        minb = dec[0] >= self.rings.field('dec_min')
        for d in dec:
            maxb = np.bitwise_and(d <= self.rings.field('dec_max'), maxb)
            minb = np.bitwise_and(d >= self.rings.field('dec_min'), minb)

        band_indx = np.where(np.bitwise_and(maxb, minb))[0]
        bands = np.sort(np.unique(band_indx))

        # Record these values as attributes for use in other methods
        self.bands = [self.rings[b] for b in bands] 
开发者ID:spacetelescope,项目名称:drizzlepac,代码行数:25,代码来源:cell_utils.py

示例3: __init__

# 需要导入模块: import astropy [as 别名]
# 或者: from astropy import coordinates [as 别名]
def __init__(self, npad, func, p_rad, coords, weights):
        self.npad = int(npad)
        self.conv_func = func
        self.p_rad = int(p_rad)
        self.coords = coords
        self.weights = weights 
开发者ID:achael,项目名称:eht-imaging,代码行数:8,代码来源:obs_helpers.py

示例4: gridder

# 需要导入模块: import astropy [as 别名]
# 或者: from astropy import coordinates [as 别名]
def gridder(data_list, gridder_info_list):
    """
    Grid the data sampled at uv points on a square array
    gridder_info_list is an list of gridder_info objects
    """

    if len(data_list) != len(gridder_info_list):
        raise Exception("length of data_list in gridder() " +
                        "is not equal to length of gridder_info_list!")

    npad = gridder_info_list[0].npad
    datagrid = np.zeros((npad, npad)).astype('c16')

    for k in range(len(gridder_info_list)):
        gridder_info = gridder_info_list[k]
        data = data_list[k]

        if gridder_info.npad != npad:
            raise Exception("npad values not consistent in gridder_info_list!")

        p_rad = gridder_info.p_rad
        coords = gridder_info.coords
        weights = gridder_info.weights

        p_rad = int(p_rad)
        for i in range(2*p_rad+1):
            dy = i - p_rad
            for j in range(2*p_rad+1):
                dx = j - p_rad
                weight = weights[i][j]
                np.add.at(datagrid, tuple(map(tuple, (coords + [dy, dx]).transpose())), data*weight)

    return datagrid 
开发者ID:achael,项目名称:eht-imaging,代码行数:35,代码来源:obs_helpers.py

示例5: generateRaDec

# 需要导入模块: import astropy [as 别名]
# 或者: from astropy import coordinates [as 别名]
def generateRaDec(self):
        """ Convert XY positions into sky coordinates using STWCS methods. """
        self.prefix = self.PAR_PREFIX

        if not isinstance(self.wcs,pywcs.WCS):
            print(
                textutil.textbox(
                    'WCS not a valid PyWCS object. '
                    'Conversion of RA/Dec not possible...'
                    ),
                file=sys.stderr
            )
            raise ValueError

        if self.xypos is None or len(self.xypos[0]) == 0:
            self.xypos = None
            warnstr = textutil.textbox(
                'WARNING: \n'
                'No objects found for this image...'
            )

            for line in warnstr.split('\n'):
                log.warning(line)

            print(warnstr)
            return

        if self.radec is None:
            print('     Found {:d} objects.'.format(len(self.xypos[0])))
            if self.wcs is not None:
                ra, dec = self.wcs.all_pix2world(self.xypos[0], self.xypos[1], self.origin)
                self.radec = [ra, dec] + copy.deepcopy(self.xypos[2:])
            else:
                # If we have no WCS, simply pass along the XY input positions
                # under the assumption they were already sky positions.
                self.radec = copy.deepcopy(self.xypos) 
开发者ID:spacetelescope,项目名称:drizzlepac,代码行数:38,代码来源:catalogs.py


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