EppicChooseParamsBase

class PlasmaCalcs.hookups.eppic.eppic_choose_params.EppicChooseParamsBase(values={}, *, dirname=None, **values_as_kw)

Bases: object

class to help with choosing parameters for eppic.i file.

Probably, use EppicChooseParams instead.

values: dict
{varname: value} for all pairs to update.
Can also provide {dist number: dict of {varname: value} pairs to update for this dist}
(inside of dist number dicts, varname can end with dist number or not;
assume it does end with dist number in the file itself though)
In this case, will be immediately converted to values_flat format.

values_as_kw: optionally, provide additional values as kwargs.

Methods

items()

keys()

setdefault([values])

setdefault for self.values.

str_from([src, missing_values_ok, comment])

return str to use for the entire contents of the new, updated eppic.i file.

update([values])

update self.values with values.

values_flat([values])

return these values as a 'flat' dict, suitable for using to update eppic.i file.

write([src, dst, exists_ok, ...])

write updated eppic.i file to dst.

setdefault(values={}, **values_as_kw)

setdefault for self.values. returns self.

Like self.update, but doesn’t overwrite existing values.
str_from(src='eppic.i', missing_values_ok=True, comment='previously={old}', **kw)

return str to use for the entire contents of the new, updated eppic.i file.

src: str
path to source file to use as template.
missing_values_ok: bool
whether it is okay for some of the varnames in values to not exist in eppic.i
comment: None or str
if not None, append comment as a comment to all updated lines.
Also, this comment will be hit by .format(old=old value)
additional kw passed to get_updated_eppic_i_str
update(values={}, **values_as_kw)

update self.values with values. returns self

static values_flat(values={}, **values_as_kw)

return these values as a ‘flat’ dict, suitable for using to update eppic.i file.

This is a dict of {key: value} pairs, appending dist number to key name where appropriate.
write(src='eppic.i', dst='eppic_updated.i', *, exists_ok=False, missing_values_ok=True, comment='previously={old}', **kw)

write updated eppic.i file to dst.

src: str
path to source file to use as template.
dst: str
path to destination file to write.
exists_ok: bool, default False
whether it is okay for dst to already exist.
missing_values_ok: bool
whether it is okay for some of the varnames in values to not exist in eppic.i
comment: None or str
if not None, append comment as a comment to all updated lines.
Also, this comment will be hit by .format(old=old value)
additional kw passed to update_eppic_i_file.
return abspath to dst.