Changeset 3193


Ignore:
Timestamp:
Dec 15, 2017 9:59:48 AM (4 years ago)
Author:
toby
Message:

better error msg w/o calibrant; search comments when Sample Parameters FreePrm? label is changed

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimgGUI.py

    r3186 r3193  
    176176
    177177    def OnCalibrate(event):
     178        if not data['calibrant']:
     179            G2G.G2MessageBox(G2frame,'No calibrant material specified.\n'+
     180                             'Please correct this and try again.')
     181            return
    178182        G2frame.GetStatusBar().SetStatusText('Select > 4 points on 1st used ring; LB to pick (shift key to force pick), RB on point to delete else RB to finish',1)
    179183        G2frame.ifGetRing = True
  • trunk/GSASIIpwdGUI.py

    r3191 r3193  
    23442344        wx.CallAfter(UpdateSampleGrid,G2frame,data)
    23452345       
     2346    def SearchAllComments(value,tc,*args,**kwargs):
     2347        '''Called when the label for a FreePrm is changed: the comments for all PWDR
     2348        histograms are searched for a "label=value" pair that matches the label (case
     2349        is ignored) and the values are then set to this value, if it can be converted
     2350        to a float.
     2351        '''
     2352        id, cookie = G2frame.GPXtree.GetFirstChild(G2frame.root)
     2353        while id:
     2354            name = G2frame.GPXtree.GetItemText(id)
     2355            if 'PWDR' in name:
     2356                Comments = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,id,'Comments'))
     2357                Sample =   G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,id, 'Sample Parameters'))
     2358                for i,item in enumerate(Comments):
     2359                    itemSp = item.split('=')
     2360                    if value.lower() == itemSp[0].lower():
     2361                        try:
     2362                            Sample[tc.key] = float(itemSp[1])
     2363                        except:
     2364                            print('"{}" has an invalid value in Comments from {}'
     2365                                  .format(item.strip(),name))
     2366            id, cookie = G2frame.GPXtree.GetNextChild(G2frame.root, cookie)
     2367        wx.CallLater(100,UpdateSampleGrid,G2frame,data)
     2368       
     2369       
    23462370    ######## DEBUG #######################################################
    23472371    #import GSASIIpwdGUI
     
    24642488        parmSizer.Add(parmVal,0,WACV)
    24652489    Info = {}
    2466        
     2490   
    24672491    for key in ('FreePrm1','FreePrm2','FreePrm3'):
    24682492        parmVal = G2G.ValidatedTxtCtrl(G2frame.dataWindow,Controls,key,typeHint=str,
    2469                                         notBlank=False)
     2493                                        notBlank=False,OnLeave=SearchAllComments)
    24702494        parmSizer.Add(parmVal,1,wx.EXPAND)
    24712495        parmVal = G2G.ValidatedTxtCtrl(G2frame.dataWindow,data,key,typeHint=float)
  • trunk/help/gsasII.html

    r3135 r3193  
    46784678<p class=MsoNormal style='margin-left:.5in'><span style='mso-fareast-font-family:
    46794679"Times New Roman"'>This window show the various sample dependent parameters for
    4680 this powder pattern. The presence of a refine button indicates which can be
    4681 refined while others are fixed. All values can be changed in this window. NB:
    4682 for powder data be sure the correct instrument type is selected (<b
     4680this powder pattern. The presence of a refine button indicates that a
     4681parameter can be refined (all others are fixed.) All values shown in
     4682this window can be edited.
     4683
     4684Note that the last three parameters (named FreePrm<I>X</I>, <I>X</I>=1,2,3) have
     4685labels that can be changed. If changed in one histogram, the same
     4686label is used for all histograms. When a label is changed, the
     4687Comments tree item for each PWDR histogram is searched for a matching
     4688"Label=value" pair (differences in letter case between the two label
     4689strings is ignored). When found, the value is converted to a float and
     4690saved as the appropriate Sample Parameter.
     4691
     4692NB: for powder data be sure the correct instrument type is selected (<b
    46834693style='mso-bidi-font-weight:normal'>Debye-<span class=SpellE>Scherrer</span></b>
    46844694or <b style='mso-bidi-font-weight:normal'>Bragg-Brentano</b>).<span
    4685 class=MsoHyperlink><span style='color:windowtext;text-decoration:none;
    4686 text-underline:none'><o:p></o:p></span></span></span></p>
     4695class=MsoHyperlink></span></span></p>
    46874696
    46884697<h5 style='margin-left:.5in'>
     
    71167125<hr size=2 width="100%" align=center>
    71177126
    7118 <!-- hhmts start -->Last modified: Sun Oct 15 18:58:51 CDT 2017 <!-- hhmts end -->
     7127<!-- hhmts start -->Last modified: Thu Dec 14 23:57:16 CST 2017 <!-- hhmts end -->
    71197128
    71207129</div>
Note: See TracChangeset for help on using the changeset viewer.