@@ -2025,15 +2025,26 @@ def onPartialConfig(event):
20252025 totalrange = 0
20262026 DZmax = 0
20272027 DZmin = 0
2028+ RefTbl = {}
2029+ histlbl = {}
20282030 nx = len (groupDict [groupName ])
2031+ # find portion of hist name that is the same and different
2032+ h0 = groupDict [groupName ][0 ]
2033+ msk = [True ] * len (h0 )
2034+ for h in groupDict [groupName ][1 :]:
2035+ msk = [m & (h0i == hi ) for h0i ,hi ,m in zip (h0 ,h ,msk )]
2036+ # place centered-dot in loc of non-common letters
2037+ commonltrs = '' .join ([h0i if m else '\u00B7 ' for (h0i ,m ) in zip (h0 ,msk )])
20292038 for i ,h in enumerate (groupDict [groupName ]):
2039+ histlbl [i ] = '' .join ([hi for (hi ,m ) in zip (h ,msk ) if not m ]) # unique letters
20302040 gPatternId = G2gd .GetGPXtreeItemId (G2frame , G2frame .root , h )
20312041 gParms ,_ = G2frame .GPXtree .GetItemPyData (
20322042 G2gd .GetGPXtreeItemId (G2frame ,gPatternId ,
20332043 'Instrument Parameters' ))
20342044 LimitId = G2gd .GetGPXtreeItemId (G2frame ,gPatternId , 'Limits' )
20352045 limdat = G2frame .GPXtree .GetItemPyData (LimitId )
20362046 gd = G2frame .GPXtree .GetItemPyData (gPatternId )
2047+ RefTbl [i ] = G2frame .GPXtree .GetItemPyData (G2gd .GetGPXtreeItemId (G2frame ,gPatternId ,'Reflection Lists' ))
20372048 # drop data outside limits
20382049 mask = (limdat [1 ][0 ] <= gd [1 ][0 ]) & (gd [1 ][0 ] <= limdat [1 ][1 ])
20392050 gdat [i ] = {}
@@ -2070,8 +2081,11 @@ def onPartialConfig(event):
20702081 Plots [0 ,i ].set_xlim (gXmin [i ],gXmax [i ])
20712082 Plots [1 ,i ].set_xlim (gXmin [i ],gXmax [i ])
20722083 Plots [1 ,i ].set_ylim (DZmin ,DZmax )
2073- Plots [0 ,i ].set_ylim (- len (Page .phaseList )* 5 ,102 )
2074-
2084+ if not Page .plotStyle .get ('flTicks' ,False ):
2085+ Plots [0 ,i ].set_ylim (- len (Page .phaseList )* 5 ,102 )
2086+ else :
2087+ Plots [0 ,i ].set_ylim (- 1 ,102 )
2088+
20752089 # pretty up the tick labels
20762090 Plots [0 ,0 ].tick_params (axis = 'y' , direction = 'inout' , left = True , right = True )
20772091 Plots [1 ,0 ].tick_params (axis = 'y' , direction = 'inout' , left = True , right = True )
@@ -2084,18 +2098,29 @@ def onPartialConfig(event):
20842098 Plots [0 ,0 ].set_ylabel (r'$\rm\sqrt{Normalized\ intensity}$' ,fontsize = 12 )
20852099 else :
20862100 Plots [0 ,0 ].set_ylabel ('Normalized Intensity' ,fontsize = 12 )
2101+ Page .figure .text (0.001 ,0.03 ,commonltrs ,fontsize = 13 )
20872102 Page .figure .supxlabel (xLabel )
2088-
20892103 for i ,h in enumerate (groupDict [groupName ]):
20902104 Plot = Plots [0 ,i ]
20912105 Plot1 = Plots [1 ,i ]
2106+ if Page .plotStyle ['qPlot' ]:
2107+ pos = 0.98
2108+ ha = 'right'
2109+ else :
2110+ pos = 0.02
2111+ ha = 'left'
2112+ Plot .text (pos ,0.98 ,histlbl [i ],
2113+ transform = Plot .transAxes ,
2114+ verticalalignment = 'top' ,
2115+ horizontalalignment = ha ,
2116+ fontsize = 14 )
20922117 xye = gdat [i ]
20932118 DZ = (xye [1 ]- xye [3 ])* np .sqrt (xye [2 ])
20942119 DifLine = Plot1 .plot (gX [i ],DZ ,pwdrCol ['Diff_color' ]) #,picker=True,pickradius=1.,label=incCptn('diff')) #(Io-Ic)/sig(Io)
20952120 pP = '+'
20962121 lW = 1.5
20972122 scaleY = lambda Y : (Y - gYmin [i ])/ (gYmax [i ]- gYmin [i ])* 100
2098- Plot .plot (gX [i ],scaleY (xye [1 ]),marker = pP ,color = pwdrCol ['Obs_color' ],linewidth = lW ,picker = True ,pickradius = 3. ,
2123+ Plot .plot (gX [i ],scaleY (xye [1 ]),marker = pP ,color = pwdrCol ['Obs_color' ],linewidth = lW ,# picker=True,pickradius=3.,
20992124 clip_on = Clip_on ,label = incCptn ('obs' ))
21002125 Plot .plot (gX [i ],scaleY (xye [3 ]),pwdrCol ['Calc_color' ],picker = False ,label = incCptn ('calc' ),linewidth = 1.5 )
21012126 Plot .plot (gX [i ],scaleY (xye [4 ]),pwdrCol ['Bkg_color' ],picker = False ,label = incCptn ('bkg' ),linewidth = 1.5 ) #background
@@ -2110,16 +2135,20 @@ def onPartialConfig(event):
21102135 else : # how could this happen?
21112136 plcolor = 'k'
21122137 #continue
2113- peaks = Phases [phase ].get ('RefList' ,[])
2138+ peaks = []
2139+ if phase in RefTbl [i ]:
2140+ peaks = RefTbl [i ][phase ].get ('RefList' ,[])
2141+ super = RefTbl [i ][phase ].get ('Super' ,False )
2142+ # else:
2143+ # peaks = Phases[phase].get('RefList',[])
2144+ # super = Phases[phase].get('Super',False)
21142145 if not len (peaks ):
21152146 continue
2116- if Phases [ phase ]. get ( 'Super' , False ) :
2147+ if super :
21172148 peak = np .array ([[peak [5 ],peak [6 ]] for peak in peaks ])
21182149 else :
21192150 peak = np .array ([[peak [4 ],peak [5 ]] for peak in peaks ])
2120- # pos = Page.plotStyle['refOffset']-pId*Page.plotStyle['refDelt']*np.ones_like(peak)
2121- pos = 2.5 - len (Page .phaseList )* 5 + pId * 5
2122- pos = pos * np .ones_like (peak )
2151+ pos = 2.5 - len (Page .phaseList )* 5 + pId * 5 # tick positions hard-coded
21232152 if Page .plotStyle ['qPlot' ]:
21242153 xtick = 2 * np .pi / peak .T [0 ]
21252154 elif Page .plotStyle ['dPlot' ]:
@@ -2128,7 +2157,8 @@ def onPartialConfig(event):
21282157 xtick = peak .T [1 ]
21292158 if not Page .plotStyle .get ('flTicks' ,False ): # short tick-marks
21302159 Plot .plot (
2131- xtick ,pos ,'|' ,mew = w ,ms = l ,picker = True ,pickradius = 3. ,
2160+ xtick ,pos * np .ones_like (peak ),
2161+ '|' ,mew = w ,ms = l , # picker=True,pickradius=3.,
21322162 label = phase ,color = plcolor )
21332163 else : # full length tick-marks
21342164 if len (xtick ) > 0 :
0 commit comments