Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
execution-time
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
qronos-state-abstractions
execution-time
Commits
1d74e8e5
Commit
1d74e8e5
authored
2 years ago
by
Tim Rheinfels
Browse files
Options
Downloads
Patches
Plain Diff
scripts: add script for handling result data
parent
ca398823
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/data.py
+67
-0
67 additions, 0 deletions
scripts/data.py
with
67 additions
and
0 deletions
scripts/data.py
0 → 100644
+
67
−
0
View file @
1d74e8e5
## This file is part of the execution-time evaluation for the qronos observer abstractions.
## Copyright (C) 2022-2023 Tim Rheinfels <tim.rheinfels@fau.de>
## See https://gitlab.cs.fau.de/qronos-state-abstractions/execution-time
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <https://www.gnu.org/licenses/>.
###
### @file data.py
###
### @brief Provides functionality for handling the evaluation data
###
### @author Tim Rheinfels <tim.rheinfels@fau.de>
###
import
numpy
as
np
import
ujson
as
json
import
logging
import
struct
###
### @brief Reads the evaluation JSON data from @p path, performs
### some checks and returns it as dictionary.
###
### @param path Path to the JSON file
###
### @returns Dictionary containing the evaluation data
###
def
load_json_data
(
path
):
with
open
(
path
,
'
r
'
)
as
f
:
data
=
f
.
read
()
# Now we can parse it as json
data
=
json
.
loads
(
data
)
# Check if git revision is dirty
if
data
[
'
version
'
][
'
git_revision
'
].
endswith
(
'
-dirty
'
):
logging
.
warning
(
'
Data stored under
"
%s
"
has dirty git revision: %s
'
%
(
path
,
data
[
'
version
'
][
'
git_revision
'
]))
# Check if unit tests succeeded
if
not
data
[
'
unit_tests
'
][
'
success
'
]:
logging
.
error
(
'
Unit tests did not succeed for data stored under
"
%s
"
: %s
'
%
(
path
,
data
[
'
unit_tests
'
][
'
output
'
]))
# Done.
return
data
###
### @brief Decodes a single-precision float @p data encoded as integer
###
### @param data Single-precision float encoded as 32-bit integer
###
### @returns Decoded single-precision float represented by @p data
###
def
decode
(
data
):
if
isinstance
(
data
,
list
):
return
np
.
array
([
decode
(
x
)
for
x
in
data
],
dtype
=
np
.
float32
)
return
struct
.
unpack
(
'
<f
'
,
struct
.
pack
(
'
<I
'
,
data
))[
0
]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment