source: trunk/imports/G2img_SumG2.py @ 2065

Last change on this file since 2065 was 2065, checked in by toby, 7 years ago

Allow reading of multiple images from single file

  • Property svn:eol-style set to native
File size: 1.4 KB
Line 
1# -*- coding: utf-8 -*-
2########### SVN repository information ###################
3# $Date: 2014-12-27 11:14:59 -0600 (Sat, 27 Dec 2014) $
4# $Author: $
5# $Revision: $
6# $URL: $
7# $Id: $
8########### SVN repository information ###################
9'''
10*Module G2img_G2: Python pickled image*
11---------------------------------------
12
13Routine to read an image that has been pickled in Python. Images
14in this format are created by the "Sum image data" command.
15
16'''
17
18import sys
19import os
20import cPickle
21import GSASIIIO as G2IO
22import GSASIIpath
23GSASIIpath.SetVersionNumber("$Revision: $")
24class G2_ReaderClass(G2IO.ImportImage):
25    def __init__(self):
26        super(self.__class__,self).__init__( # fancy way to self-reference
27            extensionlist=('.G2img',),
28            strictExtension=True,
29            formatName = 'Summed GSAS-II image',
30            longFormatName = 'Pickled image from GSAS-II "Sum image data" command'
31            )
32
33    def ContentsValidator(self, filepointer):
34        '''no test at this time
35        '''
36        return True
37       
38    def Reader(self,filename,filepointer, ParentFrame=None, **unused):
39        '''Read using scipy PNG reader
40        '''
41        import scipy.misc
42        Fp = open(filename,'rb')
43        self.Comments,self.Data,self.Npix,self.Image = cPickle.load(Fp)
44        Fp.close()
45        self.LoadImage(ParentFrame,filename)
46        return True
Note: See TracBrowser for help on using the repository browser.