Changeset 3290


Ignore:
Timestamp:
Feb 19, 2018 10:31:26 AM (4 years ago)
Author:
toby
Message:

scripting doc updates; magnification Py3 updates

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIdataGUI.py

    r3288 r3290  
    73577357        mainSizer.Add((-1,10))
    73587358        lenmag = len(data[0]['Magnification'])
    7359         data[0]['Magnification'].sort(key=lambda x: x[0])
     7359        data[0]['Magnification'][1:] = sorted(data[0]['Magnification'][1:],key=lambda x: x[0])
    73607360        if lenmag > 1:
    73617361            panel = wx.StaticBox(G2frame.dataWindow, wx.ID_ANY, 'Magnification regions',
  • trunk/GSASIIplot.py

    r3288 r3290  
    18461846            ypos = pick.get_ydata()
    18471847            ind = event.ind
    1848             xy = list(zip(np.take(xpos,ind),np.take(ypos,ind))[0])
     1848            xy = list(list(zip(np.take(xpos,ind),np.take(ypos,ind)))[0])
    18491849            # convert from plot units
    18501850            if G2frame.plotStyle['qPlot']:                              #qplot - convert back to 2-theta
  • trunk/GSASIIscriptable.py

    r3270 r3290  
    240240
    241241This table describes the dictionaries supplied to :func:`G2PwdrData.set_refinements`
    242 and :func:`G2PwdrData.clear_refinements`.
     242and :func:`G2PwdrData.clear_refinements`. Note that in Instrument Parameters,
     243to save space in the table, related profile parameters (such as U and V) are listed
     244together, separated by commas.
    243245
    244246.. tabularcolumns:: |l|l|p{3.5in}|
     
    252254\                     low                   Sets the low limit
    253255\                     high                  Sets the high limit
     256
    254257Sample Parameters                           Should be provided as a **list** of subkeys
    255258                                            to set or clear, e.g. ['DisplaceX', 'Scale']
     
    259262\                     DisplaceY             Sample displacement along the Y direction
    260263\                     Scale                 Histogram Scale factor
     264
    261265Background                                  Sample background. If value is a boolean,
    262266                                            the background's 'refine' parameter is set
     
    268272\                     coeffs                List of floats, literal values for background
    269273\                     FixedPoints           List of (2-theta, intensity) values for fixed points
    270 \                     fit fixed points      If True, triggers a fit to the fixed points to be calculated. It is calculated when this key is detected, regardless of calls to refine.
    271 Instrument Parameters                       As in Sample Paramters, Should be provided as a **list** of subkeys to
     274\                     fit fixed points      If True, triggers a fit to the fixed points to
     275                                            be calculated. It is calculated when this key is
     276                                            detected, regardless of calls to refine.
     277
     278Instrument Parameters                       As in Sample Paramters, provide as a **list** of
     279                                            subkeys to
    272280                                            set or clear, e.g. ['X', 'Y', 'Zero', 'SH/L']
    273 \                     U, V, W               All separate keys. Gaussian peak profile terms
    274 \                     X, Y                  Separate keys. Lorentzian peak profile terms
     281\                     U, V, W               Gaussian peak profile terms
     282\                     X, Y, Z               Lorentzian peak profile terms
     283\                     alpha, beta-0,        TOF profile terms
     284                      beta-1, beta-q,
     285\                     sig-0, sig-1,         TOF profile terms
     286                      sig-2, sig-q
     287\                     difA, difB, difC      TOF Calibration constants
    275288\                     Zero                  Zero shift
    276 \                     SH/L
     289\                     SH/L                  Finger-Cox-Jephcoat low-angle peak asymmetry
    277290\                     Polariz.              Polarization parameter
    278291\                     Lam                   Lambda, the incident wavelength
     
    10881101    >>> # Load an existing project file
    10891102    >>> proj = G2Project('filename.gpx')
     1103   
    10901104    >>> # Create a new project
    1091     >>> proj = G2Project(filename='new_file.gpx')
    1092     >>> # Specify an author
    1093     >>> proj = G2Project(author='Dr. So-And-So', filename='my_data.gpx')
    1094 
     1105    >>> proj = G2Project(newgpx='new_file.gpx')
     1106   
    10951107    Histograms can be accessed easily.
    10961108
    10971109    >>> # By name
    10981110    >>> hist = proj.histogram('PWDR my-histogram-name')
     1111   
    10991112    >>> # Or by index
    11001113    >>> hist = proj.histogram(0)
    11011114    >>> assert hist.id == 0
     1115   
    11021116    >>> # Or by random id
    11031117    >>> assert hist == proj.histogram(hist.ranId)
     
    11181132    :meth:`~G2Project.iter_refinements`, :meth:`~G2Project.do_refinements`.
    11191133    """
    1120     def __init__(self, gpxfile=None, author=None, filename=None):
     1134    def __init__(self, gpxfile=None, author=None, filename=None, newgpx=None):
    11211135        """Loads a GSAS-II project from a specified filename.
    11221136
    11231137        :param str gpxfile: Existing .gpx file to be loaded. If nonexistent,
    11241138            creates an empty project.
    1125         :param str author: Author's name. Optional.
    1126         :param str filename: The filename the project should be saved to in
    1127             the future. If both filename and gpxfile are present, the project is
    1128             loaded from the gpxfile, then set to  save to filename in the future"""
     1139        :param str author: Author's name (not yet implemented)
     1140        :param str newgpx: The filename the project should be saved to in
     1141            the future. If both newgpx and gpxfile are present, the project is
     1142            loaded from the gpxfile, then when saved will be written to newgpx.
     1143        :param str filename: Name to be used to save the project. Has same function as
     1144            parameter newgpx (do not use both gpxfile and filename). Use of newgpx
     1145            is preferred over filename.
     1146        """
     1147        if filename is not None and newgpx is not None:
     1148            raise G2ScriptException('Do not use filename and newgpx together')
     1149        elif newgpx is not None:
     1150            filename = newgpx
    11291151        if gpxfile is None:
    11301152            filename = os.path.abspath(os.path.expanduser(filename))
    11311153            self.filename = filename
    11321154            self.data, self.names = make_empty_project(author=author, filename=filename)
    1133         elif isinstance(gpxfile, str):
    1134             # TODO set author, filename
    1135             self.filename = os.path.abspath(os.path.expanduser(gpxfile))
     1155        elif isinstance(gpxfile, str): # TODO: create replacement for isinstance that checks if path exists
     1156                                       # filename is valid, etc.
     1157            if isinstance(filename, str):
     1158                self.filename = os.path.abspath(os.path.expanduser(filename)) # both are defined
     1159            else:
     1160                self.filename = os.path.abspath(os.path.expanduser(gpxfile))
     1161            # TODO set author
    11361162            self.data, self.names = LoadDictFromProjFile(gpxfile)
    11371163            self.update_ids()
     
    27032729
    27042730    """
    2705     proj = G2Project(filename=args.filename)
     2731    proj = G2Project(gpxname=args.filename)
    27062732
    27072733    hist_objs = []
Note: See TracChangeset for help on using the changeset viewer.