Changeset 4879 for trunk


Ignore:
Timestamp:
Apr 10, 2021 4:33:39 PM (2 years ago)
Author:
toby
Message:

implement constraints in scriptable, part 2

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIscriptable.py

    r4878 r4879  
    116116:meth:`G2Project.add_HoldConstr`                      Adds a hold constraint on one or more variables
    117117:meth:`G2Project.add_EquivConstr`                     Adds an equivalence constraint on two or more variables
     118:meth:`G2Project.add_EqnConstr`                   Adds an equation-type constraint on two or more variables
    118119
    119120==================================================    ===============================================================================================================
     
    30653066        self.add_constraint_raw(typ, constr)
    30663067
    3067     def add_EquivEquation(self,total,varlist,multlist=[],reloadIdx=True):
     3068    def add_EqnConstr(self,total,varlist,multlist=[],reloadIdx=True):
    30683069        '''Set a constraint equation on a list of variables.
    30693070
     
    30893090        Example::
    30903091       
    3091             gpx.add_EquivEquation(1.0,('0::Ax:0','0::Ax:1'),[1,1])
     3092            gpx.add_EqnConstr(1.0,('0::Ax:0','0::Ax:1'),[1,1])
    30923093
    30933094        '''
     
    30973098            self.index_ids()
    30983099        if len(varlist) < 2:
    3099             raise Exception('add_EquivEquation Error: varlist must have at least 2 variables')
     3100            raise Exception('add_EqnConstr Error: varlist must have at least 2 variables')
    31003101        try:
    31013102            float(total)
    31023103        except:
    3103             raise Exception('add_EquivEquation Error: total be a valid float')
     3104            raise Exception('add_EqnConstr Error: total be a valid float')
    31043105        constr = []
    31053106        typ_prev = None
     
    31283129        constr += [float(total), None, 'c']
    31293130        self.add_constraint_raw(typ, constr)
    3130            
     3131
     3132       
    31313133    def add_constraint_raw(self, cons_scope, constr):
    31323134        """Adds a constraint to the project.
  • trunk/exports/G2export_CIF.py

    r4878 r4879  
    21502150                dlg.Destroy()
    21512151            # scan over histograms used in this phase for
    2152             pId = self.Phases[phasenam]['pId']
    2153             for h in phasedict['Histograms']:
    2154                 if not phasedict['Histograms'][h]['Use']: continue
    2155                 hId = self.Histograms[h]['hId']
    2156                 T = self.Histograms[h]['Sample Parameters']['Temperature']
     2152            #pId = self.Phases[phasenam]['pId']
     2153            #for h in phasedict['Histograms']:
     2154            #    if not phasedict['Histograms'][h]['Use']: continue
     2155            #    hId = self.Histograms[h]['hId']
     2156            #    T = self.Histograms[h]['Sample Parameters']['Temperature']
    21572157               
    21582158        # check if temperature values & pressure are defaulted
Note: See TracChangeset for help on using the changeset viewer.