Skip to content

Inappropriate tuple-like type for RawAngles #606

@yousefmoazzam

Description

@yousefmoazzam

When generating a pydantic model to represent the standard tomo loader config, I noticed that the rotation_angles parameter was being seen as an array of 1 element. This is because RawAngles is a NamedTuple:

class RawAngles(NamedTuple):
"""
Configure rotation angle values to come from a dataset within the input NeXuS/hdf5 file.
"""
data_path: str

and a NamedTuple has the ability to access elements by a zero-based index (like a normal tuple).

This way of accessing the single entry in RawAngles isn't particularly useful in any way, so is unnecessary. Accessing values via the keys in the dict is the only way that makes much sense for RawAngles, therefore, a TypedDict seems like a more sensible type for it.

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