Changeset 4764


Ignore:
Timestamp:
Jan 13, 2021 9:42:03 PM (8 months ago)
Author:
toby
Message:

HessianLSQ: force vars to float; small wx 4.1 fixes; scriptable: more docs, TOF peak widths (from Adam)

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIctrlGUI.py

    r4680 r4764  
    549549            xmin=min
    550550            if GSASIIpath.GetConfigValue('debug'):
    551                 print('Change min to xmin here:')
     551                print('Call to ValidatedTxtCtrl using min (change to xmin) here:')
    552552                G2obj.HowDidIgetHere(True)
    553553        if max is not None:
    554554            xmax=max
    555555            if GSASIIpath.GetConfigValue('debug'):
    556                 print('Change max to xmax here:')
     556                print('Call to ValidatedTxtCtrl using max (change to xmax) here:')
    557557                G2obj.HowDidIgetHere(True)
    558558        # initialization
     
    14721472            kargs = {}
    14731473            if i < len(minvals):
    1474                 if minvals[i] is not None: kargs['min']=minvals[i]
     1474                if minvals[i] is not None: kargs['xmin']=minvals[i]
    14751475            if i < len(maxvals):
    1476                 if maxvals[i] is not None: kargs['max']=maxvals[i]
     1476                if maxvals[i] is not None: kargs['xmax']=maxvals[i]
    14771477            if i < len(sizevals):
    14781478                if sizevals[i]: kargs['size']=sizevals[i]
     
    15181518        btnsizer = wx.BoxSizer(wx.HORIZONTAL)
    15191519        btnsizer.Add(self.OKbtn)
     1520        self.OKbtn.Bind(wx.EVT_BUTTON,lambda event: self.EndModal(wx.ID_OK))
    15201521        btn = wx.Button(self, wx.ID_CLOSE,"Cancel")
    15211522        btn.Bind(wx.EVT_BUTTON,self._onClose)
  • trunk/GSASIIdataGUI.py

    r4763 r4764  
    32733273                print('Ignoring Config Starting_directory value: '+
    32743274                      GSASIIpath.GetConfigValue('Starting_directory'))
    3275                
    32763275
    32773276    def GetTreeItemsList(self,item):
     
    43444343            self.dirname = os.path.split(filename)[0]
    43454344
     4345#        if self.G2plotNB.plotList:
     4346#            self.G2plotNB.clear()
    43464347        self.init_vars()
    43474348        try:
  • trunk/GSASIIddataGUI.py

    r4672 r4764  
    370370        muMean = G2spc.MuShklMean(SGData,Amat,UseList[G2frame.hist]['Mustrain'][4][:numb])
    371371        parms = zip(Snames,UseList[G2frame.hist]['Mustrain'][5],range(numb))
     372        mainSizer = wx.BoxSizer(wx.VERTICAL)
    372373        dataSizer = wx.FlexGridSizer(0,6,5,5)
    373374        for Pa,ref,Id in parms:
     
    381382                Id,nDig=(10,2),OnLeave=OnNewValueReDraw)
    382383            dataSizer.Add(strainVal,0,WACV)
    383         dataSizer.Add(wx.StaticText(DData,label=' Mean mustrain %.1f'%muMean),0,WACV)
    384         return dataSizer
     384        mainSizer.Add(dataSizer)
     385        mainSizer.Add(wx.StaticText(DData,label=' Mean mustrain %.1f'%muMean)
     386                          ,0,wx.ALIGN_CENTER_HORIZONTAL)
     387        return mainSizer
    385388
    386389    def HstrainSizer():
     
    954957                genSizer.Add(ResetSizer('generalized',OnResetStrain),0,WACV)
    955958                bottomSizer.Add(genSizer)
    956                 bottomSizer.Add(GenStrainDataSizer(),0,WACV|wx.BOTTOM,5)
     959                bottomSizer.Add(GenStrainDataSizer(),0,wx.BOTTOM,5)
    957960           
    958961            bottomSizer.Add(wx.StaticText(DData,wx.ID_ANY,' Hydrostatic/elastic strain:'))
  • trunk/GSASIImath.py

    r4763 r4764  
    187187    ifConverged = False
    188188    deltaChi2 = -10.
    189     x0 = np.array(x0, ndmin=1)      #might be redundant?
     189    x0 = np.array(x0, ndmin=1, dtype=np.float64)      #might be redundant?
    190190    n = len(x0)
    191191    if type(args) != type(()):
  • trunk/GSASIIscriptable.py

    r4671 r4764  
    11051105
    11061106=======================================
     1107Installation of GSASIIscriptable
     1108=======================================
     1109
     1110It is assumed that most people using GSASIIscriptable will also want to use the GUI, noting that not all GSAS-II capabilities are not available by scripting (yet) and some would not make sense to implement without a graphical view of the data, for this the standard
     1111`installation instructions <https://subversion.xray.aps.anl.gov/trac/pyGSAS#Installationinstructions>`_ should be followed. The GUI includes all files needed to run scriptable.
     1112
     1113There may be times where it does make sense to install GSAS-II without all of the GUI components, for example on a compute server. As `described here
     1114<https://gsas-ii.readthedocs.io/en/latest/packages.html#scripting-requirements>'_ the minimal python requirements are only numpy and scipy. It is assumed that
     1115anyone able to use scripting is well posed to install from the command line.
     1116Below are example commands to install GSAS-II for use for scripting only.
     1117
     1118.. code-block::  bash
     1119
     1120    bash ~/Downloads/Miniconda3-latest-MacOSX-x86_64.sh -b -p /loc/pyg2script
     1121    source /loc/pyg2script/bin/activate
     1122    conda install numpy scipy matplotlib pillow h5py hdf5 svn
     1123    svn co https://subversion.xray.aps.anl.gov/pyGSAS/trunk /loc/GSASII
     1124    python /loc/GSASII/GSASIIscriptable.py
     1125
     1126Some discussion on these commands follows. Note I have chosen to use the free
     1127miniconda installer from Anaconda, Inc., but there are also plenty of
     1128other ways to install Python, Numpy and Scipy on Linux, Windows and MacOS.
     1129For Linux a reasonable alternative is to install these packages
     1130(and perhaps others) as supplied by the Linux dist (``apt-get`` etc.).
     1131
     1132* the 1st command (bash) assumes that the appropriate version of Miniconda has been downloaded from https://docs.conda.io/en/latest/miniconda.html and ``/loc/pyg2script`` is where I have selected for python to be installed. You might want to use ``~/pyg2script``.
     1133* the 2nd command (source) is needed to access Python with miniconda.
     1134* the 3rd command (conda) installs all possible packages that might be used by scripting, but matplotlib, pillow, and hdf5 are not commonly needed and could be omitted. The svn package is not needed (for example on Linux) where this has been installed in another way.
     1135* the 4th command (svn) is used to download the GSAS-II software. ``/loc/GSASII`` is the location where I decided to install the software.
     1136* the 5th command (python) is used to invoke GSAS-II scriptable for the first time, which is needed to load the binary files from the server.
     1137
     1138=======================================
    11071139GSASIIscriptable Command-line Interface
    11081140=======================================
     
    11111143alternate way to access some of the same functionality is to
    11121144invoke the ``GSASIIscriptable.py`` script from
    1113 the command line usually from within a shell script or batch file. This
    1114 will usually be done with a command such as::
     1145the command line usually from within a shell script or batch file.
     1146This mode of accessing GSAS-II scripting does not appear to get much use and
     1147is no longer being developed. Please do communicate to the developers if
     1148keeping this mode of access would be of value in your work.
     1149
     1150To use the command-line mode is done with a command like this::
    11151151
    11161152       python <path/>GSASIIscriptable.py <subcommand> <file.gpx> <options>
     
    41484184        peaks['peaks'].append(G2mth.setPeakparms(Parms,Parms2,pos,area))
    41494185
    4150     def set_peakFlags(self,peaklist=None,area=None,pos=None,sig=None,gam=None):
     4186    def set_peakFlags(self,peaklist=None,area=None,pos=None,sig=None,gam=None,
     4187                          alp=None,bet=None):
    41514188        '''Set refinement flags for peaks
    41524189       
     
    41574194        :param bool pos: Sets or clears the refinement flag for the peak position value.
    41584195          If None (the default), no change is made.
    4159         :param bool sig: Sets or clears the refinement flag for the peak sig (Gaussian width) value.
     4196        :param bool sig: Sets or clears the refinement flag for the peak sigma (Gaussian width) value.
    41604197          If None (the default), no change is made.
    4161         :param bool gam: Sets or clears the refinement flag for the peak sig (Lorentzian width) value.
     4198        :param bool gam: Sets or clears the refinement flag for the peak gamma (Lorentzian width) value.
     4199          If None (the default), no change is made.
     4200        :param bool alp: Sets or clears the refinement flag for the peak alpha (TOF width) value.
     4201          If None (the default), no change is made.
     4202        :param bool bet: Sets or clears the refinement flag for the peak beta (TOF width) value.
    41624203          If None (the default), no change is made.
    41634204         
     
    41764217            peaklist = range(len(peaks['peaks']))
    41774218        for i in peaklist:
    4178             for var,j in [(area,3),(pos,1),(sig,5),(gam,7)]:
    4179                 if var is not None:
    4180                     peaks['peaks'][i][j] = var
    4181            
     4219            if 'C' in self.data['Instrument Parameters'][0]['Type'][0]:
     4220                for var,j in [(area,3),(pos,1),(sig,5),(gam,7)]:
     4221                    if var is not None:
     4222                        peaks['peaks'][i][j] = var
     4223            else:
     4224                for var,j in [(area,3),(pos,1),(alp,5),(bet,7),(sig,9),(gam,11)]:
     4225                    if var is not None:
     4226                        peaks['peaks'][i][j] = var
     4227
    41824228    def refine_peaks(self):
    41834229        '''Causes a refinement of peak position, background and instrument parameters
     
    66836729    # Parse and trigger subcommand
    66846730    result = parser.parse_args()
    6685     result.func(result)
     6731    try:
     6732        result.func(result)
     6733    except:
     6734        print('Use {} -h or --help'.format(sys.argv[0]))
    66866735
    66876736def dictDive(d,search="",keylist=[],firstcall=True,l=None):
Note: See TracChangeset for help on using the changeset viewer.