Changeset 4361


Ignore:
Timestamp:
Mar 11, 2020 4:43:45 PM (20 months ago)
Author:
toby
Message:

fix hist CIF export, remove dev. ver of IntPDFtool

Location:
trunk
Files:
2 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r4349 r4361  
    7272        print('Updating...')
    7373        GSASIIpath.svnUpdateProcess()
    74     GSASIIpath.InvokeDebugOpts()
    7574    import GSASIIdataGUI as G2gd   
    7675    G2gd.GSASIImain(application) # start the GUI
    7776    if sys.platform == "darwin":
    7877        wx.CallLater(100,application.ClearStartup)
     78    GSASIIpath.InvokeDebugOpts()
    7979    application.MainLoop()
  • trunk/GSASIIIO.py

    r4345 r4361  
    14291429                return True
    14301430            elif len(self.powderDict) == 1:
    1431                 self.histnam = self.powderDict.values()
     1431                self.histnam = list(self.powderDict.values())
    14321432            elif self.multiple:
    14331433                choices = sorted(self.powderDict.values())
  • trunk/GSASIIIntPDFtool.py

    r4053 r4361  
    1 '''Independent-running GSAS-II based auto-integration program with minimal
     1#!/usr/bin/env python
     2# -*- coding: utf-8 -*-
     3#GSAS-II autointegration routines
     4########### SVN repository information ###################
     5# $Date: $
     6# $Author: $
     7# $Revision: $
     8# $URL: $
     9# $Id: $
     10########### SVN repository information ###################
     11'''
     12*GSASIIautoint: autointegration routines*
     13---------------------------------------------
     14
     15Independent-running GSAS-II based auto-integration program with minimal
    216GUI, no visualization but intended to implement significant levels of
    317parallelization.
     
    3246import GSASIIscriptable as G2sc
    3347import multiprocessing as mp
     48
     49try: # fails during doc build
     50    wxMainFrameStyle = wx.DEFAULT_FRAME_STYLE ^ wx.CLOSE_BOX
     51except:
     52    wxMainFrameStyle = None
    3453
    3554class AutoIntFrame(wx.Frame):
     
    185204
    186205        def TestInput(*args,**kwargs):
    187             'Determine if the start button should be enabled'
     206            '''Determine if the start button should be enabled and
     207            ask for the exporter type with ambiguous extensions
     208            '''
     209            for dfmt,obj in self.fmtlist.items():
     210                fmt = dfmt[1:]
     211                if not self.params['outsel'][fmt]: continue
     212                if fmt in self.multipleFmtChoices: continue
     213                if type(obj) is not list: continue # only one exporter for this
     214                choices = []
     215                for e in obj:
     216                    choices.append(e.formatName)
     217                if len(choices) == 0:
     218                    print('Error: why 0 choices in TestInput?')
     219                    continue
     220                if len(choices) == 1:
     221                    print('Error: why 1 choice in TestInput?')
     222                    self.multipleFmtChoices[fmt] = obj[0].formatName
     223                    continue
     224                # select the format here
     225                dlg = G2G.G2SingleChoiceDialog(self,
     226                        'There is more than one format with a '+
     227                        '.{} output. Choose the one to use'.format(fmt),
     228                        'Choose output format',choices)
     229                dlg.CenterOnParent()
     230                dlg.clb.SetSelection(0)  # force a selection
     231                if dlg.ShowModal() == wx.ID_OK and dlg.GetSelection() >= 0:
     232                    self.multipleFmtChoices[fmt] = choices[dlg.GetSelection()]
     233                dlg.Destroy()
     234               
    188235            writingSomething = False
    189236            writingPDF = False
     
    431478        self.params['outdir'] = os.getcwd()
    432479        self.PDFformats = ('I(Q)', 'S(Q)', 'F(Q)', 'G(r)', 'PDFgui')
     480        self.multipleFmtChoices = {}
    433481        #GSASIIpath.IPyBreak_base()
    434482       
    435483        wx.Frame.__init__(self, None, title='Automatic Integration',
    436                           style=wx.DEFAULT_FRAME_STYLE)
     484                          style=wxMainFrameStyle)
    437485        self.Status = self.CreateStatusBar()
    438486        self.Status.SetStatusText('Press Start to load and integrate images matching filter')
     
    497545        sizer = wx.BoxSizer(wx.HORIZONTAL)
    498546        sizer.Add(wx.StaticText(mnpnl, wx.ID_ANY,'Select format(s):'))
    499         for dfmt in self.fmtlist:
     547        for dfmt in sorted(self.fmtlist):
    500548            sizer.Add((6,2)) # add a bit of extra space
    501549            fmt = dfmt[1:]
     
    712760                dir = os.path.join(self.params['outdir'],
    713761                                   fmt.replace("(","_").replace(")",""))
    714                 if not os.path.exists(dir): os.makedirs(dir)           
     762                if not os.path.exists(dir): os.makedirs(dir)
    715763        return False
    716764               
     
    734782            outputSelect = self.params['outsel']
    735783            PDFformats = self.PDFformats
    736             outputModes = (outputSelect,PDFformats,self.fmtlist,outdir)
     784            outputModes = (outputSelect,PDFformats,self.fmtlist,outdir,
     785                               self.multipleFmtChoices)
    737786            if PDFobj:
    738787                PDFdict = PDFobj.data
     
    833882    '''
    834883    (TableMode,ComputePDF,SeparateDir,optPDF) = calcModes
    835     (outputSelect,PDFformats,fmtlist,outdir) = outputModes           
     884    (outputSelect,PDFformats,fmtlist,outdir,multipleFmtChoices) = outputModes
    836885    if SeparateDir:
    837886        savedir = os.path.join(outdir,'gpx')
     
    872921            if not outputSelect[fmt]: continue
    873922            if fmtlist[dfmt] is None: continue
     923            hint = ''
     924            if fmt in multipleFmtChoices:
     925                hint = multipleFmtChoices[fmt]
    874926            if SeparateDir:
    875927                savedir = os.path.join(outdir,fmt)
     
    880932            for i,h in enumerate(hists):
    881933                fname = h.name[5:].replace(' ','_')
     934                #if len(hists) > 1:
     935                GSASIIpath.IPyBreak_base()
    882936                try:
    883937                    fil = os.path.join(savedir,fname)
    884                     print('Wrote',h.Export(fil,dfmt))
     938                    print('Wrote',h.Export(fil,dfmt,hint))
    885939                except Exception as msg:
    886940                    print('Failed to write {} as {}. Error msg\n{}'
  • trunk/GSASIIimgGUI.py

    r4345 r4361  
    100100                if darkImg is not None:               
    101101                    sumImg += np.array(darkImage*darkScale,dtype='int32')
     102            else:
     103                print('Warning: resetting dark image (not found: {})'.format(
     104                    darkImg))
     105                data['dark image'][0] = darkImg = ''
    102106    if 'background image' in data:
    103107        backImg,backScale = data['background image']           
  • trunk/docs/source/G2tools.rst

    r4336 r4361  
    66Both are under development.
    77
    8 .. automodule:: G2AutoInt
    9     :members:
    10 
    11 .. automodule:: GSASIIautoInt
     8.. automodule:: GSASIIIntPDFtool.py
    129    :members:
    1310
  • trunk/exports/G2export_CIF.py

    r4289 r4361  
    14171417                            '  '+datablockidDict[phasenam]
    14181418                            )
    1419             else:
     1419            elif len(self.Phases) == 1:
    14201420                # single phase in this histogram
    1421                 pfx = '0:'+str(hId)+':'
     1421                # get the phase number here
     1422                pId = self.Phases[list(self.Phases.keys())[0]]['pId']
     1423                pfx = str(pId)+':'+str(hId)+':'
    14221424                WriteCIFitem(self.fp, '_refine_ls_R_F_factor      ','%.5f'%(histblk[pfx+'Rf']/100.))
    14231425                WriteCIFitem(self.fp, '_refine_ls_R_Fsqd_factor   ','%.5f'%(histblk[pfx+'Rf^2']/100.))
    1424 
    1425             WriteCIFitem(self.fp, '_pd_proc_ls_prof_R_factor   ','%.5f'%(histblk['R']/100.))
    1426             WriteCIFitem(self.fp, '_pd_proc_ls_prof_wR_factor  ','%.5f'%(histblk['wR']/100.))
    1427             WriteCIFitem(self.fp, '_gsas_proc_ls_prof_R_B_factor ','%.5f'%(histblk['Rb']/100.))
    1428             WriteCIFitem(self.fp, '_gsas_proc_ls_prof_wR_B_factor','%.5f'%(histblk['wRb']/100.))
    1429             WriteCIFitem(self.fp, '_pd_proc_ls_prof_wR_expected','%.5f'%(histblk['wRmin']/100.))
     1426               
     1427            try:
     1428                WriteCIFitem(self.fp, '_pd_proc_ls_prof_R_factor   ','%.5f'%(histblk['R']/100.))
     1429                WriteCIFitem(self.fp, '_pd_proc_ls_prof_wR_factor  ','%.5f'%(histblk['wR']/100.))
     1430                WriteCIFitem(self.fp, '_gsas_proc_ls_prof_R_B_factor ','%.5f'%(histblk['Rb']/100.))
     1431                WriteCIFitem(self.fp, '_gsas_proc_ls_prof_wR_B_factor','%.5f'%(histblk['wRb']/100.))
     1432                WriteCIFitem(self.fp, '_pd_proc_ls_prof_wR_expected','%.5f'%(histblk['wRmin']/100.))
     1433            except KeyError:
     1434                pass
    14301435
    14311436            if histblk['Instrument Parameters'][0]['Type'][1][1] == 'X':
Note: See TracChangeset for help on using the changeset viewer.