1 | # -*- coding: utf-8 -*- |
---|
2 | ########### SVN repository information ################### |
---|
3 | # $Date: 2016-01-22 19:05:12 +0000 (Fri, 22 Jan 2016) $ |
---|
4 | # $Author: toby $ |
---|
5 | # $Revision: 2133 $ |
---|
6 | # $URL: trunk/imports/G2img_MAR.py $ |
---|
7 | # $Id: G2img_MAR.py 2133 2016-01-22 19:05:12Z toby $ |
---|
8 | ########### SVN repository information ################### |
---|
9 | ''' |
---|
10 | *Module G2img_MAR: MAR image files* |
---|
11 | -------------------------------------- |
---|
12 | |
---|
13 | ''' |
---|
14 | |
---|
15 | import sys |
---|
16 | import os |
---|
17 | import GSASIIIO as G2IO |
---|
18 | import GSASIIpath |
---|
19 | GSASIIpath.SetVersionNumber("$Revision: 2133 $") |
---|
20 | class MAR_ReaderClass(G2IO.ImportImage): |
---|
21 | '''Routine to read several MAR formats, .mar3450,.mar2300,.mar2560 |
---|
22 | ''' |
---|
23 | def __init__(self): |
---|
24 | super(self.__class__,self).__init__( # fancy way to self-reference |
---|
25 | extensionlist=('.mar3450','.mar2300','.mar2560'), |
---|
26 | strictExtension=True, |
---|
27 | formatName = 'MAR image', |
---|
28 | longFormatName = 'MAR Research 345, 230 and 256 image files' |
---|
29 | ) |
---|
30 | |
---|
31 | def ContentsValidator(self, filepointer): |
---|
32 | '''no test at this time |
---|
33 | ''' |
---|
34 | return True |
---|
35 | |
---|
36 | def Reader(self,filename,filepointer, ParentFrame=None, **unused): |
---|
37 | '''Read using Bob's routine :func:`GSASIIIO.GetMAR345Data` |
---|
38 | (to be moved to this file, eventually) |
---|
39 | ''' |
---|
40 | self.Comments,self.Data,self.Npix,self.Image = G2IO.GetMAR345Data(filename) |
---|
41 | if self.Npix == 0 or not self.Comments: |
---|
42 | return False |
---|
43 | self.LoadImage(ParentFrame,filename) |
---|
44 | return True |
---|