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


Python Frame.read_frame_from_file方法代码示例

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


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

示例1: run_analysis

# 需要导入模块: from frame import Frame [as 别名]
# 或者: from frame.Frame import read_frame_from_file [as 别名]
def run_analysis():

    # turn on interactive use of pyplot
    plt.ion()

    # read in and process dark file if it's supplied
    dark_frames = None
    if args.dark != None:
        print('Reading dark frames from ', args.dark)
        filename_dark_flat = utils.get_flat_filename( args.dark, args.tag )
        
        #process the dark file
        dark_frames = Dark(args.dark,filename_dark_flat,100)
        
    else:
        print('No dark file supplied.')

    # read frames one by one, either from file or shared memory

    if args.light != None:

        print('Read frames from data file ', args.light)

        # create the frame object that holds the frame
        frame = Frame()
        frame.debug = True
        
        # read the binary file
        idx = 0
        nframes = 0
        with open(args.light,'rb') as f:

            while True:
                try:
                    print('Read frame from file  idx ', idx)
                    # read a frame from the file
                    idx = frame.read_frame_from_file(f, idx)

                    print('frame at index ', frame.index)
                    print('frame nframes ', frame.nframes)
                    print('new idx ', idx)

                    print('raw frame ', frame.raw_frame)
                    print('flat frame ', frame.flat_frame)

                    nframes += frame.nframes
                    print('Read ', nframes, ' so far')
                except IndexError:
                    print(' caught IndexError: found ', nframes, nframes)
                    break
        
    else:
         print('Read frames from shared mem is not implemented yet')
开发者ID:perhansson,项目名称:daq,代码行数:55,代码来源:epix_mon.py


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