|
| 1 | + |
| 2 | + |
| 3 | +PRO ch_check_all_duplicates, outfile=outfile, quiet=quiet |
| 4 | + |
| 5 | +;+ |
| 6 | +; NAME: |
| 7 | +; CH_CHECK_ALL_DUPLICATES |
| 8 | +; |
| 9 | +; PURPOSE: |
| 10 | +; Goes through the complete set of CHIANTI ions and checks for |
| 11 | +; duplicated transitions in the wgfa, scups and rrlvl files. |
| 12 | +; |
| 13 | +; CATEGORY: |
| 14 | +; CHIANTI; validity. |
| 15 | +; |
| 16 | +; CALLING SEQUENCE: |
| 17 | +; CH_CHECK_ALL_DUPLICATES |
| 18 | +; |
| 19 | +; INPUTS: |
| 20 | +; None. |
| 21 | +; |
| 22 | +; OPTIONAL INPUTS: |
| 23 | +; Outfile: The name of a file to send the list of duplicated |
| 24 | +; transitions. If not set, they are send to |
| 25 | +; ch_duplicates.txt in the working directory. |
| 26 | +; |
| 27 | +; KEYWORD PARAMETERS: |
| 28 | +; QUIET: If set, then no information is written to the IDL window. |
| 29 | +; |
| 30 | +; OUTPUTS: |
| 31 | +; The list of problem files is printed to the IDL window (unless /quiet |
| 32 | +; set), and the list of problem transitions is written to |
| 33 | +; ch_duplicates.txt (or OUTFILE). |
| 34 | +; |
| 35 | +; CALLS: |
| 36 | +; CH_READ_LIST_IONS, CH_DUPLICATE_TRANSITIONS, CONVERTNAME, |
| 37 | +; ZION2FILENAME, Z2ELEMENT |
| 38 | +; |
| 39 | +; EXAMPLE: |
| 40 | +; IDL> ch_check_all_duplicates |
| 41 | +; |
| 42 | +; MODIFICATION HISTORY: |
| 43 | +; Ver.1, 07-Feb-2025, Peter Young |
| 44 | +;- |
| 45 | + |
| 46 | + |
| 47 | +mlist=ch_read_list_ions(count=n) |
| 48 | +ions=mlist.list_ions |
| 49 | + |
| 50 | +IF n_elements(outfile) EQ 0 THEN outfile='ch_duplicates.txt' |
| 51 | + |
| 52 | +openw,lout,outfile,/get_lun |
| 53 | + |
| 54 | +problem_files='' |
| 55 | +problem_ions='' |
| 56 | + |
| 57 | +file_ext=['.wgfa','.scups','.rrlvl'] |
| 58 | +n_ext=n_elements(file_ext) |
| 59 | + |
| 60 | +progress,0.0,/reset,label='Progress (%)' |
| 61 | +FOR i=0,n-1 DO BEGIN |
| 62 | + convertname,ions[i],iz,ion,diel=diel |
| 63 | + zion2filename,iz,ion,fname,diel=diel |
| 64 | + FOR j=0,n_ext-1 DO BEGIN |
| 65 | + d=ch_duplicate_transitions(fname+file_ext[j],status=status,/quiet) |
| 66 | + IF status EQ 1 THEN BEGIN |
| 67 | + problem_files=[problem_files,file_basename(fname+file_ext[j])] |
| 68 | + problem_ions=[problem_ions,ions[i]] |
| 69 | + nt=n_elements(d) |
| 70 | + printf,lout,fname+file_ext[j] |
| 71 | + FOR k=0,nt-1 DO BEGIN |
| 72 | + trans=trim(d[k].lvl1)+'-'+trim(d[k].lvl2) |
| 73 | + trans=strpad(trans,10,/after,fill=' ') |
| 74 | + printf,lout,format='(3x,a10," n_trans: ",i2)',trans,d[k].n_trans |
| 75 | + ENDFOR |
| 76 | + ENDIF |
| 77 | + ENDFOR |
| 78 | + progress,100.*float(i+1)/n |
| 79 | +ENDFOR |
| 80 | +progress,100.,/last |
| 81 | + |
| 82 | +free_lun,lout |
| 83 | + |
| 84 | +IF n_elements(problem_files) GT 1 AND NOT keyword_set(quiet) THEN BEGIN |
| 85 | + problem_files=problem_files[1:*] |
| 86 | + problem_ions=problem_ions[1:*] |
| 87 | + n=n_elements(problem_files) |
| 88 | + message,/info,/cont,'There are '+trim(n)+' files with duplicate transitions. They are listed below.' |
| 89 | + FOR i=0,n-1 DO BEGIN |
| 90 | + convertname,problem_ions[i],iz,ion |
| 91 | + z2element,iz-ion+1,seq,/symb |
| 92 | + print,' ',problem_files[i]+' ['+seq+' sequence]' |
| 93 | + ENDFOR |
| 94 | + message,/info,/cont,'Problem transitions are listed in '+outfile+'.' |
| 95 | +ENDIF ELSE BEGIN |
| 96 | + message,/info,/cont,'There are no files with duplicate transitions!' |
| 97 | +ENDELSE |
| 98 | + |
| 99 | +END |
0 commit comments