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


Python AstroData.focal_plane_mask方法代码示例

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


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

示例1: check_gmos_image

# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import focal_plane_mask [as 别名]
def check_gmos_image(filepath, calibrations=False):
    from astrodata import AstroData
    reason = "GMOS image"
    try:
        ad = AstroData(filepath)
    except:
        reason = "can't load file"
        return False, reason
    
    try:
        fp_mask = ad.focal_plane_mask().as_pytype()
    except:
        fp_mask = None

    if "GMOS" not in ad.types:
        reason = "not GMOS"
        return False, reason
    elif "GMOS_DARK" in ad.types:
        reason = "GMOS dark"
        return False, reason
    elif "GMOS_BIAS" in ad.types and not calibrations:
        reason = "GMOS bias"
        return False, reason
    elif "GMOS_IMAGE_FLAT" in ad.types and not calibrations:
        reason = "GMOS flat"
        return False, reason
    elif ("GMOS_IMAGE" in ad.types and
          fp_mask!="Imaging"):
        reason = "GMOS slit image"
        return False, reason
    elif (("GMOS_IMAGE" in ad.types and
           fp_mask == "Imaging" and
           "GMOS_DARK" not in ad.types) or
          "GMOS_BIAS" in ad.types or 
          "GMOS_IMAGE_FLAT" in ad.types):

        # Test for 3-amp mode with e2vDD CCDs
        # This mode has not been commissioned.
        dettype = ad.phu_get_key_value("DETTYPE")
        if dettype == "SDSU II e2v DD CCD42-90":
            namps = ad.phu_get_key_value("NAMPS")
            if namps is not None and int(namps)==1:
                reason = "uncommissioned 3-amp mode"
                return False, reason
            else:
                return True, reason
        else:
            return True, reason
    else:
        reason = "not GMOS image"
        return False, reason
开发者ID:pyrrho314,项目名称:recipesystem,代码行数:53,代码来源:autoredux.py

示例2: check_gmos_longslit

# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import focal_plane_mask [as 别名]
def check_gmos_longslit(filepath):
    from astrodata import AstroData
    reason = "GMOS longslit"

    try:
        ad = AstroData(filepath)
    except:
        reason = "can't load file"
        return False, reason
    
    try:
        fp_mask = ad.focal_plane_mask().as_pytype()
    except:
        fp_mask = None

    if "GMOS" not in ad.types:
        reason = "not GMOS"
        return False, reason
    elif "GMOS_DARK" in ad.types:
        reason = "GMOS dark"
        return False, reason
    elif "GMOS_BIAS" in ad.types:
        reason = "GMOS bias"
        return False, reason
    elif "GMOS_NODANDSHUFFLE" in ad.types:
        reason = "GMOS nod and shuffle"
        return False, reason
    elif "GMOS_LS" in ad.types:

        # Test for 3-amp mode with e2vDD CCDs
        # This mode has not been commissioned.
        dettype = ad.phu_get_key_value("DETTYPE")
        if dettype == "SDSU II e2v DD CCD42-90":
            namps = ad.phu_get_key_value("NAMPS")
            if namps is not None and int(namps)==1:
                reason = "uncommissioned 3-amp mode"
                return False, reason
            else:
                return True, reason
        else:
            return True, reason
    else:
        reason = "not GMOS longslit"
        return False, reason
开发者ID:pyrrho314,项目名称:recipesystem,代码行数:46,代码来源:autoredux.py

示例3: AstroData

# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import focal_plane_mask [as 别名]
# This is a GMOS_N imaging science dataset
ad = AstroData("/home/callen/SVN-AD/gemini_python/test_data/calsearch/N20110531S0114.fits")

desc_dict = {'instrument':ad.instrument().for_db(),
             'observation_type': ad.observation_type().for_db(),
             'data_label':ad.data_label().for_db(),
             'detector_x_bin':ad.detector_x_bin().for_db(),
             'detector_y_bin':ad.detector_y_bin().for_db(),
             'read_speed_setting':ad.read_speed_setting().for_db(),
             'gain_setting':ad.gain_setting().for_db(),
             'amp_read_area':ad.amp_read_area().for_db(),
             'ut_datetime':ad.ut_datetime().for_db(),
             'exposure_time':ad.exposure_time().for_db(),
             'object': ad.object().for_db(),
             'filter_name':ad.filter_name().for_db(),
             'focal_plane_mask':ad.focal_plane_mask().for_db(),
             }

print repr(desc_dict)
type_list = ad.types
ad.close()

sequence = [('descriptors', desc_dict), ('types', type_list)]
postdata = urllib.urlencode(sequence)

#postdata = urllib.urlencode({"hello":1.})
url = "http://hbffits3.hi.gemini.edu/calmgr/processed_flat/"
#url = "http://hbffits1/calmgr/processed_bias/"
# u = urllib.urlopen(url, postdata)
try:
    rq = urllib2.Request(url)
开发者ID:pyrrho314,项目名称:recipesystem,代码行数:33,代码来源:header_cal_rq.py

示例4: AcquisitionImage

# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import focal_plane_mask [as 别名]
class AcquisitionImage(object):
    def __init__(self, filename, mosmask=None, mdfdir=None):
        self.ad = AstroData(filename)
        self.mosmask = mosmask
        self.mdfdir = mdfdir

        # Determine extension
        nsci = len(self.ad)
        debug("...nsci = ", nsci)
            
        if nsci > 1:
            l_sci_ext = 1 
        else:
            l_sci_ext = 0

        debug("...using extension [" + str(l_sci_ext) + "]")

        overscan_dv = self.ad[l_sci_ext].overscan_section()

        if self.is_mos_mode():
            self.box_coords = parse_box_coords(self, self.get_mdf_filename())
            self.box_mosaic = BoxMosaic(self, self.box_coords)
            self.scidata = self.box_mosaic.get_science_data()
        elif self.is_new_gmosn_ccd():
            # tile the 2 center parts of the new GMOS image
            self.scidata = gmultiamp(self.ad)
        elif not overscan_dv.is_none():
            # remove the overscan so we don't have to take it into account when guessing the slit location
            self.scidata = subtract_overscan(self.ad[l_sci_ext])

            # it still affects the center of rotation however
            ox1, ox2, oy1, oy2 = overscan_dv.as_list()
            correction = np.array([ox2 - ox1, 0])
            center = self.get_binned_data_center() - correction
            self.fieldcenter = center * self.detector_y_bin()
        else:
            self.scidata = self.ad[l_sci_ext].data

    @cache
    def instrument(self):
        return str(self.ad.instrument())

    def is_new_gmosn_ccd(self):
        header = self.ad.phu.header
        if "DETECTOR" not in header:
            return False
        
        if header["DETECTOR"] == "GMOS + e2v DD CCD42-90":
            return True
        return False

    def get_science_data(self):
        assert self.scidata is not None
        return self.scidata

    @cache
    def unbinned_pixel_scale(self):
        return float(self.ad.pixel_scale()) / self.detector_y_bin()

    @cache
    def binned_pixel_scale(self):
        return float(self.ad.pixel_scale())

    def _check_binning(self):
        if int(self.ad.detector_x_bin()) != int(self.ad.detector_y_bin()):
            error("ERROR: incorrect binning!")
            error("Sorry about that, better luck next time.")
            sys.exit(1)

    @cache
    def detector_x_bin(self):
        self._check_binning()
        return int(self.ad.detector_x_bin())

    @cache
    def detector_y_bin(self):
        self._check_binning()
        return int(self.ad.detector_y_bin())

    @cache
    def program_id(self):
        return str(self.ad.program_id())

    @cache
    def observation_id(self):
        return str(self.ad.observation_id())

    @cache
    def saturation_level(self):
        dv = self.ad.saturation_level()
        return min(dv.as_list())

    @cache
    def focal_plane_mask(self):
        return str(self.ad.focal_plane_mask())

    @cache
    def grating(self):
        return str(self.ad.grating())

#.........这里部分代码省略.........
开发者ID:pyrrho314,项目名称:recipesystem,代码行数:103,代码来源:acquisitionimage.py

示例5: main

# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import focal_plane_mask [as 别名]

#.........这里部分代码省略.........

        imgpath = image_path(stack_filenm, ".", 
                             prefix=prefix, localsite=localsite,
                             suffix="_forStack")
        if imgpath is None:
            # If not found, check for raw image in specified directory
            # and use full reduction recipe
            imgpath = image_path(filenm, directory, 
                                 prefix=prefix, localsite=localsite)
            recipe = "qaReduceAndStack"
        else:
            # If found, just use stacking recipe
            recipe = "qaStack"
    else:
        imgpath = image_path(filenm, directory, 
                             prefix=prefix, localsite=localsite)

    if imgpath is None:
        print "\nFile %s was not found.\n" % filenm
        sys.exit()

    imgname = os.path.basename(imgpath)
    print "Image path: "+imgpath

    # Check that file is GMOS LONGSLIT or IMAGE; other types are not yet supported
    # (but do allow biases and flats, too)
    try:
        ad = AstroData(imgpath)
    except IOError:
        print "\nProblem accessing file %s.\n" % filenm
        sys.exit()

    try:
        fp_mask = ad.focal_plane_mask()
    except:
        fp_mask = None

    if "RAW" not in ad.types and "PREPARED" in ad.types:
        print "AstroDataType 'RAW'  not found in types."
        print "AstroDataType 'PREPARED' found in types."
        print "\nFile %s appears to have been processed." % imgname
        print "redux halting ..."
        sys.exit()
    if "GMOS" not in ad.types:
        print "\nFile %s is not a GMOS file." % imgname
        print "Only GMOS longslit and images can be reduced at this time.\n"
        sys.exit()
    elif "GMOS_DARK" in ad.types:
        print "\nFile %s is a GMOS dark." % imgname
        print "Only GMOS longslit and images can be reduced at this time.\n"
        sys.exit()
    elif ("GMOS_IMAGE" in ad.types and
          fp_mask!="Imaging"):
        print "\nFile %s is a slit image." % imgname
        print "Only GMOS longslit and images can be reduced at this time.\n"
        sys.exit()
    elif (("GMOS_IMAGE" in ad.types and
           fp_mask=="Imaging" and 
           "GMOS_DARK" not in ad.types) or 
          "GMOS_BIAS" in ad.types or 
          "GMOS_IMAGE_FLAT" in ad.types or 
          "GMOS_LS" in ad.types):

        # Test for 3-amp mode with e2vDD CCDs. NOT commissioned.
        dettype = ad.phu_get_key_value("DETTYPE")
        if dettype=="SDSU II e2v DD CCD42-90":
开发者ID:pyrrho314,项目名称:recipesystem,代码行数:70,代码来源:redux.py


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