Changeset 5241 for trunk/exports/G2export_Bracket.py
- Timestamp:
- Mar 20, 2022 9:25:59 PM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/exports/G2export_Bracket.py
r5232 r5241 81 81 82 82 # Get phase and weight fractions uncertainties, if they have been refined 83 for hist_num in range(0, len(self.Histograms.keys())):83 for hist_num,hist_name in enumerate(self.Histograms): 84 84 try: 85 85 # Get phase fraction uncertainty, if phase fractions have been refined 86 86 phasefrac_unc = self.sigDict[str(phase_num) + ':' + str(hist_num) + ':Scale'] 87 87 # Get name of histogram associated with this phase, for later use 88 hist_name = list(self.Histograms.keys())[hist_num]88 #hist_name = list(self.Histograms.keys())[hist_num] 89 89 # Extract phase fraction value 90 90 phasefrac = phasedict[1]['Histograms'][hist_name]['Scale'][0] 91 92 # Extract weight fraction and uncertainty 93 # weight_frac = self.OverallParms['Covariance']['depSig'][ 94 # str(phase_num) + ':' + str(hist_num) + ':WeightScale'] 95 # weight_frac_unc = self.OverallParms['Covariance']['depSig'][ 96 # str(phase_num) + ':' + str(hist_num) + ':WeightScaleSig'] 91 # Write phase if there is more than one histogram, specify which one 92 if len(self.Histograms) > 1: 93 model_parameters[phasenam + " Phase Fraction in: " + hist_name] = ( 94 ValEsd(phasefrac, phasefrac_unc)) 95 # If there is only one histogram, no need to specify which histogram the fraction is based on 96 else: 97 model_parameters[phasenam + " Phase Fraction"] = ValEsd(phasefrac, phasefrac_unc) 98 except: 99 pass 100 101 try: 97 102 var = str(phase_num) + ':' + str(hist_num) + ':WgtFrac' 98 103 depSigDict = self.OverallParms['Covariance'].get('depSigDict',{}) … … 101 106 # Write phase + weight fractions in bracket notation to dictionary, to be exported as a CSV 102 107 # If there is more than one histogram, specify which one the fraction is based on 103 if len(self.Histograms.keys()) > 1: 104 model_parameters[phasenam + " Phase Fraction in: " + hist_name] =\ 105 ValEsd(phasefrac, phasefrac_unc) 106 model_parameters[phasenam + " Weight Fraction in: " + hist_name] = \ 107 ValEsd(weight_frac, weight_frac_unc) 108 if len(self.Histograms) > 1: 109 model_parameters[phasenam + " Weight Fraction in: " + hist_name] = ( 110 ValEsd(weight_frac, weight_frac_unc)) 108 111 # If there is only one histogram, no need to specify which histogram the fraction is based on 109 112 else: 110 model_parameters[phasenam + " Phase Fraction"] = ValEsd(phasefrac, phasefrac_unc)111 113 model_parameters[phasenam + " Weight Fraction"] = ValEsd(weight_frac, weight_frac_unc) 112 114 except: … … 128 130 # Write MD ratio to dictionary to be exported 129 131 model_parameters[phasenam + " March Dollase Ratio"] = MD_bracket 130 # Increment phase number counter131 phase_num += 1132 132 except: 133 133 pass 134 # Increment phase number counter 135 phase_num += 1 134 136 135 137 # Extract sample displacements, zero offset and D(ij)s (if refined) 136 for hist_num in range(0, len(self.Histograms.keys())):137 hist_num = str( hist_num)138 for i,hist_name in enumerate(self.Histograms): 139 hist_num = str(i) 138 140 # Extract zero offset, if refined 139 141 GetParamSig("", hist_num, ':Zero', "Zero Offset") … … 145 147 GetParamSig("", hist_num, ':DisplaceY', "Sample Y Displacement (micron)") 146 148 # Extract hydrostatic strains, if refined 147 for phase_num in range(0, len(self.Phases.keys())): 148 phase_name = list(self.Phases.keys())[phase_num] 149 for phase_num,phase_name in enumerate(self.Phases): 149 150 for d_i in range(1, 4): 150 151 for d_j in range(1, 4): … … 153 154 154 155 # Extract atomic parameters, if refined 155 for phase_num in range(0, len(self.Phases.keys())):156 phase_name = list(self.Phases.keys())[phase_num]157 atom_list = list(self.Phases.values())[phase_num]["Atoms"]158 for atom_num in range(0, len(atom_list)):156 for phase_num,phase_name in enumerate(self.Phases): 157 # atom_list = list(self.Phases.values())[phase_num]["Atoms"] 158 atom_list = self.Phases[phase_name]["Atoms"] # same as above? 159 for atom_num,atom in enumerate(atom_list): 159 160 # Extract isotropic thermal parameters, if refined 160 161 GetParamSig(str(phase_num), ':', 'AUiso:' + str(atom_num), 161 phase_name + ' ' + atom _list[atom_num][0] + ' Uiso')162 phase_name + ' ' + atom[0] + ' Uiso') 162 163 # Extract anisotropic thermal parameters (Uijs), if refined 163 164 for Ui in range(1, 4): 164 165 for Uj in range(1, 4): 165 166 GetParamSig(str(phase_num), ':', 'AU' + str(Ui) + str(Uj) + ':' + str(atom_num), 166 phase_name + ' ' + atom _list[atom_num][0] + ' U' + str(Ui) + str(Uj))167 phase_name + ' ' + atom[0] + ' U' + str(Ui) + str(Uj)) 167 168 # Extract fractional occupancies, if refined 168 169 GetParamSig(str(phase_num), ':', 'Afrac:' + str(atom_num), 169 phase_name + ' ' + atom _list[atom_num][0] + ' Occupancy')170 phase_name + ' ' + atom[0] + ' Occupancy') 170 171 # Extract atom X Y Z, if refined 171 172 for atom_axis in ('x', 'y', 'z'): … … 179 180 atom_axis_val = list(self.Phases.values())[phase_num]["Atoms"][atom_num][ord(atom_axis)-117] 180 181 # Convert to bracket notation and add to dictionary, which will be exported as a CSV 181 model_parameters[phase_name + ' ' + atom _list[atom_num][0] + ' ' + atom_axis] = \182 model_parameters[phase_name + ' ' + atom[0] + ' ' + atom_axis] = \ 182 183 ValEsd(atom_axis_val, atom_axis_sig) 183 184 except: pass
Note: See TracChangeset
for help on using the changeset viewer.