More correct sequence options

This commit is contained in:
Steven Robertson 2011-10-16 13:51:39 -04:00
parent 0fc80889c9
commit 966d794881

23
main.py
View File

@ -118,21 +118,28 @@ def main(args):
elif np.any(np.diff(cp_times) <= 0): elif np.any(np.diff(cp_times) <= 0):
error("Genome times are non-monotonic. Try using --renumber.") error("Genome times are non-monotonic. Try using --renumber.")
if args.skip: if len(cp_times) > 2:
if args.start is None: if args.start is None:
args.start = cp_times[0] # [1], not [0]; want to be inclusive on --start but exclude
# the first genome when --start is not passed
args.start = cp_times[1]
if args.end is None: if args.end is None:
args.end = cp_times[-1] args.end = cp_times[-1]
times = np.arange(args.start, args.end, args.skip) if args.skip:
times = np.arange(args.start, args.end, args.skip)
else:
times = [t for t in cp_times if args.start <= t < args.end]
else: else:
times = [t for t in cp_times times = cp_times
if (args.start is None or t >= args.start)
and (args.end is None or t < args.end)]
if args.resume: if args.resume:
times = [t for t in times times = [t for t in times
if not os.path.isfile(fmt_filename(args, t)+'.png')] if not os.path.isfile(fmt_filename(args, t)+'.png')]
if times == []:
print 'No genomes to be rendered.'
return
anim = render.Animation(genomes) anim = render.Animation(genomes)
if args.debug: if args.debug:
anim.cmp_options.append('-G') anim.cmp_options.append('-G')
@ -220,7 +227,9 @@ if __name__ == "__main__":
a list of times to render is given according to the semantics of a list of times to render is given according to the semantics of
Python's range operator, as in range(start, end, skip). Python's range operator, as in range(start, end, skip).
If no options are given, all control points are rendered.""") If no options are given, all control points except the first and last
are rendered. If only one or two control points are passed, everything
gets rendered.""")
seq.add_argument('-s', dest='start', metavar='TIME', type=float, seq.add_argument('-s', dest='start', metavar='TIME', type=float,
help="Start time of image sequence (inclusive)") help="Start time of image sequence (inclusive)")
seq.add_argument('-e', dest='end', metavar='TIME', type=float, seq.add_argument('-e', dest='end', metavar='TIME', type=float,