Changeset 981


Ignore:
Timestamp:
Jul 7, 2013 9:58:08 AM (10 years ago)
Author:
toby
Message:

introduce regress option; fix esd printing; more docs; new Mac app with drag & drop for open; control reset of ref list on load

Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIIO.py

    r960 r981  
    15941594            Phases,RestraintDict=None,rbIds=rbIds,Print=False)
    15951595        self.parmDict.update(phaseDict)
    1596         hapVary,hapDict,controlDict =  G2stIO.GetHistogramPhaseData(Phases,Histograms,Print=False)
     1596        hapVary,hapDict,controlDict =  G2stIO.GetHistogramPhaseData(
     1597            Phases,Histograms,Print=False,resetRefList=False)
    15971598        self.parmDict.update(hapDict)
    15981599        histVary,histDict,controlDict =  G2stIO.GetHistogramData(Histograms,Print=False)
  • trunk/GSASIIgrid.py

    r978 r981  
    11511151
    11521152################################################################################
     1153class downdate(wx.Dialog):
     1154    '''Dialog to allow a user to select a version of GSAS-II to install
     1155    '''
     1156    def __init__(self,parent=None):
     1157        style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
     1158        wx.Dialog.__init__(self, parent, wx.ID_ANY, 'Select Version', style=style)
     1159        pnl = wx.Panel(self)
     1160        sizer = wx.BoxSizer(wx.VERTICAL)
     1161        insver = GSASIIpath.svnGetRev(local=True)
     1162        curver = int(GSASIIpath.svnGetRev(local=False))
     1163        label = wx.StaticText(
     1164            pnl,  wx.ID_ANY,
     1165            'Select a specific GSAS-II version to install'
     1166            )
     1167        sizer.Add(label, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
     1168        sizer1 = wx.BoxSizer(wx.HORIZONTAL)
     1169        sizer1.Add(
     1170            wx.StaticText(pnl,  wx.ID_ANY,
     1171                          'Currently installed version: '+str(insver)),
     1172            0, wx.ALIGN_CENTRE|wx.ALL, 5)
     1173        sizer.Add(sizer1)
     1174        sizer1 = wx.BoxSizer(wx.HORIZONTAL)
     1175        sizer1.Add(
     1176            wx.StaticText(pnl,  wx.ID_ANY,
     1177                          'Select GSAS-II version to install: '),
     1178            0, wx.ALIGN_CENTRE|wx.ALL, 5)
     1179        self.spin = wx.SpinCtrl(pnl, wx.ID_ANY)
     1180        self.spin.SetRange(1, curver)
     1181        self.spin.SetValue(curver)
     1182        self.Bind(wx.EVT_SPINCTRL, self._onSpin, self.spin)
     1183        self.Bind(wx.EVT_KILL_FOCUS, self._onSpin, self.spin)
     1184        sizer1.Add(self.spin)
     1185        sizer.Add(sizer1)
     1186
     1187        line = wx.StaticLine(pnl,-1, size=(-1,3), style=wx.LI_HORIZONTAL)
     1188        sizer.Add(line, 0, wx.EXPAND|wx.ALIGN_CENTER|wx.ALL, 10)
     1189
     1190        self.text = wx.StaticText(pnl,  wx.ID_ANY, "")
     1191        sizer.Add(self.text, 0, wx.ALIGN_LEFT, 5)
     1192
     1193        btnsizer = wx.StdDialogButtonSizer()
     1194        btn = wx.Button(pnl, wx.ID_OK, "Install")
     1195        btn.SetDefault()
     1196        btnsizer.AddButton(btn)
     1197        btn = wx.Button(pnl, wx.ID_CANCEL)
     1198        btnsizer.AddButton(btn)
     1199        btnsizer.Realize()
     1200        sizer.Add(btnsizer, 0, wx.ALIGN_CENTER|wx.ALL, 5)
     1201        pnl.SetSizer(sizer)
     1202        sizer.Fit(self)
     1203        self.topsizer=sizer
     1204        self.CenterOnParent()
     1205        self._onSpin(None)
     1206
     1207    def _onSpin(self,event):
     1208        'Called to load info about the selected version in the dialog'
     1209        ver = self.spin.GetValue()
     1210        d = GSASIIpath.svnGetLog(version=ver)
     1211        date = d.get('date','?').split('T')[0]
     1212        s = '(Version '+str(ver)+' created '+date
     1213        s += ' by '+d.get('author','?')+')'
     1214        msg = d.get('msg')
     1215        if msg: s += '\n\nComment: '+msg
     1216        self.text.SetLabel(s)
     1217        self.topsizer.Fit(self)
     1218
     1219    def getVersion(self):
     1220        'Get the version number in the dialog'
     1221        return self.spin.GetValue()
     1222
     1223################################################################################
    11531224class MyHelp(wx.Menu):
    11541225    '''
     
    11811252                text='&Check for updates')
    11821253            frame.Bind(wx.EVT_MENU, self.OnCheckUpdates, helpobj)
     1254            helpobj = self.Append(
     1255                help='', id=wx.ID_ANY, kind=wx.ITEM_NORMAL,
     1256                text='&Regress to an old GSAS-II version')
     1257            frame.Bind(wx.EVT_MENU, self.OnSelectVersion, helpobj)
    11831258        for lbl,indx in morehelpitems:
    11841259            helpobj = self.Append(text=lbl,
     
    12681343                                   'You have version '+local+
    12691344                                   ' of GSAS-II installed, but the current version is '+repos+
    1270                                    '. However, you have modified '+str(len(mods))+
     1345                                   '. However, '+str(len(mods))+
    12711346                                   ' file(s) on your local computer have been modified.'
    1272                                    ' Updating could wipe out your local changes. Press OK to start an update:',
     1347                                   ' Updating could cause you to lose your changes, if conflicts arise. Press OK to start an update if this is acceptable:',
    12731348                                   'Local GSAS-II Mods',
    12741349                                   wx.OK|wx.CANCEL)
     
    12941369            dlg.ShowModal()
    12951370            return
    1296         modsbytype = {}
    1297         for key in moddict:
    1298             typ = moddict[key]
    1299             if modsbytype.get(typ) is None:
    1300                 modsbytype[typ] = []
    1301             modsbytype[typ].append(key)
    1302         msg = 'Update was completed. Changes will take effect when GSAS-II is next updated. The following files were updated, ordered by status:'
    1303         for key in modsbytype:
    1304             msg += '\n' + key + ':\n\t'
    1305             for fil in modsbytype:
    1306                 msg += fil + ', '
     1371        msg = 'Update was completed. Changes will take effect when GSAS-II is restarted.\n\nThe following files were affected, ordered by change,'
     1372        for key in sorted(moddict.keys()):
     1373            msg += '\n\n' + key + ': '+moddict[key]
     1374        dlg = wx.MessageDialog(self.frame,msg, 'Update Completed', wx.OK)
     1375        dlg.ShowModal()
     1376        return
     1377
     1378    def OnSelectVersion(self,event):
     1379        '''Allow the user to select a specific version of GSAS-II
     1380        '''
     1381        if not GSASIIpath.whichsvn():
     1382            dlg = wx.MessageDialog(self,'No Subversion','Cannot update GSAS-II because subversion (svn) '+
     1383                                   'was not found.'
     1384                                   ,wx.OK)
     1385            dlg.ShowModal()
     1386            return
     1387        local = GSASIIpath.svnGetRev()
     1388        if local is None:
     1389            dlg = wx.MessageDialog(self.frame,
     1390                                   'Unable to run subversion on the GSAS-II current directory. Is GSAS-II installed correctly?',
     1391                                   'Subversion error',
     1392                                   wx.OK)
     1393            dlg.ShowModal()
     1394            return
     1395        mods = GSASIIpath.svnFindLocalChanges()
     1396        if mods:
     1397            dlg = wx.MessageDialog(self.frame,
     1398                                   'You have version '+local+
     1399                                   ' of GSAS-II installed. However, '+str(len(mods))+
     1400                                   ' file(s) on your local computer have been modified.'
     1401                                   ' Downdating is not encouraged as this could cause you to lose these changes. Press OK to continue anyway:',
     1402                                   'Local GSAS-II Mods',
     1403                                   wx.OK|wx.CANCEL)
     1404            if dlg.ShowModal() != wx.ID_OK: return
     1405        dlg = downdate(parent=self.frame)
     1406        if dlg.ShowModal() == wx.ID_OK:
     1407            ver = dlg.getVersion()
     1408            print('start update to '+str(ver))
     1409            wx.BeginBusyCursor()
     1410            moddict = GSASIIpath.svnUpdateDir(version=ver)
     1411            wx.EndBusyCursor()
     1412            dlg.Destroy()
     1413        else:
     1414            dlg.Destroy()
     1415            return
     1416        if moddict is None:
     1417            dlg = wx.MessageDialog(self.frame,
     1418                                   'Error accessing the GSAS-II server or performing the update. '+
     1419                                   'Try again later or perform a manual update',
     1420                                   'Update Error',
     1421                                   wx.OK)
     1422            dlg.ShowModal()
     1423            return
     1424        msg = 'Update was completed. Changes will take effect when GSAS-II is restarted.\n\nThe following files were affected, ordered by change,'
     1425        for key in sorted(moddict.keys()):
     1426            msg += '\n\n' + key + ': '+moddict[key]
    13071427        dlg = wx.MessageDialog(self.frame,msg, 'Update Completed', wx.OK)
    13081428        dlg.ShowModal()
  • trunk/GSASIImath.py

    r978 r981  
    12811281        esdoff = 5
    12821282    valoff = 0
    1283     if esdoff < 0 or abs(value) > 1.0e6 or abs(value) < 1.0e-4: # use scientific notation
     1283    if abs(value) < abs(esdoff): # value is effectively zero
     1284        pass
     1285    elif esdoff < 0 or abs(value) > 1.0e6 or abs(value) < 1.0e-4: # use scientific notation
    12841286        # where the digit offset is to the left of the decimal place or where too many
    12851287        # digits are needed
     
    12971299        extra = -math.log10(abs(value))
    12981300        if extra > 0: extra += 1
     1301        print 'fmt=',"{:."+str(max(0,esdoff+int(extra)))+"f}"
    12991302        out = ("{:."+str(max(0,esdoff+int(extra)))+"f}").format(value) # format the value
    13001303    if esd > 0:
  • trunk/GSASIIobj.py

    r963 r981  
    125125=============  ===============  ====================================================
    126126
    127 Phase Tree Item
     127Phase Tree Items
    128128----------------
    129129
     
    272272            Asymmetric unit coordinates [X is (x,y,z)]
    273273            are transformed using
    274             :math:`X\prime = M_n*X+T_n`
     274            :math:`X^\prime = M_n*X+T_n`
    275275SGSys       symmetry unit cell: type one of
    276276            'triclinic', 'monoclinic', 'orthorhombic',
     
    315315cia+2...cia+6     U11, U22, U33, U12, U13, U23
    316316==============   ====================================================
     317
     318Powder Diffraction Tree Items
     319-----------------------------
     320
     321.. _Powder_table:
     322
     323.. index::
     324   single: Powder data object description
     325   single: Data object descriptions; Powder Data
     326
     327Every powder diffraction histogram is stored in the GSAS-II data tree
     328with a top-level entry named beginning with the string "PWDR ". The
     329diffraction data for that information are directly associated with
     330that tree item and there are a series of children to that item. The
     331routine :func:`~GSASII.GSASII.GetUsedHistogramsAndPhasesfromTree` will
     332load this information into a dictionary where the child tree name is
     333used as a key, and the information in the main entry is assigned
     334a key of ``Data``, as outlined below.
     335
     336.. tabularcolumns:: |l|l|p{4in}|
     337
     338======================  ===============  ====================================================
     339  key                      sub-key        explanation
     340======================  ===============  ====================================================
     341Limits                       \            A list of two two element lists, as [[Ld,Hd],[L,H]]
     342                                          where L and Ld are the current and default lowest
     343                                          two-theta value to be used and
     344                                          where H and Hd are the current and default highest
     345                                          two-theta value to be used.
     346Reflection Lists              \           A dict with an entry for each phase in the
     347                                          histogram. The contents of each dict item
     348                                          is a list or reflections as described in the
     349                                          :ref:`Powder Reflections <PowderRefl_table>`
     350                                          description.
     351Instrument Parameters         \           A list containing two dicts where the possible
     352                                          keys in each dict are listed below. The value
     353                                          for each item is a list containing three values:
     354                                          the initial value, the current value and a
     355                                          refinement flag which can have a value of
     356                                          True, False or 0 where 0 indicates a value that
     357                                          cannot be refined. The first and second
     358                                          values are floats unless otherwise noted.
     359                                          Items in the first dict are noted as [1]
     360\                         Lam             Specifies a wavelength in Angstroms [1]
     361\                         Lam1            Specifies the primary wavelength in
     362                                          Angstrom, when an alpha1, alpha2
     363                                          source is used [1]
     364\                         Lam2            Specifies the secondary wavelength in
     365                                          Angstrom, when an alpha1, alpha2
     366                                          source is used [1]
     367                          I(L2)/I(L1)     Ratio of Lam2 to Lam1 [1]           
     368\                         Type            Histogram type (str) [1]:
     369                                           * 'PXC' for constant wavelength x-ray
     370                                           * 'PNC' for constant wavelength neutron
     371                                           * 'PNT' for time of flight neutron
     372\                         Zero            Two-theta zero correction in *degrees* [1]
     373\                         Azimuth         Azimuthal setting angle for data recorded
     374                                          with differing setting angles [1]
     375\                         U, V, W         Cagliotti profile coefficients
     376                                          for Gaussian instrumental broadening, where the
     377                                          FWHM goes as
     378                                          :math:`U \\tan^2\\theta + V \\tan\\theta + W` [1]
     379\                         X, Y            Cauchy (Lorentzian) instrumental broadening
     380                                          coefficients [1]
     381\                         SH/L            Variant of the Finger-Cox-Jephcoat asymmetric
     382                                          peak broadening ratio. Note that this is the
     383                                          average between S/L and H/L where S is
     384                                          sample height, H is the slit height and
     385                                          L is the goniometer diameter. [1]
     386\                         Polariz.        Polarization coefficient. [1]
     387wtFactor                      \           A weighting factor to increase or decrease
     388                                          the leverage of data in the histogram (float).
     389                                          A value of 1.0 weights the data with their
     390                                          standard uncertainties and a larger value
     391                                          increases the weighting of the data (equivalent
     392                                          to decreasing the uncertainties).
     393Sample Parameters             \           Specifies a dict with parameters that describe how
     394                                          the data were collected, as listed
     395                                          below. Refinable parameters are a list containing
     396                                          a float and a bool, where the second value
     397                                          specifies if the value is refined, otherwise
     398                                          the value is a float unless otherwise noted.
     399\                         Scale           The histogram scale factor (refinable)
     400\                         Absorption      The sample absorption coefficient as
     401                                          :math:`\\mu r` where r is the radius
     402                                          (refinable).
     403\                         DisplaceX,      Sample displacement from goniometer center
     404                          DisplaceY       where Y is along the beam direction and
     405                                          X is perpendicular. Units are :math:`\\mu m`
     406                                          (refinable).
     407\                         Phi, Chi,       Goniometer sample setting angles, in degrees.
     408                          Omega
     409\                         Gonio. radius   Radius of the diffractometer in mm
     410\                         InstrName       A name for the instrument, used in preparing
     411                                          a CIF (str).
     412\                         Force,          Variables that describe how the measurement
     413                          Temperature,    was performed. Not used directly in
     414                          Humidity,       any computations.
     415                          Pressure,
     416                          Voltage
     417\                         ranId           The random-number Id for the histogram
     418                                          (same value as where top-level key is ranId)
     419\                         Type            Type of diffraction data, may be 'Debye-Scherrer'
     420                                          or 'Bragg-Brentano' (str).
     421\                         Diffuse         not in use?
     422hId                           \           The number assigned to the histogram when
     423                                          the project is loaded or edited (can change)
     424ranId                         \           A random number id for the histogram
     425                                          that does not change
     426Background                    \           The background is stored as a list with where
     427                                          the first item in the list is list and the second
     428                                          item is a dict. The list contains the background
     429                                          function and its coefficients; the dict contains
     430                                          Debye diffuse terms and background peaks.
     431                                          (TODO: this needs to be expanded.)
     432Data                          \           The data consist of a list of 6 np.arrays
     433                                          containing in order:
     434
     435                                           1. the x-postions (two-theta in degrees),
     436                                           2. the intensity values (Yobs),
     437                                           3. the weights for each Yobs value
     438                                           4. the computed intensity values (Ycalc)
     439                                           5. the background values
     440                                           6. Yobs-Ycalc
     441======================  ===============  ====================================================
     442
     443Powder Reflection Data Structure
     444--------------------------------
     445
     446.. _PowderRefl_table:
     447
     448.. index::
     449   single: Powder reflection object description
     450   single: Data object descriptions; Powder Reflections
     451   
     452For every phase in a histogram, the ``Reflection Lists`` value is a list of
     453reflections. The items in that list are documented below.
     454
     455==========  ====================================================
     456  index         explanation
     457==========  ====================================================
     458 0,1,2       h,k,l (float)
     459 3           multiplicity
     460 4           d-space, Angstrom
     461 5           pos, two-theta
     462 6           sig, Gaussian width
     463 7           gam, Lorenzian width
     464 8           Fobs**2
     465 9           Fcalc**2
     466 10          reflection phase, in degrees
     467 11          the equivalent reflections as a (m x 3)
     468             np.array, where m is 0.5 * multiplicity. Note
     469             that Freidel pairs, (-h,-k-,l), are not
     470             included.
     471 12          phase shift for each of the equivalent
     472             reflections as a length (m) array
     473 13          intensity correction for reflection, this times
     474             Fobs**2 or Fcalc**2 gives Iobs or Icalc
     475 14          dict with the form factor (f or b) by atom type
     476             symbol at the reflection position.
     477==========  ====================================================
    317478
    318479
  • trunk/GSASIIpath.py

    r939 r981  
    8080    "svn/bin" in the location of the GSASII source files.
    8181
    82     :returns: None if svn is not found.
     82    :returns: None if svn is not found or an absolute path to the subversion
     83    executable file .
    8384    '''
    8485    def is_exe(fpath):
     
    9293        exe_file = os.path.join(path, svnprog)
    9394        if is_exe(exe_file):
    94             return exe_file
     95            return os.path.abspath(exe_file)
     96
     97def svnGetLog(fpath=os.path.split(__file__)[0],version=None):
     98    '''Get the revision log information for a specific version of the
     99
     100    :param str fpath: path to repository dictionary, defaults to directory where
     101       the current file is located.
     102    :param int version: the version number to be looked up or None (default)
     103       for the latest version.
     104
     105    :returns: a dictionary with keys (one hopes) 'author', 'date', 'msg', and 'revision'
     106
     107    '''
     108    import subprocess
     109    import xml.etree.ElementTree as ET
     110    svn = whichsvn()
     111    if not svn: return
     112    if version is not None:
     113        vstr = '-r'+str(version)
     114    else:
     115        vstr = '-rHEAD'
     116
     117    cmd = [svn,'log',fpath,'--xml',vstr]
     118    s = subprocess.Popen(cmd,
     119                         stdout=subprocess.PIPE,stderr=subprocess.PIPE)
     120    out,err = s.communicate()
     121    if err:
     122        print 'out=',out
     123        print 'err=',err
     124        return None
     125    x = ET.fromstring(out)
     126    d = {}
     127    for i in x.iter('logentry'):
     128        d = {'revision':i.attrib.get('revision','?')}
     129        for j in i:
     130            d[j.tag] = j.text
     131        break # only need the first
     132    return d
    95133
    96134def svnGetRev(fpath=os.path.split(__file__)[0],local=True):
    97     '''This obtains the version number for the either the latest local last update
     135    '''Obtain the version number for the either the last update of the local version
    98136    or contacts the subversion server to get the latest update version (# of Head).
    99137
    100     :param fpath: path to repository dictionary, defaults to directory where
     138    :param str fpath: path to repository dictionary, defaults to directory where
    101139       the current file is located
    102     :param local: determines the type of version number, where
     140    :param bool local: determines the type of version number, where
    103141       True (default): returns the latest installed update
    104142       False: returns the version number of Head on the server
     
    155193    return changed
    156194
    157 def svnUpdateDir(fpath=os.path.split(__file__)[0]):
     195def svnUpdateDir(fpath=os.path.split(__file__)[0],version=None):
    158196    '''This performs an update of the files in a local directory from a server.
    159197
     
    172210    svn = whichsvn()
    173211    if not svn: return
    174     cmd = [svn,'update',fpath,'-rHEAD',
     212    if version:
     213        verstr = '-r' + str(version)
     214    else:
     215        verstr = '-rHEAD'
     216    cmd = [svn,'update',fpath,verstr,
    175217           '--non-interactive',
    176218           '--accept','theirs-conflict','--force']
     
    178220                         stdout=subprocess.PIPE,stderr=subprocess.PIPE)
    179221    out,err = s.communicate()
    180     if err: return
     222    print out
     223    if err:
     224        print err
     225        return
    181226    l = out.split()
    182227    updates = {}
     
    186231        t = changetype.get(i[0])
    187232        if not t: continue
    188         updates[j] = t
     233        f = os.path.split(j)[1]
     234        if updates.get(t):
     235            updates[t] += ', '+f
     236        else:
     237            updates[t] = f
    189238    return updates
  • trunk/GSASIIstrIO.py

    r960 r981  
    15141514################################################################################       
    15151515                   
    1516 def GetHistogramPhaseData(Phases,Histograms,Print=True,pFile=None):
    1517     'needs a doc string'
     1516def GetHistogramPhaseData(Phases,Histograms,Print=True,pFile=None,resetRefList=True):
     1517    '''Loads the HAP histogram/phase information into dicts
     1518
     1519    :param dict Phases: phase information
     1520    :param dict Histograms: Histogram information
     1521    :param bool Print: prints information as it is read
     1522    :param file pFile: file object to print to (the default, None causes printing to the console)
     1523    :param bool resetRefList: Should the contents of the Reflection List be initialized
     1524      on loading. The default, True, initializes the Reflection List as it is loaded.
     1525
     1526    :returns: (hapVary,hapDict,controlDict)
     1527      * hapVary: list of refined variables
     1528      * hapDict: dict with refined variables and their values
     1529      * controlDict: dict with computation controls (?)
     1530    '''
    15181531   
    15191532    def PrintSize(hapData):
     
    17221735                    else:
    17231736                        raise ValueError
    1724                 Histogram['Reflection Lists'][phase] = refList
     1737                if resetRefList: Histogram['Reflection Lists'][phase] = refList
    17251738            elif 'HKLF' in histogram:
    17261739                inst = Histogram['Instrument Parameters'][0]
  • trunk/exports/G2cif.py

    r963 r981  
    1313import GSASIIlattice as G2lat
    1414import GSASIIspc as G2spg
    15 reload(G2spg)
     15#reload(G2spg)
     16reload(G2mth)
    1617
    1718def getCallerDocString(): # for development
     
    3940          "simple" for a simple CIF with only coordinates
    4041        '''
     42   
    4143        def WriteCIFitem(name,value=''):
    4244            if value:
     
    571573                WriteDistances(phasenam,SymOpList,offsetList,symOpList,G2oprList)
    572574
    573             #raise Exception,'Testing'
    574 
    575575        def WritePowderData(histlbl):
    576576            text = '?'
    577577            histblk = self.Histograms[histlbl]
     578            inst = histblk['Instrument Parameters'][0]
     579            hId = histblk['hId']
     580            pfx = ':' + str(hId) + ':'
    578581            print 'TODO: powder here data for',histblk["Sample Parameters"]['InstrName']
    579582            # see wrpowdhist.for & wrreflist.for
    580583           
    581             refprx = '_refln.' # mm
     584            #refprx = '_refln.' # mm
    582585            refprx = '_refln_' # normal
     586
     587            print histblk.keys()
     588            #            for key in histblk:
     589            #                print key
     590            print inst
     591            print self.parmDict.keys()
     592            print self.sigDict.keys()
     593            WriteCIFitem('\n# SCATTERING FACTOR INFO')
     594            if 'Lam1' in inst:
     595                ratio = self.parmDict.get('I(L2)/I(L1)',inst['I(L2)/I(L1)'][1])
     596                sratio = self.sigDict.get('I(L2)/I(L1)',-0.0009)
     597                lam1 = self.parmDict.get('Lam1',inst['Lam1'][1])
     598                slam1 = self.sigDict.get('Lam1',-0.00009)
     599                lam2 = self.parmDict.get('Lam2',inst['Lam2'][1])
     600                slam2 = self.sigDict.get('Lam2',-0.00009)
     601                # always assume Ka1 & Ka2 if two wavelengths are present
     602                WriteCIFitem('loop_' +
     603                             '\n\t_diffrn_radiation_wavelength' +
     604                             '\n\t_diffrn_radiation_wavelength_wt' +
     605                             '\n\t_diffrn_radiation_type' +
     606                             '\n\t_diffrn_radiation_wavelength_id')
     607                WriteCIFitem('  ' + PutInCol(G2mth.ValEsd(lam1,slam1),15)+
     608                             PutInCol('1.0',15) +
     609                             PutInCol('K\\a~1~',10) +
     610                             PutInCol('1',5))
     611                WriteCIFitem('  ' + PutInCol(G2mth.ValEsd(lam2,slam2),15)+
     612                             PutInCol(G2mth.ValEsd(ratio,sratio),15)+
     613                             PutInCol('K\\a~2~',10) +
     614                             PutInCol('2',5))               
     615            else:
     616                lam1 = self.parmDict.get('Lam',inst['Lam'])
     617                slam1 = self.sigDict.get('Lam',-0.00009)
     618                WriteCIFitem('_diffrn_radiation_wavelength',G2mth.ValEsd(lam1,slam1))
     619
     620            raise Exception, "testing"
    583621
    584622            if not oneblock:
     
    593631                    for phasenam in phasebyhistDict.get(histlbl):
    594632                        pass
    595 
    596             WriteCIFitem('\n# SCATTERING FACTOR INFO')
    597             WriteCIFitem('_diffrn_radiation_wavelength' ,text)
    598             #WriteCIFitem('_diffrn_radiation_type',text)
    599             #C always assume Ka1 & Ka2 if two wavelengths are present
    600             #WriteCIFitem('loop_' +
    601             #             '\n\t_diffrn_radiation_wavelength' +
    602             #             '\n\t_diffrn_radiation_wavelength_wt' +
    603             #             '\n\t_diffrn_radiation_type' +
    604             #             '\n\t_diffrn_radiation_wavelength_id')
    605             #WRITE LAM1,1.0,'K\\a~1~',1, LAM2,ratio,'K\\a~2~',2
    606633
    607634            WriteCIFitem('_pd_proc_ls_prof_R_factor','?')
     
    642669                # instrumental profile terms go here
    643670                WriteCIFitem('_pd_proc_ls_profile_function','?')
     671
     672            #print 'Data'
     673            #for item in histblk['Data']:
     674            #    print item
     675                #try:
     676                #    print key,histblk[key].keys()
     677                #except:
     678                #    print key
     679                #    print histblk[key]
     680            #print 'Background'
     681            print histblk['Reflection Lists']['Garnet'][1]
     682            for i in range(0,80):
     683                for j in [0,1,2,13]:
     684                    print histblk['Reflection Lists']['Garnet'][i][j],
     685                print
     686                #print histblk['Reflection Lists']['Garnet'][i][12].shape
     687                #print histblk['Reflection Lists']['Garnet'][i][14]
     688            #print histblk['Background'][0]
     689            #print histblk['Background'][1]
     690            import numpy as np
     691            refList = np.array([refl[:11] for refl in histblk['Reflection Lists']['Garnet']])
     692            #refList = histblk['Reflection Lists']['Garnet']
     693            Icorr = np.array([refl[13] for refl in histblk['Reflection Lists']['Garnet']])
     694            FO2 = np.array([refl[8] for refl in histblk['Reflection Lists']['Garnet']])
     695            print Icorr
     696            I100 = refList.T[8]*Icorr
     697            print I100
     698            print I100/max(I100)
     699            Icorr = np.array([refl[13] for refl in histblk['Reflection Lists']['Garnet']]) * np.array([refl[8] for refl in histblk['Reflection Lists']['Garnet']])
     700            print I100/max(I100)
    644701
    645702            WriteCIFitem('\n# STRUCTURE FACTOR TABLE')           
     
    733790        #============================================================
    734791        # the export process starts here
    735         # create a dict with refined values and their uncertainties
    736         self.loadParmDict()
    737792        # also load all of the tree into a set of dicts
    738793        self.loadTree()
    739794        #self.dumpTree()
     795        # create a dict with refined values and their uncertainties
     796        self.loadParmDict()
     797        #
    740798
    741799        # get restraint info
     
    881939                WritePubTemplate()
    882940                WriteOverall()
     941                WritePhaseTemplate()
    883942            # report the phase info
    884             WritePhaseTemplate()
    885943            WritePhaseInfo(phasenam)
    886944            if hist.startswith("PWDR") and not self.quickmode:
Note: See TracChangeset for help on using the changeset viewer.