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


Python AstroData.phu_get_key_value方法代码示例

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


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

示例1: check_gmos_image

# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import phu_get_key_value [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 phu_get_key_value [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: recover

# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import phu_get_key_value [as 别名]
 def recover(self):
     log.debug("OutAtList recover()")
     adlist = []
     for i, tmpname in enumerate(self.diskoutlist):
         ad = AstroData(tmpname, mode="update")
         ad.filename = self.ad_name[i]
         ad = gemini_tools.obsmode_del(ad)
         # Read the database back in, if it exists
         try:
             ad = gemini_tools.read_database(
                 ad, database_name=self.database_name, 
                 input_name=self.tmpin_name[i], 
                 output_name=ad.phu_get_key_value("ORIGNAME"))
         except:
             pass
         adlist.append(ad)
         log.fullinfo(tmpname + " was loaded into memory")
     return adlist
开发者ID:pyrrho314,项目名称:recipesystem,代码行数:20,代码来源:gstransformfile.py

示例4: AcquisitionImage

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

#.........这里部分代码省略.........
        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())

    def get_detector_size(self):
        # mos mode acquisitions don't necessarily have the entire
        # field of view in their data sections, so we have to rely on
        # other tricks to figure out the center of rotation.

        detsize = self.ad.phu_get_key_value("DETSIZE")
        xmin, xdim, ymin, ydim = extract_dimensions(detsize)
        
        # adjust for chip gaps
        nccds = int(self.ad.phu_get_key_value("NCCDS"))
        xdim += ((nccds - 1) * _obtain_unbinned_arraygap(self.ad))

        # adjust for un-illuminated pixels
        if self.is_gmos():
            ydim -= 36 # magic number that should be replaced with a lookup table later

        return xdim, ydim
        

    def get_field_center(self):
        """ The center of rotation in pixels. """
        if hasattr(self, "fieldcenter"):
            return self.fieldcenter

        if self.is_mos_mode():
            xdim, ydim = self.get_detector_size()
            return np.array([float(xdim) / 2.0, float(ydim) / 2.0])

        return self.get_data_center()

    def get_data_center(self):
        ydim, xdim = self.get_science_data().shape
        return np.array([float(xdim) / 2.0, float(ydim) / 2.0]) * self.detector_y_bin()

    def get_binned_data_center(self):
        return self.get_data_center() / self.detector_y_bin()

    def set_goal_center(self, center):
开发者ID:pyrrho314,项目名称:recipesystem,代码行数:70,代码来源:acquisitionimage.py

示例5: test_method_phu_get_key_val_6

# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import phu_get_key_value [as 别名]
def test_method_phu_get_key_val_6():
    ad = AstroData(TESTFILE2)
    with pytest.raises(TypeError):
        assert ad.phu_get_key_value()
开发者ID:mmorage,项目名称:DRAGONS,代码行数:6,代码来源:test_AstroDataAPI.py

示例6: test_method_phu_get_key_val_5

# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import phu_get_key_value [as 别名]
def test_method_phu_get_key_val_5():
    ad = AstroData(TESTFILE2)
    assert ad.phu_get_key_value('FOO') is None
开发者ID:mmorage,项目名称:DRAGONS,代码行数:5,代码来源:test_AstroDataAPI.py

示例7: test_method_phu_get_key_val_3

# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import phu_get_key_value [as 别名]
def test_method_phu_get_key_val_3():
    ad = AstroData(TESTFILE2)
    assert isinstance(ad.phu_get_key_value('RA'), float)
开发者ID:mmorage,项目名称:DRAGONS,代码行数:5,代码来源:test_AstroDataAPI.py

示例8: test_method_phu_get_key_val_2

# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import phu_get_key_value [as 别名]
def test_method_phu_get_key_val_2():
    ad = AstroData(TESTFILE2)
    assert isinstance(ad.phu_get_key_value('BITPIX'), int)
开发者ID:mmorage,项目名称:DRAGONS,代码行数:5,代码来源:test_AstroDataAPI.py

示例9: test_method_phu_get_key_val_1

# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import phu_get_key_value [as 别名]
def test_method_phu_get_key_val_1():
    ad = AstroData(TESTFILE2)
    assert isinstance(ad.phu_get_key_value('SIMPLE'), bool)
开发者ID:mmorage,项目名称:DRAGONS,代码行数:5,代码来源:test_AstroDataAPI.py

示例10: main

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

#.........这里部分代码省略.........
        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":
            namps = ad.phu_get_key_value("NAMPS")
            if namps is not None and int(namps)==1:
                print "\nERROR: The GMOS e2v detectors should " \
                      "not use 3-amp mode!"
                print "Please set the GMOS CCD Readout Characteristics " \
                      "to use 6 amplifiers.\n"
                sys.exit()

        print "\nBeginning reduction for file %s, %s\n" % (imgname,
                                                           ad.data_label()) 
        if options.upload:
            context = "QA,upload"
        else:
            context = "QA"

        # Check for an alternate recipe for science reductions
        if ("GMOS_IMAGE" in ad.types and
            "GMOS_BIAS" not in ad.types and 
            "GMOS_IMAGE_FLAT" not in ad.types and
            recipe is not None):
            reduce_cmd = ["reduce",
                          "-r", recipe,
                          "--context",context,
                          "--loglevel","stdinfo",
                          "--logfile","gemini.log",
                          "-p", "clobber=True",
                          imgpath]
        else:
            # Otherwise call reduce with auto-selected reduction recipe
            reduce_cmd = ["reduce", 
                          "--context",context,
                          "--loglevel","stdinfo",
                          "--logfile","gemini.log",
                          "-p", "clobber=True",
                          imgpath]
            
        subprocess.call(reduce_cmd)

        print ""

    else:
        print "\nFile %s is not a supported type." % imgname
        print "Only GMOS longslit and images can be reduced at this time.\n"
        sys.exit()
开发者ID:pyrrho314,项目名称:recipesystem,代码行数:104,代码来源:redux.py


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