Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-advanced-user-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-advanced-user-tools
Merge requests
!18
Improved the handling of numpy scalars in cfoods.h5.h5_attr_to_property
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Improved the handling of numpy scalars in cfoods.h5.h5_attr_to_property
improving-h5-scalar-attribute-handling
into
dev
Overview
0
Commits
3
Pipelines
1
Changes
2
Merged
Alexander Kreft
requested to merge
improving-h5-scalar-attribute-handling
into
dev
3 years ago
Overview
0
Commits
3
Pipelines
1
Changes
2
Expand
See
https://gitlab.com/caosdb/caosdb-advanced-user-tools/-/merge_requests/84
0
0
Merge request reports
Compare
dev
dev (base)
and
latest version
latest version
f349f9a2
3 commits,
3 years ago
2 files
+
12
−
7
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
src/caosadvancedtools/cfoods/h5.py
+
8
−
6
Options
@@ -6,6 +6,8 @@
# Copyright (C) 2020 Daniel Hornung <d.hornung@indiscale.com>
# Copyright (C) 2021 Henrik tom Wörden <h.tomwoerden@indiscale.com>
# Copyright (C) 2021 Alexander Kreft
# Copyright (C) 2021 Laboratory for Fluid Physics and Biocomplexity,
# Max-Planck-Insitute für Dynamik und Selbstorganisation <www.lfpn.ds.mpg.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -85,13 +87,13 @@ def h5_attr_to_property(val):
if
isinstance
(
val
,
np
.
ndarray
):
if
val
.
ndim
>
1
:
return
None
,
None
if
val
.
ndim
==
0
:
raise
NotImplementedError
(
"
Code assumes that scalar values
"
"
will not be given as np.ndarray objects
"
)
val
=
list
(
val
)
# The tolist method is on both numpy.ndarray and numpy.generic
# and properly converts scalars (including 0-dimensional
# numpy.ndarray) to Python scalars and 1D arrays to lists of
# Python scalars.
if
val
.
ndim
!=
0
:
dtype
=
db
.
LIST
(
dtype
)
val
=
val
.
tolist
()
# TODO this can eventually be removed
Loading