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_EDF: .edf image file* |
---|
11 | -------------------------------------- |
---|
12 | |
---|
13 | ''' |
---|
14 | |
---|
15 | import sys |
---|
16 | import os |
---|
17 | import GSASIIIO as G2IO |
---|
18 | import GSASIIpath |
---|
19 | GSASIIpath.SetVersionNumber("$Revision: $") |
---|
20 | class EDF_ReaderClass(G2IO.ImportImage): |
---|
21 | '''Routine to read a Read European detector data .edf file. |
---|
22 | This is a particularly nice standard. |
---|
23 | ''' |
---|
24 | def __init__(self): |
---|
25 | super(self.__class__,self).__init__( # fancy way to self-reference |
---|
26 | extensionlist=('.edf',), |
---|
27 | strictExtension=True, |
---|
28 | formatName = 'EDF image', |
---|
29 | longFormatName = 'European Data Format image file' |
---|
30 | ) |
---|
31 | |
---|
32 | def ContentsValidator(self, filepointer): |
---|
33 | '''no test used at this time |
---|
34 | ''' |
---|
35 | return True |
---|
36 | |
---|
37 | def Reader(self,filename,filepointer, ParentFrame=None, **unused): |
---|
38 | '''Read using Bob's routine :func:`GSASIIIO.GetEdfData` |
---|
39 | (to be moved to this file, eventually) |
---|
40 | ''' |
---|
41 | self.Comments,self.Data,self.Npix,self.Image = G2IO.GetEdfData(filename) |
---|
42 | if self.Npix == 0 or not self.Comments: |
---|
43 | return False |
---|
44 | self.LoadImage(ParentFrame,filename) |
---|
45 | return True |
---|