def wgfaRead(ions, filename=None, elvlcname=-1, total=False, verbose=False): """ Read CHIANTI data from a .wgfa file. Parameters ---------- ions : `str` Ion, e.g. 'c_5' for C V filename : `str` Custom filename, will override that specified by `ions` elvlcname : `str` If specified, the lsj term labels are returned in the `pretty1` and `pretty2` keys of `Wgfa` total : `bool` Return the level 2 avalue data in `Wgfa` verbose : `bool` Returns ------- Wgfa : `dict` Information read from the .wgfa file. The dictionary structure is {"lvl1","lvl2","wvl","gf","avalue","ref","ionS","filename"} Notes ----- This is text-wise not different than the v8 version except that it uses the archival elvlcRead in `~ChiantiPy.tools.archival` though this has now been commented out. Can this routine be removed? Should the elvlcRead routine be uncommented? See Also -------- ChiantiPy.tools.io.wgfaRead : Read .wgfa file with the new format. """ # if filename: wgfaname = filename if elvlcname < 0: elvlcname = 0 elvlc = 0 elif not elvlcname: elvlcname = os.path.splitext(wgfaname)[0] + '.elvlc' if os.path.isfile(elvlcname): elvlc = elvlcRead('', elvlcname) else: elvlc = 0 else: elvlc = elvlcRead('', elvlcname) else: fname = util.ion2filename(ions) wgfaname = fname + '.wgfa' elvlcname = fname + '.elvlc' if os.path.isfile(elvlcname): elvlc = elvlcRead('', elvlcname) else: elvlc = 0 if verbose: if elvlc: print(' have elvlc data') else: print(' do not have elvlc data') # input = open(wgfaname, 'r') s1 = input.readlines() input.close() nwvl = 0 ndata = 2 while ndata > 1: s1a = s1[nwvl] s2 = s1a.split() ndata = len(s2) nwvl += 1 nwvl -= 1 if verbose: print(' nwvl = %10i ndata = %4i' % (nwvl, ndata)) lvl1 = [0] * nwvl lvl2 = [0] * nwvl wvl = [0.] * nwvl gf = [0.] * nwvl avalue = [0.] * nwvl if elvlc: pretty1 = [''] * nwvl pretty2 = [''] * nwvl # if verbose: print(' nwvl = %10i' % (nwvl)) # wgfaFormat = '(2i5,f15.3,2e15.3)' for ivl in range(nwvl): inpt = FortranLine(s1[ivl], wgfaFormat) lvl1[ivl] = inpt[0] lvl2[ivl] = inpt[1] wvl[ivl] = inpt[2] gf[ivl] = inpt[3] avalue[ivl] = inpt[4] if elvlc: pretty1[ivl] = elvlc['pretty'][inpt[0] - 1] pretty2[ivl] = elvlc['pretty'][inpt[1] - 1] ref = [] # should skip the last '-1' in the file for i in range(nwvl + 1, len(s1) - 1): s1a = s1[i][:-1] ref.append(s1a.strip()) Wgfa = { "lvl1": lvl1, "lvl2": lvl2, "wvl": wvl, "gf": gf, "avalue": avalue, "ref": ref, 'ionS': ions, 'filename': wgfaname } if total: avalueLvl = [0.] * max(lvl2) for iwvl in range(nwvl): avalueLvl[lvl2[iwvl] - 1] += avalue[iwvl] Wgfa['avalueLvl'] = avalueLvl if elvlc: Wgfa['pretty1'] = pretty1 Wgfa['pretty2'] = pretty2 # return Wgfa
def elvlcRead(ions, filename=0, verbose=0, useTh=0): """ read a chianti energy level file and returns {"lvl":lvl,"conf":conf,"term":term,"spin":spin,"l":l,"spd":spd,"j":j ,"mult":mult,"ecm":ecm,"eryd":eryd,"ecmth":ecmth,"erydth":erydth,"ref":ref,"pretty":pretty, 'ionS':ions} if a energy value for ecm or eryd is zero(=unknown), the theoretical values (ecmth and erydth) are inserted """ # # (i3,i6,a15,2i3,a3,f4.1,i3,f15.3,f15.6,f15.3,f15.6,f15.3,f15.6) # fstring='i3,i6,a15,i3,i3,a3,f4.1,i3,4f15.2' # elvlcFormat=FortranFormat(fstring) # header_line = FortranRecordReader('i3,i6,a15,i3,i3,a3,i3,f4.1,f15.3,f15.6,f15.3,f15.6') header_line = FortranRecordReader( 'i3,i6,a15,i3,i3,a3,f4.1,i3,f15.3,f15.6,f15.3,f15.6') #',f4.1') # if filename: elvlname = filename bname = os.path.basename(filename) ions = bname.split('.')[0] else: fname = util.ion2filename(ions) elvlname = fname + '.elvlc' if not os.path.isfile(elvlname): print((' elvlc file does not exist: %s' % (elvlname))) return {'status': 0} status = 1 input = open(elvlname, 'r') s1 = input.readlines() input.close() nlvls = 0 ndata = 2 while ndata > 1: s1a = s1[nlvls][:-1] s2 = s1a.split() ndata = len(s2) nlvls = nlvls + 1 nlvls -= 1 if verbose: print((' nlvls = %i' % (nlvls))) lvl = [0] * nlvls conf = [0] * nlvls term = [0] * nlvls spin = [0] * nlvls l = [0] * nlvls spd = [0] * nlvls j = [0] * nlvls mult = [0] * nlvls ecm = [0] * nlvls eryd = [0] * nlvls ecmth = [0] * nlvls erydth = [0] * nlvls pretty = [0] * nlvls label = [] for i in range(0, nlvls): if verbose: print((s1[i][0:115])) # inpt = FortranLine(s1[i][0:115],elvlcFormat) inpt = header_line.read(s1[i]) lvl[i] = inpt[0] conf[i] = inpt[1] label.append(str(inpt[1])) term[i] = inpt[2].strip() spin[i] = inpt[3] l[i] = inpt[4] spd[i] = inpt[5].strip() j[i] = inpt[6] mult[i] = inpt[7] ecm[i] = inpt[8] eryd[i] = inpt[9] ecmth[i] = inpt[10] erydth[i] = inpt[11] if ecm[i] == 0.: if useTh: ecm[i] = ecmth[i] eryd[i] = erydth[i] stuff = term[i].strip() + ' %1i%1s%3.1f' % (spin[i], spd[i], j[i]) pretty[i] = stuff.strip() ref = [] for i in range(nlvls + 1, len(s1) - 1): s1a = s1[i][:-1] ref.append(s1a.strip()) # self.const.Elvlc = {"lvl":lvl,"conf":conf,"term":term,"spin":spin,"l":l,"spd":spd,"j":j # ,"mult":mult,"ecm":ecm,"eryd":eryd,"ecmth":ecmth,"erydth":erydth,"ref":ref} return { "lvl": lvl, "conf": conf, "label": label, "term": term, "spin": spin, "l": l, "spd": spd, "j": j, "mult": mult, "ecm": ecm, "eryd": eryd, "ecmth": ecmth, "erydth": erydth, "ref": ref, "pretty": pretty, 'ionS': ions, 'status': status }
def wgfaRead(ions, filename=None, elvlcname=-1, total=False, verbose=False): """ Read CHIANTI data from a .wgfa file. Parameters ---------- ions : `str` Ion, e.g. 'c_5' for C V filename : `str` Custom filename, will override that specified by `ions` elvlcname : `str` If specified, the lsj term labels are returned in the `pretty1` and `pretty2` keys of `Wgfa` total : `bool` Return the level 2 avalue data in `Wgfa` verbose : `bool` Returns ------- Wgfa : `dict` Information read from the .wgfa file. The dictionary structure is {"lvl1","lvl2","wvl","gf","avalue","ref","ionS","filename"} Notes ----- This is text-wise not different than the v8 version except that it uses the archival elvlcRead in `~ChiantiPy.tools.archival` though this has now been commented out. Can this routine be removed? Should the elvlcRead routine be uncommented? See Also -------- ChiantiPy.tools.io.wgfaRead : Read .wgfa file with the new format. """ # if filename: wgfaname = filename if elvlcname < 0: elvlcnamee = 0 elvlc = 0 elif not elvlcname: elvlcname = os.path.splitext(wgfaname)[0] + '.elvlc' if os.path.isfile(elvlcname): elvlc = elvlcRead('', elvlcname) else: elvlc = 0 else: elvlc = elvlcRead('',elvlcname) else: fname=util.ion2filename(ions) wgfaname=fname+'.wgfa' elvlcname = fname + '.elvlc' if os.path.isfile(elvlcname): elvlc = elvlcRead('', elvlcname) else: elvlc = 0 if verbose: if elvlc: print(' have elvlc data') else: print(' do not have elvlc data') # input=open(wgfaname,'r') s1=input.readlines() input.close() nwvl=0 ndata=2 while ndata > 1: s1a=s1[nwvl] s2=s1a.split() ndata=len(s2) nwvl += 1 nwvl -= 1 if verbose: print(' nwvl = %10i ndata = %4i'%(nwvl, ndata)) lvl1=[0]*nwvl lvl2=[0]*nwvl wvl=[0.]*nwvl gf=[0.]*nwvl avalue=[0.]*nwvl if elvlc: pretty1 = ['']*nwvl pretty2 = ['']*nwvl # if verbose: print(' nwvl = %10i'%(nwvl)) # wgfaFormat='(2i5,f15.3,2e15.3)' for ivl in range(nwvl): inpt=FortranLine(s1[ivl],wgfaFormat) lvl1[ivl]=inpt[0] lvl2[ivl]=inpt[1] wvl[ivl]=inpt[2] gf[ivl]=inpt[3] avalue[ivl]=inpt[4] if elvlc: pretty1[ivl] = elvlc['pretty'][inpt[0] - 1] pretty2[ivl] = elvlc['pretty'][inpt[1] - 1] ref=[] # should skip the last '-1' in the file for i in range(nwvl+1,len(s1) -1): s1a=s1[i][:-1] ref.append(s1a.strip()) Wgfa={"lvl1":lvl1,"lvl2":lvl2,"wvl":wvl,"gf":gf,"avalue":avalue,"ref":ref, 'ionS':ions, 'filename':wgfaname} if total: avalueLvl = [0.]*max(lvl2) for iwvl in range(nwvl): avalueLvl[lvl2[iwvl] -1] += avalue[iwvl] Wgfa['avalueLvl'] = avalueLvl if elvlc: Wgfa['pretty1'] = pretty1 Wgfa['pretty2'] = pretty2 # return Wgfa
def elvlcRead(ions, filename = 0, verbose=0, useTh=0): """ read a chianti energy level file and returns {"lvl":lvl,"conf":conf,"term":term,"spin":spin,"l":l,"spd":spd,"j":j ,"mult":mult,"ecm":ecm,"eryd":eryd,"ecmth":ecmth,"erydth":erydth,"ref":ref,"pretty":pretty, 'ionS':ions} if a energy value for ecm or eryd is zero(=unknown), the theoretical values (ecmth and erydth) are inserted """ # # (i3,i6,a15,2i3,a3,f4.1,i3,f15.3,f15.6,f15.3,f15.6,f15.3,f15.6) # fstring='i3,i6,a15,i3,i3,a3,f4.1,i3,4f15.2' # elvlcFormat=FortranFormat(fstring) # header_line = FortranRecordReader('i3,i6,a15,i3,i3,a3,i3,f4.1,f15.3,f15.6,f15.3,f15.6') header_line = FortranRecordReader('i3,i6,a15,i3,i3,a3,f4.1,i3,f15.3,f15.6,f15.3,f15.6') #',f4.1') # if filename: elvlname = filename bname = os.path.basename(filename) ions = bname.split('.')[0] else: fname = util.ion2filename(ions) elvlname = fname+'.elvlc' if not os.path.isfile(elvlname): print((' elvlc file does not exist: %s'%(elvlname))) return {'status':0} status = 1 input = open(elvlname,'r') s1 = input.readlines() input.close() nlvls = 0 ndata = 2 while ndata > 1: s1a = s1[nlvls][:-1] s2 = s1a.split() ndata = len(s2) nlvls = nlvls+1 nlvls -= 1 if verbose: print((' nlvls = %i'%(nlvls))) lvl = [0]*nlvls conf = [0]*nlvls term = [0]*nlvls spin = [0]*nlvls l = [0]*nlvls spd = [0]*nlvls j = [0]*nlvls mult = [0]*nlvls ecm = [0]*nlvls eryd = [0]*nlvls ecmth = [0]*nlvls erydth = [0]*nlvls pretty = [0]*nlvls label = [] for i in range(0,nlvls): if verbose: print((s1[i][0:115])) # inpt = FortranLine(s1[i][0:115],elvlcFormat) inpt = header_line.read(s1[i]) lvl[i] = inpt[0] conf[i] = inpt[1] label.append(str(inpt[1])) term[i] = inpt[2].strip() spin[i] = inpt[3] l[i] = inpt[4] spd[i] = inpt[5].strip() j[i] = inpt[6] mult[i] = inpt[7] ecm[i] = inpt[8] eryd[i] = inpt[9] ecmth[i] = inpt[10] erydth[i] = inpt[11] if ecm[i] == 0.: if useTh: ecm[i] = ecmth[i] eryd[i] = erydth[i] stuff = term[i].strip() + ' %1i%1s%3.1f'%( spin[i], spd[i], j[i]) pretty[i] = stuff.strip() ref = [] for i in range(nlvls+1,len(s1)-1): s1a = s1[i][:-1] ref.append(s1a.strip()) # self.const.Elvlc = {"lvl":lvl,"conf":conf,"term":term,"spin":spin,"l":l,"spd":spd,"j":j # ,"mult":mult,"ecm":ecm,"eryd":eryd,"ecmth":ecmth,"erydth":erydth,"ref":ref} return {"lvl":lvl,"conf":conf,"label":label,"term":term,"spin":spin,"l":l,"spd":spd,"j":j ,"mult":mult,"ecm":ecm,"eryd":eryd,"ecmth":ecmth,"erydth":erydth,"ref":ref,"pretty":pretty, 'ionS':ions, 'status':status}
def setupNew(self, dir=0, verbose=0): ''' if ion is initiated with setup=0, this allows the setup to be done at a later point perhaps, more importantly, by setting dir to a directory containing the necessary files for a ChiantiPy ion, it allows one to setup an ion with files not in the current Chianti directory this is a development version for integrating auoionizing levels etc into the main ion ''' # # read in all data if in masterlist # if not, there should still be ionization and recombination rates # MasterList = chdata.MasterList # if dir: fileName = os.path.join(dir, self.IonStr) else: fileName = util.ion2filename(self.IonStr) if self.IonStr in MasterList: if dir: self.Elvlc = io.elvlcRead('', filename=fileName + '.elvlc', verbose=verbose) self.Wgfa = io.wgfaRead('', filename=fileName + '.wgfa', elvlcname=fileName + '.elvlc', total=1) self.Nwgfa = len(self.Wgfa['lvl1']) nlvlWgfa = max(self.Wgfa['lvl2']) nlvlList = [nlvlWgfa] # splupsfile = fileName + '.splups' scupsfile = fileName + '.scups' if os.path.isfile(scupsfile): # happens the case of fe_3 and prob. a few others self.Scups = io.scupsRead('', filename=fileName + '.scups') self.Nscups = len(self.Scups['lvl1']) nlvlScups = max(self.Scups['lvl2']) nlvlList.append(nlvlScups) self.Nsplups = 0 # nlvlSplups = 0 # else: # if os.path.isfile(splupsfile): # self.Nscups = 0 # nlvlScups = 0 # # happens the case of fe_3 and prob. a few others # self.Splups = io.splupsRead('', filename=fileName+'.splups') # self.Nsplups=len(self.Splups['lvl1']) # nlvlSplups = max(self.Splups['lvl2']) # nlvlList.append(nlvlSplups) else: self.Nscups = 0 nlvlScups = 0 print('do not have a scups file for %s' % (self.IonStr)) else: self.Elvlc = io.elvlcRead(self.IonStr, verbose=verbose) self.Wgfa = io.wgfaRead(self.IonStr, total=1) self.Nwgfa = len(self.Wgfa['lvl1']) nlvlWgfa = max(self.Wgfa['lvl2']) nlvlList = [nlvlWgfa] # splupsfile = fileName + '.splups' scupsfile = fileName + '.scups' if os.path.isfile(scupsfile): # happens the case of fe_3 and prob. a few others self.Scups = io.scupsRead(self.IonStr) self.Nsplups = len(self.Scups['lvl1']) nlvlScups = max(self.Scups['lvl2']) nlvlList.append(nlvlScups) self.Nsplups = 0 # nlvlSplups = 0 # else: # if os.path.isfile(splupsfile): # self.Nscups = 0 # nlvlScups = 0 # # happens the case of fe_3 and prob. a few others # self.Splups = io.splupsRead(self.IonStr) # self.Nsplups=len(self.Splups['lvl1']) # nlvlSplups = max(self.Splups['lvl2']) # nlvlList.append(nlvlSplups) else: print('do not have either a scups file for %s' (self.IonStr)) self.Nscups = 0 nlvlScups = 0 ## self.Nlvls = nlvlElvlc # file = fileName + '.cilvl' if os.path.isfile(file): self.Cilvl = io.cireclvlRead('', filename=fileName, cilvl=1) self.Ncilvl = len(self.Cilvl['lvl1']) nlvlCilvl = max(self.Cilvl['lvl2']) nlvlList.append(nlvlCilvl) else: self.Ncilvl = 0 # # not longer using the reclvl files # using the new rrlvl - radiaitive recombination rates only # dielectronic rates derived from the autoionization values in the .auto file reclvlfile = fileName + '.reclvl' if os.path.isfile(reclvlfile): self.Reclvl = io.cireclvlRead('', filename=fileName, reclvl=1) self.Nreclvl = len(self.Reclvl['lvl1']) nlvlReclvl = max(self.Reclvl['lvl2']) nlvlList.append(nlvlReclvl) else: self.Nreclvl = 0 # in setupNew, the dielsplups files are disregarded # .dielsplups file may not exist # dielsplupsfile = fileName +'.dielsplups' # if os.path.isfile(dielsplupsfile): # self.DielSplups = io.splupsRead('', filename=dielsplupsfile, filetype='splups') # self.Ndielsplups=len(self.DielSplups["lvl1"]) # nlvlDielSplups = max(self.DielSplups['lvl2']) # nlvlList.append(nlvlDielSplups) # else: # self.Ndielsplups = 0 # # psplups file may not exist psplupsfile = fileName + '.psplups' if os.path.isfile(psplupsfile): self.Psplups = io.splupsRead('', filename=psplupsfile, filetype='psplups') self.Npsplups = len(self.Psplups["lvl1"]) else: self.Npsplups = 0 # drparamsFile = fileName + '.drparams' if os.path.isfile(drparamsFile): self.DrParams = io.drRead(self.IonStr) # rrparamsFile = fileName + '.rrparams' if os.path.isfile(rrparamsFile): self.RrParams = io.rrRead(self.IonStr) # # get autoionizing A-values autoFile = fileName + '.auto' if os.path.isfile(autoFile): self.Auto = io.wgfaRead('', filename=autoFile) # not needed for ion, only phion # photoxfile = util.ion2filename(self.IonStr)+'.photox' # if os.path.isfile(photoxfile): # self.Photox = util.photoxRead(self.IonStr) # # need to determine the number of levels that can be populated nlvlElvlc = len(self.Elvlc['lvl']) # print ' nlvlElvlc = ', nlvlElvlc # print ' other nlvls = ', nlvlList # nlvlWgfa = max(self.Wgfa['lvl2']) # elvlc file can have more levels than the rate level files self.Nlvls = min([nlvlElvlc, max(nlvlList)])
def setupNew(self, dir=0, verbose=0): ''' if ion is initiated with setup=0, this allows the setup to be done at a later point perhaps, more importantly, by setting dir to a directory containing the necessary files for a ChiantiPy ion, it allows one to setup an ion with files not in the current Chianti directory this is a development version for integrating auoionizing levels etc into the main ion ''' # # read in all data if in masterlist # if not, there should still be ionization and recombination rates # MasterList = chdata.MasterList # if dir: fileName = os.path.join(dir, self.IonStr) else: fileName = util.ion2filename(self.IonStr) if self.IonStr in MasterList: if dir: self.Elvlc = io.elvlcRead('', filename=fileName+'.elvlc', verbose=verbose) self.Wgfa = io.wgfaRead('', filename=fileName+'.wgfa', elvlcname=fileName+'.elvlc', total=1) self.Nwgfa=len(self.Wgfa['lvl1']) nlvlWgfa = max(self.Wgfa['lvl2']) nlvlList =[nlvlWgfa] # splupsfile = fileName + '.splups' scupsfile = fileName + '.scups' if os.path.isfile(scupsfile): # happens the case of fe_3 and prob. a few others self.Scups = io.scupsRead('', filename=fileName+'.scups') self.Nscups=len(self.Scups['lvl1']) nlvlScups = max(self.Scups['lvl2']) nlvlList.append(nlvlScups) self.Nsplups = 0 # nlvlSplups = 0 # else: # if os.path.isfile(splupsfile): # self.Nscups = 0 # nlvlScups = 0 # # happens the case of fe_3 and prob. a few others # self.Splups = io.splupsRead('', filename=fileName+'.splups') # self.Nsplups=len(self.Splups['lvl1']) # nlvlSplups = max(self.Splups['lvl2']) # nlvlList.append(nlvlSplups) else: self.Nscups = 0 nlvlScups = 0 print('do not have a scups file for %s'%(self.IonStr)) else: self.Elvlc = io.elvlcRead(self.IonStr, verbose=verbose) self.Wgfa = io.wgfaRead(self.IonStr, total=1) self.Nwgfa=len(self.Wgfa['lvl1']) nlvlWgfa = max(self.Wgfa['lvl2']) nlvlList =[nlvlWgfa] # splupsfile = fileName + '.splups' scupsfile = fileName + '.scups' if os.path.isfile(scupsfile): # happens the case of fe_3 and prob. a few others self.Scups = io.scupsRead(self.IonStr) self.Nsplups=len(self.Scups['lvl1']) nlvlScups = max(self.Scups['lvl2']) nlvlList.append(nlvlScups) self.Nsplups = 0 # nlvlSplups = 0 # else: # if os.path.isfile(splupsfile): # self.Nscups = 0 # nlvlScups = 0 # # happens the case of fe_3 and prob. a few others # self.Splups = io.splupsRead(self.IonStr) # self.Nsplups=len(self.Splups['lvl1']) # nlvlSplups = max(self.Splups['lvl2']) # nlvlList.append(nlvlSplups) else: print('do not have either a scups file for %s'(self.IonStr)) self.Nscups = 0 nlvlScups = 0 ## self.Nlvls = nlvlElvlc # file = fileName +'.cilvl' if os.path.isfile(file): self.Cilvl = io.cireclvlRead('',filename = fileName, cilvl=1) self.Ncilvl=len(self.Cilvl['lvl1']) nlvlCilvl = max(self.Cilvl['lvl2']) nlvlList.append(nlvlCilvl) else: self.Ncilvl = 0 # # not longer using the reclvl files # using the new rrlvl - radiaitive recombination rates only # dielectronic rates derived from the autoionization values in the .auto file reclvlfile = fileName +'.reclvl' if os.path.isfile(reclvlfile): self.Reclvl = io.cireclvlRead('',filename=fileName, reclvl=1) self.Nreclvl = len(self.Reclvl['lvl1']) nlvlReclvl = max(self.Reclvl['lvl2']) nlvlList.append(nlvlReclvl) else: self.Nreclvl = 0 # in setupNew, the dielsplups files are disregarded # .dielsplups file may not exist # dielsplupsfile = fileName +'.dielsplups' # if os.path.isfile(dielsplupsfile): # self.DielSplups = io.splupsRead('', filename=dielsplupsfile, filetype='splups') # self.Ndielsplups=len(self.DielSplups["lvl1"]) # nlvlDielSplups = max(self.DielSplups['lvl2']) # nlvlList.append(nlvlDielSplups) # else: # self.Ndielsplups = 0 # # psplups file may not exist psplupsfile = fileName +'.psplups' if os.path.isfile(psplupsfile): self.Psplups = io.splupsRead('', filename=psplupsfile, filetype='psplups') self.Npsplups=len(self.Psplups["lvl1"]) else: self.Npsplups = 0 # drparamsFile = fileName +'.drparams' if os.path.isfile(drparamsFile): self.DrParams = io.drRead(self.IonStr) # rrparamsFile = fileName +'.rrparams' if os.path.isfile(rrparamsFile): self.RrParams = io.rrRead(self.IonStr) # # get autoionizing A-values autoFile = fileName + '.auto' if os.path.isfile(autoFile): self.Auto = io.wgfaRead('', filename=autoFile) # not needed for ion, only phion # photoxfile = util.ion2filename(self.IonStr)+'.photox' # if os.path.isfile(photoxfile): # self.Photox = util.photoxRead(self.IonStr) # # need to determine the number of levels that can be populated nlvlElvlc = len(self.Elvlc['lvl']) # print ' nlvlElvlc = ', nlvlElvlc # print ' other nlvls = ', nlvlList # nlvlWgfa = max(self.Wgfa['lvl2']) # elvlc file can have more levels than the rate level files self.Nlvls = min([nlvlElvlc, max(nlvlList)])