I have a problem using this start.sh
script.
When I type
./start.sh
, it doesn't work.
I mean, it makes no errors but it does nothing.
When I open this file using VIM (I really want to upload the image, but I can't because I registered this site just few days ago)
the lines from import sys,math,random
to print '\n'
are
all colored red.
After EOS
,
the color is normally shown.
If I type #
in front of cat
, I mean, #cat <<EOS | python > target.txt
, the colors are changed.
So I think this line:
cat <<EOS | python > target.txt
is wrong. How can I correct it?
#!/bin/sh
if [ "$1" = clean ]; then
rm -f *.log *.dat target.txt
exit
fi
num=1
length=1000
period=50
cat <<EOS | python > target.txt
import sys,math,random
funcs = [
lambda t : (0.8 * math.sin(t), 0.8 * math.cos(t)),
lambda t : (0.3 * math.sin(t), 0.3 * math.cos(t)),
lambda t : (0.8 * math.sin(3 * t), 0.8 * math.cos(t)),
lambda t : (0.8 * math.cos(t), 0.8 * math.sin(3 * t)),
lambda t : (0.4 * math.sin(2 * t) + 0.4, 0.8 * math.cos(t)),
lambda t : (0.4 * math.sin(2 * t) - 0.4, 0.8 * math.cos(t)),
lambda t : (0.8 * math.sin(2 * t), 0.4 * math.cos(t) + 0.4),
lambda t : (0.8 * math.sin(2 * t), 0.4 * math.cos(t) - 0.4),
lambda t : (0.4 * math.cos(t) + 0.4, 0.8 * math.sin(2 * t)),
lambda t : (0.4 * math.cos(t) - 0.4, 0.8 * math.sin(2 * t)),
lambda t : (0.8 * math.cos(t), 0.4 * math.sin(2 * t) + 0.4),
lambda t : (0.8 * math.cos(t), 0.4 * math.sin(2 * t) - 0.4),
lambda t : (0.4 * math.sin(t) + 0.4, 0.8 * math.cos(t)),
lambda t : (0.4 * math.sin(t) - 0.4, 0.8 * math.cos(t)),
lambda t : (0.8 * math.sin(t), 0.4 * math.cos(t) - 0.4),
lambda t : (0.8 * math.sin(t), 0.4 * math.cos(t) + 0.4),
lambda t : (0.8 * math.sin(t), 0.8 * math.cos(2 * t)),
lambda t : (0.8 * math.sin(t), -0.8 * math.cos(2 * t)),
lambda t : (0.8 * math.cos(2 * t), 0.8 * math.sin(t)),
lambda t : (-0.8 * math.cos(2 * t), 0.8 * math.sin(t)),
lambda t : (0.3 * math.sin(t) + 0.5, 0.3 * math.cos(t) + 0.5),
lambda t : (0.3 * math.sin(t) + 0.5, 0.3 * math.cos(t) - 0.5),
lambda t : (0.3 * math.sin(t) - 0.5, 0.3 * math.cos(t) + 0.5),
lambda t : (0.3 * math.sin(t) - 0.5, 0.3 * math.cos(t) - 0.5)
]
def gen_sigma():
sigma = [0.01, 0.05]
n = 0
while True:
yield sigma[n % len(sigma)]
n += 1
gen = gen_sigma()
for f in funcs:
sigma = gen.next()
for n in xrange($num):
m = random.randint(0, 1000)
for t in [x * ((2 * math.pi) / $period) for x in xrange(m, $length+m)]:
print '\t'.join([str(x + random.gauss(0, sigma)) for x in f(t)])
print '\n'
EOS
if [ x`which rnn-learn` == x ]; then
path1=../../src/rnn-learn/
else
path1=
fi
${path1}rnn-learn -c config.txt target.txt