- Timestamp:
- Nov 1, 2020 11:11:13 AM (3 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIIO.py
r4619 r4635 116 116 asind = lambda x: 180.*math.asin(x)/math.pi 117 117 wave = 1.54052 118 File = open(fileName,' Ur')118 File = open(fileName,'r') 119 119 Comments = [] 120 120 peaks = [] -
trunk/GSASIIconstrGUI.py
r4624 r4635 1820 1820 if dlg.ShowModal() == wx.ID_OK: 1821 1821 macfile = dlg.GetPath() 1822 macro = open(macfile,' Ur')1822 macro = open(macfile,'r') 1823 1823 head = macro.readline() 1824 1824 if macName not in head: … … 1841 1841 txtfile = dlg.GetPath() 1842 1842 ext = os.path.splitext(txtfile)[1] 1843 text = open(txtfile,' Ur')1843 text = open(txtfile,'r') 1844 1844 else: # cancel was pressed 1845 1845 ext = '' … … 2583 2583 filename = filelist[0] 2584 2584 rd = reader 2585 with open(filename, ' Ur'):2585 with open(filename, 'r'): 2586 2586 rd.ReInitialize() 2587 2587 rd.errors = "" -
trunk/GSASIIdataGUI.py
r4628 r4635 694 694 except UnicodeDecodeError: 695 695 rdmsg = None 696 fp.close() 696 697 if rdmsg is None or not all([ord(c) < 128 and ord(c) != 0 for c in rdmsg]): # show only if ASCII 697 698 rdmsg = u'File '+ filename +u' is a binary file. Do you want to read this file?' … … 1464 1465 fp = 0 1465 1466 try: 1466 fp = open(instfile,' Ur')1467 fp = open(instfile,'r') 1467 1468 Iparm = {} 1468 1469 for S in fp: -
trunk/GSASIIfiles.py
r4594 r4635 644 644 G2Print('Read '+lblFil) 645 645 # scan through each line in this .par file, looking for the matching image rootname 646 fp = open(parFil,' Ur')646 fp = open(parFil,'r') 647 647 for iline,line in enumerate(fp): 648 648 items = line.strip().split(' ') … … 680 680 labels = {} 681 681 errors = [] 682 fp = open(lblFil,' Ur') # read column labels682 fp = open(lblFil,'r') # read column labels 683 683 for iline,line in enumerate(fp): # read label definitions 684 684 line = line.strip() -
trunk/GSASIIimgGUI.py
r4619 r4635 4015 4015 imageName = os.path.splitext(os.path.split(fileorline)[1])[0] 4016 4016 4017 fp = open(parFile,' Ur')4017 fp = open(parFile,'r') 4018 4018 for iline,line in enumerate(fp): 4019 4019 if linenum is not None: -
trunk/GSASIIrestrGUI.py
r4594 r4635 80 80 if dlg.ShowModal() == wx.ID_OK: 81 81 macfile = dlg.GetPath() 82 macro = open(macfile,' Ur')82 macro = open(macfile,'r') 83 83 head = macro.readline() 84 84 if macName not in head: … … 98 98 if dlg.ShowModal() == wx.ID_OK: 99 99 csvfile = dlg.GetPath() 100 mogul = open(csvfile,' Ur')100 mogul = open(csvfile,'r') 101 101 head = mogul.readline() 102 102 if 'Type' not in head: -
trunk/GSASIIscriptable.py
r4607 r4635 472 472 be either a dictionary of 'low' and/or 'high', 473 473 or a list of 2 items [low, high] 474 \ 475 \ 474 \\ low Sets the low limit 475 \\ high Sets the high limit 476 476 477 477 Sample Parameters Should be provided as a **list** of subkeys 478 to set or clear, 479 \ 480 \ 481 \ 482 \ 483 \ 478 to set or clear,\\e.g. ['DisplaceX', 'Scale'] 479 \\ Absorption 480 \\ Contrast 481 \\ DisplaceX Sample displacement along the X direction 482 \\ DisplaceY Sample displacement along the Y direction 483 \\ Scale Histogram Scale factor 484 484 485 485 Background Sample background. Value will be a dict or … … 491 491 When value is a dict, 492 492 supply any of the following keys: 493 \ 494 \ 495 \ 496 \ 497 \ 498 \ 493 \\ type The background model, e.g. 'chebyschev-1' 494 \\ refine The value of the refine flag, boolean 495 \\ 'no. coeffs' Number of coefficients to use, integer 496 \\ coeffs List of floats, literal values for background 497 \\ FixedPoints List of (2-theta, intensity) values for fixed points 498 \\ 'fit fixed points' If True, triggers a fit to the fixed points to 499 499 be calculated. It is calculated when this key is 500 500 detected, regardless of calls to refine. 501 \ 501 \\ peaks Specifies a set of flags for refining 502 502 background peaks as a nested list. There may 503 503 be an item for each defined background peak … … 509 509 subkeys to 510 510 set or clear, e.g. ['X', 'Y', 'Zero', 'SH/L'] 511 \ 512 \ 513 \ 511 \\ U, V, W Gaussian peak profile terms 512 \\ X, Y, Z Lorentzian peak profile terms 513 \\ alpha, beta-0, TOF profile terms 514 514 beta-1, beta-q, 515 \ 515 \\ sig-0, sig-1, TOF profile terms 516 516 sig-2, sig-q 517 \ 518 \ 519 \ 520 \ 521 \ 517 \\ difA, difB, difC TOF Calibration constants 518 \\ Zero Zero shift 519 \\ SH/L Finger-Cox-Jephcoat low-angle peak asymmetry 520 \\ Polariz. Polarization parameter 521 \\ Lam Lambda, the incident wavelength 522 522 ===================== ==================== ================================================= 523 523 … … 572 572 subkeys. If not, assumes both 573 573 BabA and BabU 574 \ 575 \ 574 \\ BabA 575 \\ BabU 576 576 Extinction Boolean, True to refine. 577 577 HStrain Boolean or list/tuple, True to refine all 578 appropriate D\ :sub:`ij` terms or False578 appropriate D\\ :sub:`ij` terms or False 579 579 to not refine any. If a list/tuple, will 580 580 be a set of True & False values for each 581 D\ :sub:`ij` term; number of items must581 D\\ :sub:`ij` term; number of items must 582 582 match number of terms. 583 583 Mustrain 584 \ 584 \\ type Mustrain model. One of 'isotropic', 585 585 'uniaxial', or 'generalized'. **Should always 586 586 be included when Mustrain is used.** 587 \ directionFor uniaxial only. A list of three587 \\ direction For uniaxial only. A list of three 588 588 integers, 589 589 the [hkl] direction of the axis. 590 \ 590 \\ refine Usually boolean, set to True to refine. 591 591 or False to clear. 592 592 For uniaxial model, can specify a value … … 595 595 boolean sets both axial and equatorial. 596 596 Size 597 \ 597 \\ type Size broadening model. One of 'isotropic', 598 598 'uniaxial', or 'ellipsoid'. **Should always 599 599 be specified when Size is used.** 600 \ directionFor uniaxial only. A list of three600 \\ direction For uniaxial only. A list of three 601 601 integers, 602 602 the [hkl] direction of the axis. 603 \ 604 \ 603 \\ refine Boolean, True to refine. 604 \\ value float, size value in microns 605 605 Pref.Ori. Boolean, True to refine 606 606 Show Boolean, True to refine … … 718 718 in Windows:: 719 719 720 Z:\ >fc before.txt after.txt720 Z:\\>fc before.txt after.txt 721 721 Comparing files before.txt and after.txt 722 722 ***** before.txt … … 1186 1186 import argparse 1187 1187 import os.path as ospath 1188 import datetime as dt1188 #import datetime as dt 1189 1189 import sys 1190 1190 import platform … … 1195 1195 import pickle as cPickle 1196 1196 strtypes = (str,bytes) 1197 import imp1197 #import imp 1198 1198 import copy 1199 1199 import os … … 1690 1690 raise G2ImportException("Could not read file: ", filename) 1691 1691 1692 with open(filename, ' Ur') as fp:1692 with open(filename, 'r'): 1693 1693 rd_list = [] 1694 1694 … … 1768 1768 # It's an old GSAS file, load appropriately 1769 1769 Iparm = {} 1770 with open(instfile, ' Ur') as fp:1770 with open(instfile, 'r') as fp: 1771 1771 for line in fp: 1772 1772 if '#' in line: … … 4076 4076 for o in obj: 4077 4077 print('\t',o.formatName) 4078 raise G2ScriptException('Bad format hint for file type = "'+exten +'"')4078 raise G2ScriptException('Bad format hint for file type = "'+extension+'"') 4079 4079 self._SetFromArray(obj) 4080 4080 obj.Writer(self.name,fil) … … 4794 4794 from exports import G2export_CIF as cif 4795 4795 4796 CIFdate = dt.datetime.strftime(dt.datetime.now(),"%Y-%m-%dT%H:%M")4796 # CIFdate = dt.datetime.strftime(dt.datetime.now(),"%Y-%m-%dT%H:%M") 4797 4797 CIFname = os.path.splitext(self.proj.filename)[0] 4798 4798 CIFname = os.path.split(CIFname)[1] 4799 4799 CIFname = ''.join([c if ord(c) < 128 else '' 4800 4800 for c in CIFname.replace(' ', '_')]) 4801 try:4802 author = self.proj['Controls']['data'].get('Author','').strip()4803 except KeyError:4804 pass4805 oneblock = True4801 # try: 4802 # author = self.proj['Controls']['data'].get('Author','').strip() 4803 # except KeyError: 4804 # pass 4805 # oneblock = True 4806 4806 4807 4807 covDict = self.proj['Covariance']['data'] … … 5236 5236 :param str parmType: should be 'size' or 'microstrain' (can be abbreviated to 's' or 'm') 5237 5237 :param str mode: should be 'isotropic' or 'uniaxial' (can be abbreviated to 'i' or 'u') 5238 :param float val1: value for isotropic size (in :math:`\ mu m`) or5239 microstrain (unitless, :math:`\ Delta Q/Q \\times 10^6`) or the equatorial value in the uniaxial case5240 :param float val2: value for axial size (in :math:`\ mu m`) or5241 axial microstrain (unitless, :math:`\ Delta Q/Q \\times 10^6`)5238 :param float val1: value for isotropic size (in :math:`\\mu m`) or 5239 microstrain (unitless, :math:`\\Delta Q/Q \\times 10^6`) or the equatorial value in the uniaxial case 5240 :param float val2: value for axial size (in :math:`\\mu m`) or 5241 axial microstrain (unitless, :math:`\\Delta Q/Q \\times 10^6`) 5242 5242 in uniaxial case; not used for isotropic 5243 5243 :param list axis: tuple or list with three values indicating the preferred direction … … 5328 5328 if item in list(copydict.keys()): 5329 5329 del copydict[item] 5330 else:5331 G2fil.G2Print('items in HAP dict are: {}'.format(5332 list(self.data['Histograms'][sourcehist])))5333 raise Exception('HAP skip list entry {} invalid'.format(item))5330 # else: 5331 # G2fil.G2Print('items in HAP dict are: {}'.format( 5332 # list(self.data['Histograms'][sourcehist]))) 5333 # raise Exception('HAP skip list entry {} invalid'.format(item)) 5334 5334 if use: 5335 5335 for item in list(copydict.keys()): … … 6881 6881 d = d[k] 6882 6882 l = [] 6883 first = True6883 # first = True 6884 6884 if type(d) is dict: 6885 6885 [dictDive(d[key],search,keylist+[key],False,l) for key in d] -
trunk/imports/G2phase_CIF.py
r4476 r4635 52 52 def ContentsValidator(self, filename): 53 53 fp = open(filename,'r') 54 returnself.CIFValidator(fp)54 ok = self.CIFValidator(fp) 55 55 fp.close() 56 return ok 56 57 57 58 def Reader(self,filename, ParentFrame=None, usedRanIdList=[], **unused):
Note: See TracChangeset
for help on using the changeset viewer.