Changeset 3022
- Timestamp:
- Aug 23, 2017 10:17:15 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIscriptable.py
r3016 r3022 694 694 self.filename = os.path.abspath(os.path.expanduser(gpxfile)) 695 695 self.data, self.names = LoadDictFromProjFile(gpxfile) 696 self.update_ids() 696 697 self.index_ids() 697 698 else: … … 758 759 self.names.append(new_names) 759 760 self.data[histname] = pwdrdata 761 self.update_ids() 760 762 return self.histogram(histname) 761 763 … … 811 813 UseList = data['Histograms'] 812 814 813 for histname in histograms: 814 if histname.startswith('HKLF '): 815 raise NotImplementedError("Does not support HKLF yet") 816 elif histname.startswith('PWDR '): 817 hist = self.histogram(histname) 818 hist['Reflection Lists'][generalData['Name']] = {} 819 UseList[histname] = SetDefaultDData('PWDR', histname, NShkl=NShkl, NDij=NDij) 820 for key, val in [('Use', True), ('LeBail', False), 821 ('newLeBail', True), 822 ('Babinet', {'BabA': [0.0, False], 823 'BabU': [0.0, False]})]: 824 if key not in UseList[histname]: 825 UseList[histname][key] = val 826 else: 827 raise NotImplementedError("Unexpected histogram" + histname) 815 for hist in histograms: 816 self.link_histogram_phase(hist, phasename) 817 # if histname.startswith('HKLF '): 818 # raise NotImplementedError("Does not support HKLF yet") 819 # elif histname.startswith('PWDR '): 820 # hist = self.histogram(histname) 821 # hist['Reflection Lists'][generalData['Name']] = {} 822 # UseList[histname] = SetDefaultDData('PWDR', histname, NShkl=NShkl, NDij=NDij) 823 # for key, val in [('Use', True), ('LeBail', False), 824 # ('newLeBail', True), 825 # ('Babinet', {'BabA': [0.0, False], 826 # 'BabU': [0.0, False]})]: 827 # if key not in UseList[histname]: 828 # UseList[histname][key] = val 829 # else: 830 # raise NotImplementedError("Unexpected histogram" + histname) 828 831 829 832 for obj in self.names: … … 840 843 self.index_ids() 841 844 845 self.update_ids() 842 846 return self.phase(phasename) 847 848 def link_histogram_phase(self, histogram, phase): 849 """Associates a given histogram and phase. 850 851 .. seealso:: 852 853 :func:`~G2Project.histogram` 854 :func:`~G2Project.phase`""" 855 hist = self.histogram(histogram) 856 phase = self.phase(phase) 857 858 generalData = phase['General'] 859 860 if hist.name.startswith('HKLF '): 861 raise NotImplementedError("HKLF not yet supported") 862 elif hist.name.startswith('PWDR '): 863 hist['Reflection Lists'][generalData['Name']] = {} 864 UseList = phase['Histograms'] 865 SGData = generalData['SGData'] 866 NShkl = len(G2spc.MustrainNames(SGData)) 867 NDij = len(G2spc.HStrainNames(SGData)) 868 UseList[hist.name] = SetDefaultDData('PWDR', hist.name, NShkl=NShkl, NDij=NDij) 869 UseList[hist.name]['hId'] = hist.id 870 for key, val in [('Use', True), ('LeBail', False), 871 ('newLeBail', True), 872 ('Babinet', {'BabA': [0.0, False], 873 'BabU': [0.0, False]})]: 874 if key not in UseList[hist.name]: 875 UseList[hist.name][key] = val 876 else: 877 raise RuntimeError("Unexpected histogram" + hist.name) 878 843 879 844 880 def reload(self): … … 935 971 return [self.phase(p) for p in obj[1:]] 936 972 return [] 973 974 def update_ids(self): 975 """Makes sure all phases and histograms have proper hId and pId""" 976 # Translated from GetUsedHistogramsAndPhasesfromTree, 977 # GSASIIdataGUI.py:4107 978 for i, h in enumerate(self.histograms()): 979 h.id = i 980 for i, p in enumerate(self.phases()): 981 p.id = i 937 982 938 983 def do_refinements(self, refinements, histogram='all', phase='all', … … 1268 1313 @property 1269 1314 def id(self): 1315 self.proj.update_ids() 1270 1316 return self.data['data'][0]['hId'] 1317 1318 @id.setter 1319 def id(self, val): 1320 self.data['data'][0]['hId'] = val 1271 1321 1272 1322 def fit_fixed_points(self): … … 1527 1577 def id(self): 1528 1578 return self.data['pId'] 1579 1580 @id.setter 1581 def id(self, val): 1582 self.data['pId'] = val 1529 1583 1530 1584 def get_cell(self):
Note: See TracChangeset
for help on using the changeset viewer.