Skip to content

Make it easier to set defaults for "format" #113

@mbercx

Description

@mbercx

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions