Changeset 5239 for trunk


Ignore:
Timestamp:
Mar 18, 2022 8:23:49 PM (3 years ago)
Author:
toby
Message:

add warning when phase fraction constraint is added as per Bob

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/GSASIIconstrGUI.py

    r5216 r5239  
    16911691       
    16921692###### check scale & phase fractions, create constraint if needed #############
    1693 def CheckAllScalePhaseFractions(G2frame):
     1693def CheckAllScalePhaseFractions(G2frame,refine=True):
    16941694    '''Check if scale factor and all phase fractions are refined without a constraint
    16951695    for all used histograms, if so, offer the user a chance to create a constraint
    16961696    on the sum of phase fractions
     1697
     1698    :returns: False if refinement should be continued
    16971699    '''
    16981700    histograms, phases = G2frame.GetUsedHistogramsAndPhasesfromTree()
     
    17091711        if i: msg += ', '
    17101712        msg += str(h)
    1711     msg += '. This is not recommended as it will produce an unstable refinement. Do you want to create constrain(s) on the sum of phase fractions to address this? (Press "No" to continue without)'
    1712     dlg = wx.MessageDialog(G2frame,msg,'Warning: Constraint Needed',wx.YES|wx.NO)
     1713    msg += '. This is not recommended as it will produce an unstable refinement. Do you want to create constrain(s) on the sum of phase fractions to address this?'
     1714    if refine:
     1715        msg += '\n\nRefinement may cause a significant shift in scaling, so it may be best to refine only a few other parameters (Press "No" to continue refinement without, "Cancel" to stop.)'
     1716        opts = wx.YES|wx.NO|wx.CANCEL
     1717    else:
     1718        opts = wx.YES|wx.NO
     1719    dlg = wx.MessageDialog(G2frame,msg,'Warning: Constraint Needed',opts)
    17131720    ans = dlg.ShowModal()
    17141721    dlg.Destroy()
     
    17271734        wx.CallAfter(G2frame.GPXtree.SelectItem,cId) # should call SelectDataTreeItem
    17281735        UpdateConstraints(G2frame,Constraints,1,True) # repaint with HAP tab
    1729         return True
    1730     return False
    1731        
     1736        return False
     1737    elif ans == wx.ID_NO:
     1738        return False
     1739    return True
     1740
    17321741def CheckScalePhaseFractions(G2frame,hist,histograms,phases,Constraints):
    17331742    '''Check if scale factor and all phase fractions are refined without a constraint
  • TabularUnified trunk/GSASIIdataGUI.py

    r5236 r5239  
    52895289        for a sequential fit.
    52905290        '''
    5291         if G2cnstG.CheckAllScalePhaseFractions(self): return
     5291        if G2cnstG.CheckAllScalePhaseFractions(self,refine=False): return
    52925292        try:
    52935293            parmDict,varyList = self.MakeLSParmDict()
  • TabularUnified trunk/GSASIIrestrGUI.py

    r5143 r5239  
    190190        numerical values (only)
    191191        '''
    192         G2cnstG.CheckAllScalePhaseFractions(G2frame)
     192        G2cnstG.CheckAllScalePhaseFractions(G2frame,refine=False)
    193193        try:
    194194            parmDict,varyList = G2frame.MakeLSParmDict()
Note: See TracChangeset for help on using the changeset viewer.