PlasmaCalcs.hookups.eppic.eppic_io_tools.read_eppic_i_file

PlasmaCalcs.hookups.eppic.eppic_io_tools.read_eppic_i_file(filename='eppic.i', *, eval=True)
Parse EPPIC input from the file, returning (dict of global vars, dict of dists).
dict of global vars has {varname: value} for all pairs not inside a distribution.
dict of dists has {N: {varname: value} for all pairs in dist} for each dist;
for each varname in a dist, ensure varname ends with str(N) (append it if necessary).
the N’s will all be stored here as ints.
Arguments:
filename: string, default ‘eppic.i’
file to read from.
eval: bool, default True
whether to attempt to evaluate the values,
using ast.literal_eval (safer but less flexible than eval).
if True, try to evaluate values but use strings if evaluation fails.
if False, values will remain as strings.
Notes:
- file formatting:
- semicolons (;) are used for comments. (idl format)
- ignore blank lines & lines that don’t assign a variable (missing ‘=’)
- ignores all leading & trailing whitespace in vars & values.
- special var: “dist{N}”, where N is any integer (or empty string).
- after finding this, start storing lines in result[“dist{dist}”]
- e.g. “dist1=1” –> result[“dist1”][var] = value.
same behavior if “dist=1”.
- additionally, N will be appended to var names if it is not already there,
e.g. “dist1=1”, “var=7” –> result[“dist1”][“var1”] = 7
- if “dist{N}” appears AGAIN, use it as the new dist; store lines in result[“dist{N}”]
- special var: “fndist”
- if found, stop storing lines in result[“dist{dist}”]