Skip to main content
Homepage
Explore
Search or go to…
/
Sign in
Explore
Primary navigation
Project
H
HAP_Tutorial_2018
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Collapse sidebar
Snippets
Groups
Projects
Show more breadcrumbs
David Josef Schmidt
HAP_Tutorial_2018
Commits
88b4a56c
Commit
88b4a56c
authored
Feb 15, 2018
by
JGlombitza
Browse files
Options
Downloads
Patches
Plain Diff
change data path
parent
76756103
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
AirShower_WGAN/ShowerGAN.py
+8
-11
8 additions, 11 deletions
AirShower_WGAN/ShowerGAN.py
AirShower_WGAN/utils.py
+4
-10
4 additions, 10 deletions
AirShower_WGAN/utils.py
with
12 additions
and
21 deletions
AirShower_WGAN/ShowerGAN.py
+
8
−
11
View file @
88b4a56c
...
...
@@ -8,7 +8,6 @@ from keras.layers.advanced_activations import LeakyReLU
from
functools
import
partial
from
keras.utils
import
plot_model
import
keras.backend.tensorflow_backend
as
KTF
import
glob
import
utils
import
tensorflow
as
tf
...
...
@@ -16,22 +15,19 @@ import tensorflow as tf
KTF
.
set_session
(
utils
.
get_session
())
# Allows 2 jobs per GPU, Please do not change this during the tutorial
log_dir
=
"
.
"
EPOCHS
=
3
EPOCHS
=
10
GRADIENT_PENALTY_WEIGHT
=
10
BATCH_SIZE
=
256
NCR
=
5
latent_size
=
512
# load trainings data
filenames
=
glob
.
glob
(
"
*.npz
"
)
shower_maps
,
Energy
=
utils
.
ReadInData
(
filenames
)
#
shower_maps
= shower_maps[:,:,:,1,np.newaxis]
#np.savez("Data", Energy=Energy,
shower_maps
=
sh
ower_maps)
Energy
=
Energy
/
np
.
max
(
Energy
)
# load trainings data
shower_maps
,
Energy
=
utils
.
ReadInData
()
N
=
shower_maps
.
sh
ape
[
0
]
# plot real signal patterns
utils
.
plot_multiple_signalmaps
(
shower_maps
[:,:,:,
0
],
log_dir
=
log_dir
,
title
=
'
Footprints
'
,
epoch
=
'
Real
'
)
N
=
shower_maps
.
shape
[
0
]
class
RandomWeightedAverage
(
_Merge
):
"""
Takes a randomly-weighted average of two tensors. In geometric terms, this outputs a random point on the line
...
...
@@ -116,6 +112,7 @@ critic_loss = []
iterations_per_epoch
=
N
//
((
NCR
+
1
)
*
BATCH_SIZE
)
for
epoch
in
range
(
EPOCHS
):
print
"
epoch:
"
,
epoch
# plot berfore each epoch generated signal patterns
generated_map
=
generator
.
predict_on_batch
(
np
.
random
.
randn
(
BATCH_SIZE
,
latent_size
))
utils
.
plot_multiple_signalmaps
(
generated_map
[:,:,:,
0
],
log_dir
=
log_dir
,
title
=
'
Generated Footprints Epoch:
'
,
epoch
=
str
(
epoch
))
for
iteration
in
range
(
iterations_per_epoch
):
...
...
@@ -131,6 +128,6 @@ for epoch in range(EPOCHS):
utils
.
plot_loss
(
critic_loss
,
name
=
"
critic
"
,
log_dir
=
log_dir
)
utils
.
plot_loss
(
generator_loss
,
name
=
"
generator
"
,
log_dir
=
log_dir
)
# plot some generated
f
ig
ure
s
# plot some generated
s
ig
nal pattern
s
generated_map
=
generator
.
predict
(
np
.
random
.
randn
(
BATCH_SIZE
,
latent_size
))
utils
.
plot_multiple_signalmaps
(
generated_map
[:,:,:,
0
],
log_dir
=
log_dir
,
title
=
'
Generated Footprints
'
,
epoch
=
'
Final
'
)
This diff is collapsed.
Click to expand it.
AirShower_WGAN/utils.py
+
4
−
10
View file @
88b4a56c
...
...
@@ -15,17 +15,11 @@ def get_session(gpu_fraction=0.40):
return
tf
.
Session
(
config
=
tf
.
ConfigProto
(
gpu_options
=
gpu_options
))
def
ReadInData
(
filenames
):
def
ReadInData
():
'''
Reads in the trainings data
'''
N
=
100000
*
len
(
filenames
)
a
=
100000
shower_maps
=
np
.
zeros
(
N
*
9
*
9
*
1
).
reshape
(
N
,
9
,
9
,
1
)
Energy
=
np
.
zeros
(
N
)
for
i
in
range
(
0
,
len
(
filenames
)):
data
=
np
.
load
(
filenames
[
i
])
Energy
[
a
*
i
:
a
*
(
i
+
1
)]
=
data
[
'
Energy
'
]
shower_maps
[
a
*
i
:
a
*
(
i
+
1
)]
=
data
[
'
shower_maps
'
].
reshape
(
a
,
9
,
9
,
1
)
return
shower_maps
,
Energy
filenames
=
"
/net/scratch/JGlombitza/Public/HAPWorkshop2018/data/Data.npz
"
data
=
np
.
load
(
filenames
)
return
data
[
'
shower_maps
'
],
data
[
'
Energy
'
]
def
make_trainable
(
model
,
trainable
):
...
...
...
...
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
sign in
to comment