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


Python CameraGeometry.guess_camera_geometry方法代码示例

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


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

示例1: load_hessio

# 需要导入模块: from ctapipe.instrument import CameraGeometry [as 别名]
# 或者: from ctapipe.instrument.CameraGeometry import guess_camera_geometry [as 别名]
def load_hessio(filename):
    """
    Function to open and load a hessio file
    
    Parameters
    ----------
    filename: string
        name of the file
    """
    print("Hessio file will be opened.")
    with open_hessio(filename) as h:
        h.fill_next_event()
        #version = h.get...
        version = 'Feb2016'

        #Creating 3 dictionaries where the instrument configuration will be stored
        #The dictionaries themselves contain astropy.table.Table objects
        telescope = {}
        camera = {}
        optics = {}

        #--------------------------------------------------------------------------
        #Telescope configuration
        tel_table_prime = Table()
        tel_table_prime.meta = {'VERSION': version}

        try:
            tel_id = h.get_telescope_ids()
            tel_table_prime['TelID']= tel_id
        except: pass
        try:
            tel_posX = [h.get_telescope_position(i)[0] for i in tel_id]
            tel_table_prime['TelX'] = tel_posX
            tel_table_prime['TelX'].unit = u.m
            tel_table_prime.meta['TelX_description'] =\
            'x-position of the telescope measured by...'
        except: pass
        try:
            tel_posY = [h.get_telescope_position(i)[1] for i in tel_id]
            tel_table_prime['TelY'] = tel_posY
            tel_table_prime['TelY'].unit = u.m
        except: pass
        try:
            tel_posZ = [h.get_telescope_position(i)[2] for i in tel_id]
            tel_table_prime['TelZ'] = tel_posZ
            tel_table_prime['TelZ'].unit = u.m
        except: pass
        try: tel_table_prime['CameraClass'] = [h.get_camera_class(i) for i in tel_id]
        except: pass
        try:
            tel_table_prime['MirA'] = [h.get_mirror_area(i) for i in tel_id]
            tel_table_prime['MirA'].unit = u.m**2
        except: pass
        try:  tel_table_prime['MirN'] = [h.get_mirror_number(i) for i in tel_id]
        except: pass
        try:
            tel_table_prime['FL'] = [h.get_optical_foclen(i) for i in tel_id]
            tel_table_prime['FL'].unit = u.m
        except: pass
        try: tel_table_prime.meta['TelNum'] =  len(tel_posX)
        except: pass

        #Beside other tables containimng telescope configuration data, the main
        #telescope table is written into the telescope dictionary.
        telescope['TelescopeTable_Version%s' % version] = tel_table_prime

        #--------------------------------------------------------------------------
        #Camera and Optics configuration
        try:
            for t in range(len(tel_id)):

                cam_table_prime = Table()
                cam_table_prime.meta = {'TELID': tel_id[t], 'VERSION': version}
                opt_table_prime = Table()
                opt_table_prime.meta = {'TELID': tel_id[t], 'VERSION': version}

                try:
                    pix_posX = h.get_pixel_position(tel_id[t])[0]
                    pix_id = np.arange(len(pix_posX))
                    cam_table_prime['PixID'] = pix_id
                    cam_table_prime['PixX'] = pix_posX
                    cam_table_prime['PixX'].unit = u.m
                    cam_table_prime.meta['PixXDescription'] =\
                    'x-position of the pixel measured by...'
                except: pass
                try:
                    pix_posY = h.get_pixel_position(tel_id[t])[1]
                    cam_table_prime['PixY'] = pix_posY
                    cam_table_prime['PixY'].unit = u.m
                except: pass
                try:
                    camera_class = CD.guess_camera_geometry(pix_posX*u.m,pix_posY*u.m)
                    pix_area_prime = camera_class.pix_area
                    pix_type_prime = camera_class.pix_type
                    pix_neighbors_prime = camera_class.pix_neighbors
                except: pass

                try:
                    pix_area = h.get_pixel_area(tel_id[t])
                    cam_table_prime['PixA'] = pix_area
#.........这里部分代码省略.........
开发者ID:wrijupan,项目名称:ctapipe,代码行数:103,代码来源:InstrumentDescription.py


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