當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。