While working on #111, I thinking of implementing an outputs namespace where users can find truly available outputs:
@cached_property
def outputs(self) -> SimpleNamespace:
"""
Namespace populated ONLY with successfully retrievable outputs.
Access like: `parser.outputs.structure`, `parser.outputs.fermi_energy`, ...
"""
namespace = SimpleNamespace()
for name in self.list_outputs():
try:
val = self.get_output(name)
except GlomError:
continue
setattr(namespace, name, val)
return namespace
Neat, but what if they want the outputs in a certain format (e.g. ASE)? Since the outputs are a property, they can't pass a fmt argument here, as with the get_output method. Still would be nice to support this tab-completion approach, though.
Perhaps we can store a default format on class:
pw_out = PwOutput.from_dir('qe_dir', fmt='ase')
And perhaps this default should even be configurable package-wide? Just thought for now.
While working on #111, I thinking of implementing an
outputsnamespace where users can find truly available outputs:Neat, but what if they want the outputs in a certain format (e.g. ASE)? Since the
outputsare a property, they can't pass afmtargument here, as with theget_outputmethod. Still would be nice to support this tab-completion approach, though.Perhaps we can store a default format on class:
And perhaps this default should even be configurable package-wide? Just thought for now.