source: trunk/imports/G2img_SumG2.py @ 2015

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

redo image read to avoid reloads; prevent open of Edit image parms on reread; fix multilevel TIF read error; cleanup self in GSASIIimage

  • 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 GSASIIIO as G2IO
21import GSASIIpath
22GSASIIpath.SetVersionNumber("$Revision: $")
23class G2_ReaderClass(G2IO.ImportImage):
24    def __init__(self):
25        super(self.__class__,self).__init__( # fancy way to self-reference
26            extensionlist=('.G2img',),
27            strictExtension=True,
28            formatName = 'Summed GSAS-II image',
29            longFormatName = 'Pickled image from GSAS-II "Sum image data" command'
30            )
31
32    def ContentsValidator(self, filepointer):
33        '''no test at this time
34        '''
35        return True
36       
37    def Reader(self,filename,filepointer, ParentFrame=None, **unused):
38        '''Read using scipy PNG reader
39        '''
40        import scipy.misc
41        Fp = open(filename,'rb')
42        self.Comments,self.Data,self.Npix,self.image = cPickle.load(Fp)
43        Fp.close()
44        self.LoadImage(ParentFrame,filename)
45        return True
46# N.B. This replaces G2IO.GetG2Image
Note: See TracBrowser for help on using the repository browser.