Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs598mp-fall2021-proj
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
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
chsieh16
cs598mp-fall2021-proj
Commits
42721b28
Commit
42721b28
authored
2 years ago
by
aastorg2
Browse files
Options
Downloads
Patches
Plain Diff
properly extracting data from .npz
parent
20cb1dbc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dtree_synth_agbot.py
+37
-5
37 additions, 5 deletions
dtree_synth_agbot.py
with
37 additions
and
5 deletions
dtree_synth_agbot.py
+
37
−
5
View file @
42721b28
...
@@ -11,14 +11,28 @@ from typing import Dict, Hashable, List, Tuple
...
@@ -11,14 +11,28 @@ from typing import Dict, Hashable, List, Tuple
import
numpy
as
np
import
numpy
as
np
import
z3
import
z3
from
dtree_learner
import
DTreeLearner
as
Learner
from
dtree_learner
import
DTreeLearner
as
Learner
from
gem
_stanley_teacher
import
DTree
GEM
StanleyGurobiTeacher
as
Teacher
from
agbot
_stanley_teacher
import
DTree
AgBot
StanleyGurobiTeacher
as
AgBot
Teacher
def
load_examples_from_npz
(
file_name
:
str
,
spec
)
->
Tuple
[
List
[
Tuple
[
float
,
...]],
List
[
Tuple
[
float
,
...]]]:
def
load_examples_from_npz
(
file_name
:
str
,
teacher
:
AgBotTeacher
,
partition
):
print
(
"
Loading examples
"
)
print
(
"
Loading examples from .npz
"
)
npz_data
=
np
.
load
(
file_name
,
allow_pickle
=
True
)
#with open(file_name, "rb") as npz_file_io:
npz_data
=
np
.
load
(
file_name
)
files
=
npz_data
.
_files
data_5d
=
npz_data
[
'
dps_arr
'
]
#print(npz_data._files)
# x_arr[:-1], except the last one, x_arr[1:]except the first one
print
(
data_5d
[
0
])
print
(
len
(
data_5d
))
print
(
teacher
.
is_positive_example
(
data_5d
[
0
]))
exit
(
0
)
exit
(
0
)
with
open
(
file_name
,
"
rb
"
)
as
pickle_file_io
:
with
open
(
file_name
,
"
rb
"
)
as
pickle_file_io
:
pkl_data
=
pickle
.
load
(
pickle_file_io
)
pkl_data
=
pickle
.
load
(
pickle_file_io
)
...
@@ -40,5 +54,23 @@ def load_examples_from_npz(file_name: str, spec) -> Tuple[List[Tuple[float, ...]
...
@@ -40,5 +54,23 @@ def load_examples_from_npz(file_name: str, spec) -> Tuple[List[Tuple[float, ...]
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
load_examples_from_npz
(
"
data/800_truths-uniform_partition_4x20-1.2m-pi_12-one_straight_road-2021-10-27-08-49-17.bag.pickle
"
,
None
)
NPZ_FILE_PATH
=
"
data/perceptor-agbot-collect_images_2021-10-29-01-37-44-0.0-50.0.npz
"
X_LIM
=
np
.
inf
X_ARR
=
np
.
array
([
-
X_LIM
,
X_LIM
])
Y_LIM
=
1.2
NUM_Y_PARTS
=
4
Y_ARR
=
np
.
linspace
(
-
Y_LIM
,
Y_LIM
,
NUM_Y_PARTS
+
1
)
YAW_LIM
=
np
.
pi
/
12
NUM_YAW_PARTS
=
10
YAW_ARR
=
np
.
linspace
(
-
YAW_LIM
,
YAW_LIM
,
NUM_YAW_PARTS
+
1
)
PARTITION
=
(
X_ARR
,
Y_ARR
,
YAW_ARR
)
main_teacher
=
AgBotTeacher
()
load_examples_from_npz
(
NPZ_FILE_PATH
,
main_teacher
,
PARTITION
)
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