mirror of
https://github.com/stevenrobertson/cuburn.git
synced 2025-02-05 11:40:04 -05:00
Updates to run_job.py
This commit is contained in:
parent
5368a9254a
commit
3c1dac530b
@ -213,6 +213,7 @@ class Renderer(object):
|
|||||||
grid=(cps_per_block, 1),
|
grid=(cps_per_block, 1),
|
||||||
texrefs=[tref], stream=iter_stream)
|
texrefs=[tref], stream=iter_stream)
|
||||||
|
|
||||||
|
iter_stream.synchronize()
|
||||||
if filter_done_event:
|
if filter_done_event:
|
||||||
while not filt_stream.is_done():
|
while not filt_stream.is_done():
|
||||||
timemod.sleep(0.01)
|
timemod.sleep(0.01)
|
||||||
|
21
run_job.py
21
run_job.py
@ -27,26 +27,29 @@ np.set_printoptions(precision=5, edgeitems=20)
|
|||||||
|
|
||||||
real_stdout = sys.stdout
|
real_stdout = sys.stdout
|
||||||
|
|
||||||
def save(time, raw):
|
def save(time, raw, pfx):
|
||||||
noalpha = raw[:,:,:3]
|
noalpha = raw[:,:,:3]
|
||||||
name = 'out/%05d' % time
|
name = pfx + '%05d' % time
|
||||||
img = scipy.misc.toimage(noalpha, cmin=0, cmax=1)
|
img = scipy.misc.toimage(noalpha, cmin=0, cmax=1)
|
||||||
img.save(name+'.png')
|
img.save(name+'.png')
|
||||||
|
print name
|
||||||
|
|
||||||
def main(jobfilepath):
|
def main(jobfilepath, outprefix):
|
||||||
contents = '\n'.join([l.split('//', 1)[0] for l in open(jobfilepath)])
|
|
||||||
# This includes the genomes and other cruft, a dedicated reader will be
|
# This includes the genomes and other cruft, a dedicated reader will be
|
||||||
# built in time tho
|
# 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 = cuburn.render.Renderer(info)
|
||||||
renderer.compile()
|
renderer.compile()
|
||||||
renderer.load()
|
renderer.load()
|
||||||
|
|
||||||
for idx, (ftime, out) in enumerate(renderer.render(zip(times, times[1:]))):
|
for idx, (ftime, out) in enumerate(renderer.render(rtimes)):
|
||||||
save(idx, out)
|
save(idx, out, outprefix)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main('04653_2.jsonc')
|
main(sys.argv[1], sys.argv[2] if len(sys.argv) > 2 else 'out/')
|
||||||
|
Loading…
Reference in New Issue
Block a user