Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lgdo/types/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ def _ak_to_lgdo_or_col_dict(array: ak.Array):

# be smart and just use Array when it makes sense
if (
isinstance(array.type.content, ak.types.NumpyType)
isinstance(array.type.content, (ak.types.NumpyType, ak.types.RegularType))
or array.type.content.parameters.get("__array__") == "string"
):
return Array(array)
Expand Down
11 changes: 11 additions & 0 deletions tests/types/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ def test_ak_array_init():
"b": [[1, 2], [3], [4], [5, 6, 7]],
"c": {"f1": [[], [5], [3, 7, 6], []], "f2": [5, 6, 7, 8]},
"d": ["boh", "hello", "there", "!"],
"e": np.array([[1, 2], [3, 4], [5, 6], [7, 8]]), # 2D RegularType
"f": np.array(
[
[[1, 2], [3, 4]],
[[5, 6], [7, 8]],
[[9, 10], [11, 12]],
[[13, 14], [15, 16]],
]
), # 3D RegularType
}
)
tbl = Table(array)
Expand All @@ -72,6 +81,8 @@ def test_ak_array_init():
assert isinstance(tbl.c, Table)
assert isinstance(tbl.c.f1, lgdo.VectorOfVectors)
assert isinstance(tbl.c.f2, lgdo.Array)
assert isinstance(tbl.e, lgdo.Array)
assert isinstance(tbl.f, lgdo.Array)


def test_ak_array_init_attrs():
Expand Down