Module for reading and writing data files as well as parsing of
information.
Author: R. Lombaert
anything. Or function.
|
read(func,
module=<module 'ComboCode.cc.tools.io.DataIO' from '/Users/robinl/Com... ,
return_func=0,
*args,
**kwargs)
Takes any function given as a str (preceding modules separated with a
dot '.' ) and passes any additional args and kwargs to the function
found in either the DataIO module or the given module. |
source code
|
|
int
|
findKey(i,
data,
key)
Find the index of the line that contains the first occurrence of a
keyword. |
source code
|
|
list[]
|
getKeyData(incr,
filename,
keyword,
single=1)
Search a data file with data in a single (or multiple) columns,
separated by comment lines containing the type of data. |
source code
|
|
array
|
|
list/array
|
getGastronoomOutput(filename,
keyword=' RADIUS ' ,
begin_index=0,
return_array=0,
key_index=0)
Search GASTRoNOoM output for relevant envelope information. |
source code
|
|
list
|
getInputData(path=' /Users/robinl/ComboCode/usr ' ,
keyword=' STAR_NAME ' ,
filename=' Star.dat ' ,
remove_underscore=0,
make_float=1,
start_index=1,
rindex=None)
Search ComboCode/usr files for parameters. |
source code
|
|
list[string] or list[list[string]]
|
readFile(filename,
delimiter=None,
replace_spaces=1)
Read file, and return content with delimiter of choice. |
source code
|
|
dict
|
readDict(filename=None,
lines=None,
delimiter=' = ' ,
comment_chars=[ ' # ' ] ,
convert_lists=0,
convert_floats=0,
convert_ints=0,
multi_keys=[ ] ,
start_row=0,
end_row=None,
key_modifier=None)
Read a file as a dictionary. |
source code
|
|
float or int
|
|
string
|
|
float or string
|
|
string
|
|
|
|
(list,list)
|
removeComments(lines,
comment_chars=[ ' # ' , ' ! ' , ' ; ' ] )
Split input from comments and return both as separate lists. |
source code
|
|
list[list or array] or (list[list or array],list[str])
|
readCols(filename,
delimiter=' ' ,
make_float=1,
start_row=0,
make_array=1,
nans=0,
start_from_keyword='
' ,
return_comments=0,
comment_chars=[ ' # ' , ' ! ' , ' ; ' ] ,
end_row=None)
Read columns, remove comments and turn into floats. |
source code
|
|
list[string] or list[list[string]]
|
splitLines(lines,
delimiter=None,
replace_spaces=1)
Split lines based on a delimiter of choice, which can be None. |
source code
|
|
|
writeFile(filename,
input_lines,
mode=' w ' ,
delimiter=' \n ' )
Write file with a list of strings as input. |
source code
|
|
|
|
|
|
int
|
findNumber(index,
floats)
Starting from index, find the index of the next number different from
zero in the list. |
source code
|
|
int
|
findZero(index,
floats)
Starting from index, find the index of the next number equal to zero
in the list. |
source code
|
|
int
|
findFloat(index,
vals)
Starting from index, find the index of the next float in the list,
zero or non-zero. |
source code
|
|
int
|
|
|
|
|
joinPdf(old,
new,
del_old=1)
Join .pdf files into a single .pdf and remove the separate ones. |
source code
|
|
|
checkLink(path,
ln_path,
folder=1)
Check if a link exists between two paths, and if not create it. |
source code
|
|
str
|
|
list[tuple(list[string])] or tuple(list[string])
|
checkEntryInfo(input_list,
number_of_keys,
info_type)
Specific input keywords for ComboCode (currently: MOLECULE,
TRANSITION, R_POINTS_MASS_LOSS) require multiple arguments separated
by a space. |
source code
|
|
recarray
|
|
recarray
|
|
list
|
|