Changeset 4484


Ignore:
Timestamp:
Jun 12, 2020 8:41:52 PM (15 months ago)
Author:
vondreele
Message:

fix setting RB thermal to 'None'
replace call to mpl.cm._reverse_cmap_spec to code that does the same thing to make 'pared_r'
put if dxy[0] == dxy[1] == 0: return in the right places & replace with if not np.any(dxy): return

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r4479 r4484  
    95329532            elif val == 'TLS':
    95339533                RBObj['ThermalMotion'][0] = 'TLS'
     9534            elif val == 'None':
     9535                RBObj['ThermalMotion'][0] = 'None'
    95349536            wx.CallAfter(FillRigidBodyGrid,True)
    95359537            if val != 'None':
  • trunk/GSASIIplot.py

    r4482 r4484  
    213213#   this restores the pre 2.0 Paired color map found in matplotlib._cm.py
    214214_Old_Paired_data = {'blue': [(0.0, 0.89019608497619629,
    215 0.89019608497619629), (0.090909090909090912, 0.70588237047195435,
    216 0.70588237047195435), (0.18181818181818182, 0.54117649793624878,
    217 0.54117649793624878), (0.27272727272727271, 0.17254902422428131,
    218 0.17254902422428131), (0.36363636363636365, 0.60000002384185791,
    219 0.60000002384185791), (0.45454545454545453, 0.10980392247438431,
    220 0.10980392247438431), (0.54545454545454541, 0.43529412150382996,
    221 0.43529412150382996), (0.63636363636363635, 0.0, 0.0),
    222 (0.72727272727272729, 0.83921569585800171, 0.83921569585800171),
    223 (0.81818181818181823, 0.60392159223556519, 0.60392159223556519),
    224 (0.90909090909090906, 0.60000002384185791, 0.60000002384185791), (1.0,
    225 0.15686275064945221, 0.15686275064945221)],
     215    0.89019608497619629), (0.090909090909090912, 0.70588237047195435,
     216    0.70588237047195435), (0.18181818181818182, 0.54117649793624878,
     217    0.54117649793624878), (0.27272727272727271, 0.17254902422428131,
     218    0.17254902422428131), (0.36363636363636365, 0.60000002384185791,
     219    0.60000002384185791), (0.45454545454545453, 0.10980392247438431,
     220    0.10980392247438431), (0.54545454545454541, 0.43529412150382996,
     221    0.43529412150382996), (0.63636363636363635, 0.0, 0.0),
     222    (0.72727272727272729, 0.83921569585800171, 0.83921569585800171),
     223    (0.81818181818181823, 0.60392159223556519, 0.60392159223556519),
     224    (0.90909090909090906, 0.60000002384185791, 0.60000002384185791), (1.0,
     225    0.15686275064945221, 0.15686275064945221)],
    226226
    227227    'green': [(0.0, 0.80784314870834351, 0.80784314870834351),
     
    251251#This can be done on request for other colors
    252252mpl.cm.register_cmap('Paired',data=_Old_Paired_data,lut=256)
    253 try:
    254     mpl.cm.register_cmap('Paired_r',data=mpl.cm._reverse_cmap_spec(_Old_Paired_data),lut=256)
    255 except:
    256     if GSASIIpath.GetConfigValue('debug'):
    257        print('MPL register_cmap for Paired_r failed')
     253blue = [tuple(1.-np.array(item)) for item in _Old_Paired_data['blue']]
     254blue.reverse()
     255green = [tuple(1.-np.array(item)) for item in _Old_Paired_data['green']]
     256green.reverse()
     257red = [tuple(1.-np.array(item)) for item in _Old_Paired_data['red']]
     258red.reverse()
     259Old_Paired_data_r = {'blue':blue,'green':green,'red':red}
     260mpl.cm.register_cmap('Paired_r',data=Old_Paired_data_r,lut=256)
    258261
    259262# options for publication-quality Rietveld plots
     
    50995102    Plot.set_zlabel(labelZ,fontsize=14)
    51005103    Plot.set_title(Title)
    5101     Page.figure.colorbar(mcolors,shrink=0.75,label='Rotation',boundaries=range(91))
     5104    try:
     5105        Page.figure.colorbar(mcolors,shrink=0.75,label='Rotation',boundaries=range(91))
     5106    except TypeError:
     5107        print('mpl error - no colorbar shown')
    51025108    Page.canvas.draw()
    51035109       
     
    94699475        cent = [View[2]/2,View[3]/2]
    94709476        oldxy = defaults['oldxy']
    9471         if dxy[0] == dxy[1] == 0: return # on Mac motion can be less than a full pixel!
    94729477        if not len(oldxy): oldxy = list(newxy)
    94739478        dxy = newxy-oldxy
     9479        if dxy[0] == dxy[1] == 0: return # on Mac motion can be less than a full pixel!
    94749480        defaults['oldxy'] = list(newxy)
    94759481        V = defaults['viewDir']
     
    1018410190        if not len(oldxy): oldxy = list(newxy)
    1018510191        dxy = newxy-oldxy
    10186         if dxy[0] == dxy[1] == 0: return # on Mac motion can be less than a full pixel!
     10192        if not np.any(dxy): return # on Mac motion can be less than a full pixel!
    1018710193        defaults['oldxy'] = list(newxy)
    1018810194        V = np.array([dxy[1],dxy[0],0.])
     
    1020510211        cent = [View[2]/2,View[3]/2]
    1020610212        oldxy = defaults['oldxy']
    10207         if dxy[0] == dxy[1] == 0: return # on Mac motion can be less than a full pixel!
    1020810213        if not len(oldxy): oldxy = list(newxy)
    1020910214        dxy = newxy-oldxy
     10215        if not np.any(dxy): return  # on Mac motion can be less than a full pixel!
    1021010216        defaults['oldxy'] = list(newxy)
    1021110217        V = defaults['viewDir']
Note: See TracChangeset for help on using the changeset viewer.