Changeset 5086


Ignore:
Timestamp:
Nov 18, 2021 12:17:50 AM (6 months ago)
Author:
toby
Message:

more mmCIF seqCIF work: export used hists, fix R-factor reporting, address checkCIF issues; seq table: save Use flags in SeqTable?, prevent Use from being hidden, fix highlighting when deltaChi is hidden

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIseqGUI.py

    r5042 r5086  
    900900    def onSelectSeqVars(event):
    901901        '''Select which variables will be shown in table'''
    902         hides = [saveColLabels[1:].index(item) for item in G2frame.SeqTblHideList if
    903                      item in saveColLabels[1:]]
     902        hides = [saveColLabels[2:].index(item) for item in G2frame.SeqTblHideList if
     903                     item in saveColLabels[2:]]
    904904        dlg = G2G.G2MultiChoiceDialog(G2frame, 'Select columns to hide',
    905                 'Hide columns',saveColLabels[1:])
     905                'Hide columns',saveColLabels[2:])
    906906        dlg.SetSelections(hides)
    907907        if dlg.ShowModal() == wx.ID_OK:
    908             G2frame.SeqTblHideList = [saveColLabels[1:][sel] for sel in dlg.GetSelections()]
     908            G2frame.SeqTblHideList = [saveColLabels[2:][sel] for sel in dlg.GetSelections()]
    909909            dlg.Destroy()
    910910            UpdateSeqResults(G2frame,data,G2frame.dataDisplay.GetSize()) # redisplay variables
     
    913913           
    914914    def OnCellChange(event):
     915        c = event.GetCol()
     916        if c != 1: return
    915917        r = event.GetRow()
    916         val = G2frame.SeqTable.GetValue(r,0)
    917 #        print (r,val)
    918         G2frame.SeqTable.SetValue(r,0, val)
     918        val = G2frame.SeqTable.GetValue(r,c)
     919        data['Use'][r] = val
     920        G2frame.SeqTable.SetValue(r,c, val)
    919921       
    920922    def OnSelectUpdate(event):
     
    12241226    #else:
    12251227    #    G2frame.dataWindow.SequentialFile.Enable(G2G.wxID_ORGSEQSEL,False)
    1226     #-----  build up the data table by columns -----------------------------------------------
     1228    ####--  build up the data table by columns -----------------------------------------------
    12271229    histNames = foundNames
    12281230    nRows = len(histNames)
    1229     G2frame.colList = [list(range(nRows)),nRows*[True]]
     1231    G2frame.colList = [list(range(nRows))]
     1232    if len(data.get('Use',[])) != nRows:
     1233        data['Use'] = nRows*[True]
     1234    G2frame.colList += [data['Use']]
    12301235    G2frame.colSigs = [None,None,]
    12311236    colLabels = ['No.','Use',]
     
    15241529            del G2frame.colList[l]
    15251530            del G2frame.colSigs[l]
     1531            if deltaChiCol == l:
     1532                deltaChiCol = None
    15261533
    15271534    # make a copy of the column labels substituting alternate labels when defined
     
    15641571    G2frame.dataDisplay.AutoSizeColumns(False)
    15651572    # highlight unconverged shifts
    1566     if histNames[0][:4] not in ['SASD','IMG ','REFD',]:
     1573    if histNames[0][:4] not in ['SASD','IMG ','REFD',] and deltaChiCol is not None:
    15671574        for row,name in enumerate(histNames):
    15681575            deltaChi = G2frame.SeqTable.GetValue(row,deltaChiCol)
  • trunk/exports/G2export_CIF.py

    r5085 r5086  
    407407# Refactored over here to allow access by GSASIIscriptable.py
    408408def WriteCIFitem(fp, name, value=''):
    409     '''Helper function for writing CIF output. Translated from exports/G2export_CIF.py'''
    410     # Ignore unicode issues
     409    '''Helper function for writing CIF output.'''
     410    # Ignores unicode issues
    411411    if value:
    412         if "\n" in value or len(value)> 70:
     412        if "\n" in value or (len(value) > 70 and ' ' in value.strip()):
    413413            if name.strip():
    414414                fp.write(name+'\n')
     
    770770                 '\n   _atom_site.fract_z'+
    771771                 '\n   _atom_site.occupancy'+
    772                  '\n   _atom_site.U_iso_or_equiv'+
     772                 '\n   _atom_site.B_iso_or_equiv'+
    773773                 '\n   _atom_site.Cartn_x'+
    774774                 '\n   _atom_site.Cartn_y'+
     
    834834            else:
    835835                dig = 5
    836                 sigdig = -0.09
     836                sigdig = -0.009
    837837            var = pfx+varnames[j]+":"+str(i)
    838838            dvar = pfx+"d"+varnames[j]+":"+str(i)
     
    842842            val = parmDict.get(var,at[j])
    843843            sig = sigDict.get(dvar,sigdig)
     844            if j == cia+1:  # convert U to B
     845                val *= 8*np.pi**2
     846                sig *= 8*np.pi**2
    844847            if dvar in G2mv.GetDependentVars(): # do not include an esd for dependent vars
    845848                sig = -abs(sig)
     
    13561359        BLtable = G2el.GetBLtable(General)
    13571360
    1358     WriteCIFitem(fp, '\nloop_  _atom_site.type_symbol _atom_type.number_in_cell')
     1361    WriteCIFitem(fp, '\nloop_  _atom_type.symbol _atom_type.number_in_cell')
    13591362    s = '       '
    13601363    if not quickmode:
     
    23742377                         phasedict['General']['SGData']['SGSys'])
    23752378
    2376             if phasedict['General']['Type'] in ['nuclear','macromolecular']:
    2377                 spacegroup = phasedict['General']['SGData']['SpGrp'].strip()
    2378                 # regularize capitalization and remove trailing H/R
    2379                 spacegroup = spacegroup[0].upper() + spacegroup[1:].lower().rstrip('rh ')
    2380                 WriteCIFitem(self.fp, '_symmetry_space_group_name_H-M',spacegroup)
     2379              # moved to WriteSeqPhaseVals()
     2380#             if phasedict['General']['Type'] in ['nuclear','macromolecular']:
     2381#                 spacegroup = phasedict['General']['SGData']['SpGrp'].strip()
     2382#                 # regularize capitalization and remove trailing H/R
     2383#                 spacegroup = spacegroup[0].upper() + spacegroup[1:].lower().rstrip('rh ')
     2384#                 WriteCIFitem(self.fp, '_symmetry_space_group_name_H-M',spacegroup)
    23812385   
    2382                 # generate symmetry operations including centering and center of symmetry
    2383                 SymOpList,offsetList,symOpList,G2oprList,G2opcodes = G2spc.AllOps(
    2384                     phasedict['General']['SGData'])
    2385                 WriteCIFitem(self.fp, 'loop_\n    _space_group_symop_id\n    _space_group_symop_operation_xyz')
    2386                 for i,op in enumerate(SymOpList,start=1):
    2387                     WriteCIFitem(self.fp, '   {:3d}  {:}'.format(i,op.lower()))
    2388             elif phasedict['General']['Type'] == 'magnetic':
    2389                 parentSpGrp = phasedict['General']['SGData']['SpGrp'].strip()
    2390                 parentSpGrp = parentSpGrp[0].upper() + parentSpGrp[1:].lower().rstrip('rh ')
    2391                 WriteCIFitem(self.fp, '_parent_space_group.name_H-M_alt',parentSpGrp)
    2392 #                [Trans,Uvec,Vvec] = phasedict['General']['SGData']['fromParent']         #save these
    2393                 spacegroup = phasedict['General']['SGData']['MagSpGrp'].strip()
    2394                 spacegroup = spacegroup[0].upper() + spacegroup[1:].lower().rstrip('rh ')
    2395                 WriteCIFitem(self.fp, '_space_group_magn.name_BNS',spacegroup)
    2396                 WriteCIFitem(self.fp, '_space_group.magn_point_group',phasedict['General']['SGData']['MagPtGp'])
    2397 
    2398                 # generate symmetry operations including centering and center of symmetry
    2399                 SymOpList,offsetList,symOpList,G2oprList,G2opcodes = G2spc.AllOps(
    2400                     phasedict['General']['SGData'])
    2401                 SpnFlp = phasedict['General']['SGData']['SpnFlp']
    2402                 WriteCIFitem(self.fp, 'loop_\n    _space_group_symop_magn_operation.id\n    _space_group_symop_magn_operation.xyz')
    2403                 for i,op in enumerate(SymOpList,start=1):
    2404                     if SpnFlp[i-1] >0:
    2405                         opr = op.lower()+',+1'
    2406                     else:
    2407                         opr = op.lower()+',-1'
    2408                     WriteCIFitem(self.fp, '   {:3d}  {:}'.format(i,opr))
     2386#                 # generate symmetry operations including centering and center of symmetry
     2387#                 SymOpList,offsetList,symOpList,G2oprList,G2opcodes = G2spc.AllOps(
     2388#                     phasedict['General']['SGData'])
     2389#                 WriteCIFitem(self.fp, 'loop_\n    _space_group_symop_id\n    _space_group_symop_operation_xyz')
     2390#                 for i,op in enumerate(SymOpList,start=1):
     2391#                     WriteCIFitem(self.fp, '   {:3d}  {:}'.format(i,op.lower()))
     2392#             elif phasedict['General']['Type'] == 'magnetic':
     2393#                 parentSpGrp = phasedict['General']['SGData']['SpGrp'].strip()
     2394#                 parentSpGrp = parentSpGrp[0].upper() + parentSpGrp[1:].lower().rstrip('rh ')
     2395#                 WriteCIFitem(self.fp, '_parent_space_group.name_H-M_alt',parentSpGrp)
     2396# #                [Trans,Uvec,Vvec] = phasedict['General']['SGData']['fromParent']         #save these
     2397#                 spacegroup = phasedict['General']['SGData']['MagSpGrp'].strip()
     2398#                 spacegroup = spacegroup[0].upper() + spacegroup[1:].lower().rstrip('rh ')
     2399#                 WriteCIFitem(self.fp, '_space_group_magn.name_BNS',spacegroup)
     2400#                 WriteCIFitem(self.fp, '_space_group.magn_point_group',phasedict['General']['SGData']['MagPtGp'])
     2401
     2402#                 # generate symmetry operations including centering and center of symmetry
     2403#                 SymOpList,offsetList,symOpList,G2oprList,G2opcodes = G2spc.AllOps(
     2404#                     phasedict['General']['SGData'])
     2405#                 SpnFlp = phasedict['General']['SGData']['SpnFlp']
     2406#                 WriteCIFitem(self.fp, 'loop_\n    _space_group_symop_magn_operation.id\n    _space_group_symop_magn_operation.xyz')
     2407#                 for i,op in enumerate(SymOpList,start=1):
     2408#                     if SpnFlp[i-1] >0:
     2409#                         opr = op.lower()+',+1'
     2410#                     else:
     2411#                         opr = op.lower()+',-1'
     2412#                     WriteCIFitem(self.fp, '   {:3d}  {:}'.format(i,opr))
    24092413                   
    24102414            lam = None
     
    24312435                         phasedict['General']['SGData']['SGSys'])
    24322436
     2437            # generate symmetry operations including centering and center of symmetry
     2438            # note that this would be better in WriteSeqOverallPhaseInfo() so there could
     2439            # be only one copy per phase
    24332440            if phasedict['General']['Type'] in ['nuclear','macromolecular']:
    24342441                spacegroup = phasedict['General']['SGData']['SpGrp'].strip()
     
    24362443                spacegroup = spacegroup[0].upper() + spacegroup[1:].lower().rstrip('rh ')
    24372444                WriteCIFitem(self.fp, '_symmetry_space_group_name_H-M',spacegroup)
     2445   
     2446                # generate symmetry operations including centering and center of symmetry
     2447                SymOpList,offsetList,symOpList,G2oprList,G2opcodes = G2spc.AllOps(
     2448                    phasedict['General']['SGData'])
     2449                WriteCIFitem(self.fp, 'loop_\n    _space_group_symop_id\n    _space_group_symop_operation_xyz')
     2450                for i,op in enumerate(SymOpList,start=1):
     2451                    WriteCIFitem(self.fp, '   {:3d}  {:}'.format(i,op.lower()))
     2452            elif phasedict['General']['Type'] == 'magnetic':
     2453                parentSpGrp = phasedict['General']['SGData']['SpGrp'].strip()
     2454                parentSpGrp = parentSpGrp[0].upper() + parentSpGrp[1:].lower().rstrip('rh ')
     2455                WriteCIFitem(self.fp, '_parent_space_group.name_H-M_alt',parentSpGrp)
     2456#                [Trans,Uvec,Vvec] = phasedict['General']['SGData']['fromParent']         #save these
     2457                spacegroup = phasedict['General']['SGData']['MagSpGrp'].strip()
     2458                spacegroup = spacegroup[0].upper() + spacegroup[1:].lower().rstrip('rh ')
     2459                WriteCIFitem(self.fp, '_space_group_magn.name_BNS',spacegroup)
     2460                WriteCIFitem(self.fp, '_space_group.magn_point_group',phasedict['General']['SGData']['MagPtGp'])
     2461
     2462                # generate symmetry operations including centering and center of symmetry
     2463                SymOpList,offsetList,symOpList,G2oprList,G2opcodes = G2spc.AllOps(
     2464                    phasedict['General']['SGData'])
     2465                SpnFlp = phasedict['General']['SGData']['SpnFlp']
     2466                WriteCIFitem(self.fp, 'loop_\n    _space_group_symop_magn_operation.id\n    _space_group_symop_magn_operation.xyz')
     2467                for i,op in enumerate(SymOpList,start=1):
     2468                    if SpnFlp[i-1] >0:
     2469                        opr = op.lower()+',+1'
     2470                    else:
     2471                        opr = op.lower()+',-1'
     2472                    WriteCIFitem(self.fp, '   {:3d}  {:}'.format(i,opr))
     2473
    24382474            WriteCIFitem(self.fp,"_cell_measurement_temperature",T)
    24392475            defsigL = 3*[-0.00001] + 3*[-0.001] + [-0.01] # significance to use when no sigma
     
    27512787            histblk = self.Histograms[histlbl]
    27522788            inst = histblk['Instrument Parameters'][0]
     2789            if seq:
     2790                resdblk = histblk['Residuals']
     2791            else:
     2792                resdblk = histblk
    27532793            hId = histblk['hId']
    27542794            pfx = ':' + str(hId) + ':'
     
    27792819
    27802820            if not oneblock:
    2781                 if seq:
    2782                     pass
    2783                 elif not phasebyhistDict.get(histlbl):
     2821                if not phasebyhistDict.get(histlbl) and not seq:
    27842822                    WriteCIFitem(self.fp, '\n# No phases associated with this data set')
     2823                elif len(self.Phases) == 1:
     2824                    pId = self.Phases[list(self.Phases.keys())[0]]['pId']
     2825                    pfx = str(pId)+':'+str(hId)+':'
     2826                    WriteCIFitem(self.fp, '_refine_ls_R_F_factor      ','%.5f'%(resdblk[pfx+'Rf']/100.))
     2827                    WriteCIFitem(self.fp, '_refine_ls_R_Fsqd_factor   ','%.5f'%(resdblk[pfx+'Rf^2']/100.))
    27852828                else:
    27862829                    WriteCIFitem(self.fp, '\n# PHASE TABLE')
     
    28192862                        WriteCIFitem(self.fp,
    28202863                            '  '+
    2821                             '  '+G2mth.ValEsd(histblk[pfx+'Rf']/100.,-.00009) +
    2822                             '  '+G2mth.ValEsd(histblk[pfx+'Rf^2']/100.,-.00009)+
     2864                            '  '+G2mth.ValEsd(resdblk[pfx+'Rf']/100.,-.00009) +
     2865                            '  '+G2mth.ValEsd(resdblk[pfx+'Rf^2']/100.,-.00009)+
    28232866                            '  '+str(self.Phases[phasenam]['pId'])+
    28242867                            '  '+datablockidDict[phasenam]
     
    28292872                pId = self.Phases[list(self.Phases.keys())[0]]['pId']
    28302873                pfx = str(pId)+':'+str(hId)+':'
    2831                 WriteCIFitem(self.fp, '_refine_ls_R_F_factor      ','%.5f'%(histblk[pfx+'Rf']/100.))
    2832                 WriteCIFitem(self.fp, '_refine_ls_R_Fsqd_factor   ','%.5f'%(histblk[pfx+'Rf^2']/100.))
     2874                WriteCIFitem(self.fp, '_refine_ls_R_F_factor      ','%.5f'%(resdblk[pfx+'Rf']/100.))
     2875                WriteCIFitem(self.fp, '_refine_ls_R_Fsqd_factor   ','%.5f'%(resdblk[pfx+'Rf^2']/100.))
    28332876               
    28342877            try:
    2835                 WriteCIFitem(self.fp, '_pd_proc_ls_prof_R_factor   ','%.5f'%(histblk['R']/100.))
    2836                 WriteCIFitem(self.fp, '_pd_proc_ls_prof_wR_factor  ','%.5f'%(histblk['wR']/100.))
    2837                 WriteCIFitem(self.fp, '_gsas_proc_ls_prof_R_B_factor ','%.5f'%(histblk['Rb']/100.))
    2838                 WriteCIFitem(self.fp, '_gsas_proc_ls_prof_wR_B_factor','%.5f'%(histblk['wRb']/100.))
    2839                 WriteCIFitem(self.fp, '_pd_proc_ls_prof_wR_expected','%.5f'%(histblk['wRmin']/100.))
     2878                WriteCIFitem(self.fp, '_pd_proc_ls_prof_R_factor   ','%.5f'%(resdblk['R']/100.))
     2879                WriteCIFitem(self.fp, '_pd_proc_ls_prof_wR_factor  ','%.5f'%(resdblk['wR']/100.))
     2880                WriteCIFitem(self.fp, '_gsas_proc_ls_prof_R_B_factor ','%.5f'%(resdblk['Rb']/100.))
     2881                WriteCIFitem(self.fp, '_gsas_proc_ls_prof_wR_B_factor','%.5f'%(resdblk['wRb']/100.))
     2882                WriteCIFitem(self.fp, '_pd_proc_ls_prof_wR_expected','%.5f'%(resdblk['wRmin']/100.))
     2883                if not oneblock: # written in WriteOverall, don't repeat in a one-block CIF
     2884                    WriteCIFitem(self.fp, '_refine_ls_goodness_of_fit_all','%.2f'%(resdblk['wR']/resdblk['wRmin']))
    28402885            except KeyError:
    28412886                pass
     
    30413086            pfx = ':' + str(hId) + ':'
    30423087
     3088            WriteCIFitem(self.fp, '_diffrn.id',str(hId))
     3089            WriteCIFitem(self.fp, '_diffrn.crystal_id',str(hId))
     3090           
    30433091            if 'Lam1' in inst:
    30443092                ratio = self.parmDict.get('I(L2)/I(L1)',inst['I(L2)/I(L1)'][1])
     
    30613109                             PutInCol('2',5))
    30623110            elif 'Lam' in inst:
     3111                WriteCIFitem(self.fp, '_diffrn_radiation.diffrn_id',str(hId))
     3112                WriteCIFitem(self.fp, '_diffrn_radiation.wavelength_id','1')
     3113                WriteCIFitem(self.fp, '_diffrn_radiation_wavelength.id','1')
    30633114                lam1 = self.parmDict.get('Lam',inst['Lam'][1])
    30643115                slam1 = self.sigDict.get('Lam',-0.00009)
     
    38313882        #===============================================================================
    38323883        seqmode = False
    3833         seqHistList = self.G2frame.testSeqRefineMode()
    3834         if seqHistList:
     3884        if self.G2frame.testSeqRefineMode():
    38353885            if self.seqData is None:
    38363886                raise Exception('Use Export/Sequential project for sequential refinements')
    3837             phaseWithHist = True   # include the phase in the same block as the histogram
    38383887            if len(self.Phases) > 1:
    38393888                phaseWithHist = False  # multiple phases per histogram
     3889            else:
     3890                phaseWithHist = True   # include the phase in the same block as the histogram
    38403891            seqmode = True
     3892            seqHistList = [h for h in self.seqData['histNames'] if h in self.seqData]
     3893            if 'Use' in self.seqData and len(seqHistList) == len(self.seqData.get('Use',[])):
     3894                seqHistList = [h for i,h in enumerate(seqHistList) if self.seqData['Use'][i]]
     3895               
    38413896        #===============================================================================
    3842         # the export process for a full CIF starts here (Sequential too)
     3897        ### full CIF export starts here (Sequential too)
    38433898        #===============================================================================
    38443899        # load saved CIF author name
     
    39904045                break
    39914046        #======================================================================
    3992         #---- Start writing the CIF - single block
     4047        # export different types of CIFs below
    39934048        #======================================================================
    39944049        print('Writing CIF output to file '+self.filename+"...")
    39954050        if self.currentExportType == 'single' or self.currentExportType == 'powder':
    3996             #======Data only CIF (powder/xtal) ====================================
     4051            #======================================================================
     4052            #### Data only CIF (powder/xtal) ======================================
     4053            #======================================================================
    39974054            hist = self.histnam[0]
    39984055            self.CIFname = hist[5:40].replace(' ','')
     
    40074064                print ("should not happen")
    40084065        elif oneblock:
    4009             #====Single block, data & phase CIF ===================================
     4066            #======================================================================
     4067            #### Full (data & phase) single block CIF =============================
     4068            #======================================================================
    40104069            WriteCIFitem(self.fp, 'data_'+self.CIFname)
    40114070            if phasenam is None: # if not already selected, select the first phase (should be one)
     
    40554114                WriteSingleXtalData(hist)
    40564115        elif seqHistList:
    4057             #---- sequential fit project (multiblock)  ====================
     4116            #======================================================================
     4117            #### sequential fit export (multiblock)
     4118            #======================================================================
    40584119            for phasenam in sorted(self.Phases.keys()):
    40594120                rId = phasedict['ranId']
    40604121                if rId in self.CellHistSelection: continue
    40614122                self.CellHistSelection[rId] = self._CellSelectHist(phasenam)
    4062             nsteps = 1 + len(self.Phases) + len(self.powderDict) + len(self.xtalDict)
     4123            nsteps = 1 + len(self.Phases) + len(seqHistList)
    40634124            try:
    40644125                dlg = wx.ProgressDialog('CIF progress','starting',nsteps,parent=self.G2frame)
     
    40794140                WriteCIFitem(self.fp, 'data_'+str(self.CIFname)+'_overall')
    40804141                WriteOverall('seq')
    4081                 hist = self.powderDict[sorted(self.powderDict.keys())[0]]
     4142                hist = seqHistList[0]
    40824143                instnam = self.Histograms[hist]["Sample Parameters"]['InstrName']
    40834144                writeCIFtemplate(self.seqSmplParms,'powder',instnam) # powder template
     
    40904151                datablockidDict = {} # save block names here
    40914152                # loop over data blocks
    4092                 if len(self.powderDict) + len(self.xtalDict) > 1:
    4093                     loopprefix = ''
    4094                     WriteCIFitem(self.fp, 'loop_   _pd_block_diffractogram_id')
    4095                 else:
    4096                     loopprefix = '_pd_block_diffractogram_id'
    4097                 for i in sorted(self.powderDict.keys()):
    4098                     hist = self.powderDict[i]
     4153                WriteCIFitem(self.fp, 'loop_   _pd_block_diffractogram_id')
     4154                for hist in seqHistList:
    40994155                    j = self.Histograms[hist]['hId']
    41004156                    datablockidDict[hist] = (str(self.CIFdate) + "|" + str(self.CIFname) + "|" +
    41014157                                             str(self.shortauthorname) + "|" +
    41024158                                             instnam + "_hist_"+str(j))
    4103                     WriteCIFitem(self.fp, loopprefix,datablockidDict[hist])
    4104                 for i in sorted(self.xtalDict.keys()):
    4105                     hist = self.xtalDict[i]
    4106                     histblk = self.Histograms[hist]
    4107                     instnam = histblk["Instrument Parameters"][0]['InstrName']
    4108                     instnam = instnam.replace(' ','')
    4109                     i = histblk['hId']
    4110                     datablockidDict[hist] = (str(self.CIFdate) + "|" + str(self.CIFname) + "|" +
    4111                                              str(self.shortauthorname) + "|" +
    4112                                              instnam + "_hist_"+str(i))
    4113                     WriteCIFitem(self.fp, loopprefix,datablockidDict[hist])
     4159                    WriteCIFitem(self.fp, '  '+datablockidDict[hist])
     4160                # for i in sorted(self.xtalDict.keys()):
     4161                #     hist = self.xtalDict[i]
     4162                #     histblk = self.Histograms[hist]
     4163                #     instnam = histblk["Instrument Parameters"][0]['InstrName']
     4164                #     instnam = instnam.replace(' ','')
     4165                #     i = histblk['hId']
     4166                #     datablockidDict[hist] = (str(self.CIFdate) + "|" + str(self.CIFname) + "|" +
     4167                #                              str(self.shortauthorname) + "|" +
     4168                #                              instnam + "_hist_"+str(i))
     4169                #     WriteCIFitem(self.fp, loopprefix,datablockidDict[hist])
    41144170                # setup and show sequential results table
    41154171                tblLabels,tblValues,tblSigs,tblTypes = mkSeqResTable('cif',seqHistList,self.seqData,
     
    41704226
    41714227                # sample template info: a block for each phase in project
    4172                 i = sorted(self.powderDict.keys())[0]
    4173                 hist = self.powderDict[i]
    4174                 histblk = self.Histograms[hist]
     4228                histblk = self.Histograms[seqHistList[0]]
    41754229                if phaseWithHist:    # include sample info in overall block
     4230                    step += 1
     4231                    dlg.Update(step,"Exporting phase")
    41764232                    phasenam = list(self.Phases.keys())[0]
    41774233                    writeCIFtemplate(self.Phases[phasenam]['General'],'phase',phasenam) # write phase template
     
    41804236                    for j,phasenam in enumerate(sorted(self.Phases.keys())):
    41814237                        pId = self.Phases[phasenam]['pId']
     4238                        step += 1
     4239                        dlg.Update(step,"Exporting phase {}".format(pId))
    41824240                        WriteCIFitem(self.fp, '\n#'+78*'=')
    41834241                        WriteCIFitem(self.fp, 'data_'+self.CIFname+"_overall_phase"+str(j)+'\n')
     
    41874245                # create a block for each histogram, include phase in block for one-phase refinements
    41884246                # or separate blocks for each phase & histogram if more than one phase
    4189                 for i in sorted(self.powderDict.keys()):
    4190                     hist = self.powderDict[i]
    4191                     print('processing hist #',i,hist)
     4247                for i,hist in enumerate(seqHistList):
     4248                    print('processing hist #',i,'hId=',self.Histograms[hist]['hId'],hist)
    41924249                    hId = self.Histograms[hist]['hId']
     4250                    step += 1
    41934251                    dlg.Update(step,"Exporting "+hist.strip())
    41944252                    histblk = self.Histograms[hist]
     
    42714329                dlg.Destroy()
    42724330        else:
    4273             #---- multiblock: multiple phases and/or histograms ====================
     4331            #======================================================================
     4332            #### multiblock: multiple phases and/or histograms export
     4333            #======================================================================
     4334            oneblock = False
    42744335            for phasenam in sorted(self.Phases.keys()):
    42754336                rId = phasedict['ranId']
Note: See TracChangeset for help on using the changeset viewer.