Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
sensei
sensei
Commits
a4f720cf
Commit
a4f720cf
authored
Aug 23, 2018
by
Burlen Loring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add script to generate oscillator configs
parent
2d83bb5e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
0 deletions
+81
-0
miniapps/oscillators/README.md
miniapps/oscillators/README.md
+4
-0
miniapps/oscillators/inputs/generate_input.py
miniapps/oscillators/inputs/generate_input.py
+77
-0
No files found.
miniapps/oscillators/README.md
View file @
a4f720cf
...
...
@@ -6,6 +6,10 @@ voxel-wise autocorrelations for all window sizes up to the specified input (via
`-w`
option). It also finds the voxels with the
`k`
strongest autocorrelations
(for every shift).
The oscillators' locations and parameters are specified in an input file. See
inputs folder for examples. The
`generate_input.py`
script can generate a set
of randomly initialized oscillators.
The simulation code is in
`oscillator.cpp`
.
The analysis interface is specified in
`analysis.h`
.
The actual analysis code is in
`analysis.cpp`
.
...
...
miniapps/oscillators/inputs/generate_input.py
0 → 100644
View file @
a4f720cf
import
sys
import
random
from
math
import
sqrt
pi
=
3.1415
# script to generate new oscillator configs
# using random values within a set of ranges
# nosc -- number of osciallators to genrate
# nx,ny -- grid dimensions
# r0,r1 -- min/max width of the Guassian splat
# w0,w1 -- min/max frequency
# z0,z1 -- min/max damping coeficient
# dfrac -- ratio of damped to periodic type
nosc
=
128
nx
=
ny
=
2048
r0
=
8
r1
=
96
w0
=
pi
/
4.
w1
=
16.
*
pi
z0
=
0.0
z1
=
1.0
dfrac
=
0.75
x0
=
r1
x1
=
nx
-
r1
def
rng
(
x0
,
x1
):
return
x0
+
(
x1
-
x0
)
*
random
.
random
()
sys
.
stderr
.
write
(
'#type center r omega0 zeta
\n
'
)
max_dist
=
0.
min_dist
=
x1
-
x0
pts
=
[]
i
=
0
while
i
<
nosc
:
x
=
rng
(
x0
,
x1
)
y
=
rng
(
x0
,
x1
)
w
=
rng
(
w0
,
w1
)
r
=
rng
(
r0
,
r1
)
z
=
rng
(
z0
,
z1
)
t
=
'damped'
if
random
.
random
()
<
dfrac
else
'periodic'
sys
.
stderr
.
write
(
'%s %d %d %d %f %f %f
\n
'
%
(
t
,
x
,
y
,
0.
,
r
,
w
,
z
))
pts
+=
[
x
,
y
,
z
]
i
+=
1
i
=
0
while
i
<
nosc
:
xa
=
pts
[
3
*
i
]
ya
=
pts
[
3
*
i
+
1
]
za
=
pts
[
3
*
i
+
2
]
j
=
0
while
j
<
nosc
:
if
i
!=
j
:
xb
=
pts
[
3
*
j
]
yb
=
pts
[
3
*
j
+
1
]
zb
=
pts
[
3
*
j
+
2
]
dx
=
xb
-
xa
dy
=
yb
-
ya
dz
=
zb
-
za
max_dist
=
max
(
max_dist
,
sqrt
(
dx
**
2
+
dy
**
2
+
dz
**
2
))
min_dist
=
min
(
min_dist
,
sqrt
(
dx
**
2
+
dy
**
2
+
dz
**
2
))
j
+=
1
i
+=
1
sys
.
stderr
.
write
(
'# max_dist = %f
\n
'
%
(
max_dist
))
sys
.
stderr
.
write
(
'# min_dist = %f
\n
'
%
(
min_dist
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment