Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Make sure that the as_type argument is respected for Frame.put_parameters for lists of values as well #575

Merged
merged 1 commit into from
Apr 3, 2024
Merged
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 python/podio/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def put_parameter(self, key, value, as_type=None):
raise ValueError(f"Cannot put a parameter of type {type_name} into a Frame")

par_type = vec_types[0]
if isinstance(value[0], float):
if as_type is None and isinstance(value[0], float):
# Always store floats as doubles from the python side
par_type = par_type.replace("float", "double")

Expand Down
1 change: 1 addition & 0 deletions tests/read_python_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ int checkParameters(const podio::Frame& frame) {
if (realFloats.size() != 3 || realFloats[0] != 1.23f || realFloats[1] != 4.56f || realFloats[2] != 7.89f) {
std::cerr << "Parameter more_real_floats was not stored as correctly (expected [1.23, 4.56, 7.89], actual"
<< realFloats << ")" << std::endl;
return 1;
}

return 0;
Expand Down
Loading