fix: VectorYX2DIrregular from_dict round-trip (missing values property)#342
Merged
Conversation
The dictable serialization in autoconf inspects the constructor signature and
emits getattr(obj, arg) for each arg that satisfies hasattr(obj, arg).
VectorYX2DIrregular.__init__ takes (values, grid), but the class lacked a
`values` property, so only `grid` was serialized and from_dict raised:
TypeError: VectorYX2DIrregular.__init__() missing 1 required
positional argument: 'values'
This blocked al.from_json for any WeakDataset / ShearYX2DIrregular. Mirror
the pattern already used by Grid2DIrregular.values and ArrayIrregular.values
so all consumers of to_dict / from_dict work without further changes.
Refs PyAutoLens issue #554.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 28, 2026
Merged
Collaborator
Author
|
Workspace PR: PyAutoLabs/autolens_workspace#212 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
al.from_jsonfailed to load a serialisedWeakDataset/ShearYX2DIrregularbecauseVectorYX2DIrregulardid not expose itsvaluesconstructor argument as an attribute.autoconf.dictable.instance_as_dictconsequently emitted a serialized dict containing onlygrid, andfrom_dictthen raisedTypeError: VectorYX2DIrregular.__init__() missing 1 required positional argument: 'values'.This PR adds a one-line
valuesproperty mirroring the pattern already used byGrid2DIrregular.valuesandArrayIrregular.values. BothVectorYX2DIrregularand itsShearYX2DIrregularsubclass (in PyAutoGalaxy) now round-trip throughoutput_to_json/from_json.Refs PyAutoLens issue #554.
API Changes
Added a new public read-only
valuesproperty onVectorYX2DIrregularreturning the underlying(N, 2)ndarray. Purely additive — no existing call sites readvec.values. See full details below.Test Plan
test__json_round_tripcoversoutput_to_json→from_jsonforVectorYX2DIrregulartest_autoarray/structures/vectors/andtest_autoarray/structures/grids/suites pass locally (88 tests)Full API Changes (for automation & release notes)
Added
autoarray.structures.vectors.irregular.VectorYX2DIrregular.values— property returning the raw(total_vectors, 2)ndarray of[y, x]components.Migration
None — additive only. Existing code that constructed
VectorYX2DIrregular(values=…, grid=…)is unchanged; the new property simply exposes the stored array under the samevaluesname used at construction time.🤖 Generated with Claude Code