Changeset 3330


Ignore:
Timestamp:
Mar 31, 2018 8:40:02 AM (4 years ago)
Author:
vondreele
Message:

modify Bruker image import to keep "TARGET" and use it in SaveIntegration? to put Ka1/Ka2 wavelengths into PWDR Instrument Parameters

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIIO.py

    r3319 r3330  
    688688def SaveIntegration(G2frame,PickId,data,Overwrite=False):
    689689    'Save image integration results as powder pattern(s)'
     690    waves = {'Cu':[1.54051,1.54433],'Ti':[2.74841,2.75207],'Cr':[2.28962,2.29351],
     691        'Fe':[1.93597,1.93991],'Co':[1.78892,1.79278],'Mo':[0.70926,0.713543],
     692        'Ag':[0.559363,0.563775]}
    690693    azms = G2frame.Integrate[1]
    691694    X = G2frame.Integrate[2][:-1]
     
    697700    Controls = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.root, 'Controls'))
    698701    if 'PWDR' in name:
    699         names = ['Type','Lam','Zero','Polariz.','U','V','W','X','Y','Z','SH/L','Azimuth']
    700         codes = [0 for i in range(12)]
     702        if 'target' in data:
     703            names = ['Type','Lam1','Lam2','I(L2)/I(L1)','Zero','Polariz.','U','V','W','X','Y','Z','SH/L','Azimuth']
     704            codes = [0 for i in range(14)]
     705        else:
     706            names = ['Type','Lam','Zero','Polariz.','U','V','W','X','Y','Z','SH/L','Azimuth']
     707            codes = [0 for i in range(12)]
    701708    elif 'SASD' in name:
    702709        names = ['Type','Lam','Zero','Azimuth']
     
    758765                        Controls['FreePrm'+num] = item.split('=')[1].strip()
    759766        if 'PWDR' in Aname:
    760             parms = ['PXC',data['wavelength'],0.0,polariz,1.0,-0.10,0.4,0.30,1.0,0.0,0.0001,Azms[i]]
     767            if 'target' in data:    #from lab x-ray 2D imaging data
     768                wave1,wave2 = waves[data['target']]
     769                parms = ['PXC',wave1,wave2,0.5,0.0,polariz,290.,-40.,30.,6.,-14.,0.0,0.0001,Azms[i]]
     770            else:
     771                parms = ['PXC',data['wavelength'],0.0,polariz,1.0,-0.10,0.4,0.30,1.0,0.0,0.0001,Azms[i]]
    761772        elif 'SASD' in Aname:
    762773            Sample['Trans'] = data['SampleAbs'][0]
  • trunk/imports/G2img_SFRM.py

    r3327 r3330  
    1717import GSASIIobj as G2obj
    1818import GSASIIpath
    19 import struct as st
    2019import numpy as np
    21 import unpack_cbf as cbf
    2220GSASIIpath.SetVersionNumber("$Revision: 3207 $")
    2321class SFRM_ReaderClass(G2obj.ImportImage):
     
    2927            strictExtension=True,
    3028            formatName = 'SFRM image',
    31             longFormatName = 'SFRM Binary Data Format image file'
     29            longFormatName = 'Bruker SFRM Binary Data Format image file'
    3230            )
    3331
     
    3836       
    3937    def Reader(self,filename, ParentFrame=None, **unused):
    40         '''Read using Bob's routine :func:`GetCbfData`
     38        '''Read using Bob's routine :func:`GetSFRMData`
    4139        '''
    4240        self.Comments,self.Data,self.Npix,self.Image = GetSFRMData(self,filename)
     
    7371        if 'TARGET' in line:
    7472            wave = meanwaves[fields[0]]
     73            target = fields[0].capitalize()
    7574        elif 'DISTANC' in line:
    7675            dist = float(fields[0])*10.
    77 #        elif 'Pixel_size' in line:
    78 #            pixSize = [float(fields[2])*1.e6,float(fields[5])*1.e6]
    7976        elif 'CENTER' in line:
    8077            cent = [float(fields[0]),float(fields[1])]
     
    116113    image = np.reshape(img,(sizexy[1],sizexy[0]))
    117114    print ('import time: %.3f'%(time.time()-time0))
    118     data = {'pixelSize':pixSize,'wavelength':wave,'distance':dist,'center':cent,'size':sizexy}
     115    data = {'pixelSize':pixSize,'wavelength':wave,'distance':dist,'center':cent,'size':sizexy,'target':target}
    119116    Npix = sizexy[0]*sizexy[1]
    120117   
Note: See TracChangeset for help on using the changeset viewer.