Updates to run_job.py

This commit is contained in:
Steven Robertson 2011-10-27 10:26:30 -04:00
parent 5368a9254a
commit 3c1dac530b
2 changed files with 13 additions and 9 deletions

View File

@ -213,6 +213,7 @@ class Renderer(object):
grid=(cps_per_block, 1),
texrefs=[tref], stream=iter_stream)
iter_stream.synchronize()
if filter_done_event:
while not filt_stream.is_done():
timemod.sleep(0.01)

View File

@ -27,26 +27,29 @@ np.set_printoptions(precision=5, edgeitems=20)
real_stdout = sys.stdout
def save(time, raw):
def save(time, raw, pfx):
noalpha = raw[:,:,:3]
name = 'out/%05d' % time
name = pfx + '%05d' % time
img = scipy.misc.toimage(noalpha, cmin=0, cmax=1)
img.save(name+'.png')
print name
def main(jobfilepath):
contents = '\n'.join([l.split('//', 1)[0] for l in open(jobfilepath)])
def main(jobfilepath, outprefix):
# This includes the genomes and other cruft, a dedicated reader will be
# built in time tho
info = cuburn.genome.load_info(contents)
info = cuburn.genome.load_info(open(jobfilepath).read())
times = np.linspace(0, 1, info.duration * info.fps + 1)[:3]
times = np.linspace(0, 1, info.duration * info.fps + 1)
# One still, one motion-blurred for testing
rtimes = [(times[0], times[0]), (times[1], times[2])]
renderer = cuburn.render.Renderer(info)
renderer.compile()
renderer.load()
for idx, (ftime, out) in enumerate(renderer.render(zip(times, times[1:]))):
save(idx, out)
for idx, (ftime, out) in enumerate(renderer.render(rtimes)):
save(idx, out, outprefix)
if __name__ == "__main__":
main('04653_2.jsonc')
main(sys.argv[1], sys.argv[2] if len(sys.argv) > 2 else 'out/')