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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.