Skip to content

Commit

Permalink
use assert instead of return
Browse files Browse the repository at this point in the history
  • Loading branch information
vladmandic authored Mar 11, 2023
1 parent 1226028 commit a47c182
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions scripts/xyz_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,10 +485,9 @@ def process_axis(opt, vals):
zs = process_axis(z_opt, z_values)

# this could be moved to common code, but unlikely to be ever triggered anywhere else
Image.MAX_IMAGE_PIXELS = opts.img_max_size_mp * 1000000 * 1.1 # allow 10% overhead for margins and legend
Image.MAX_IMAGE_PIXELS = opts.img_max_size_mp * 1.1 # allow 10% overhead for margins and legend
grid_mp = round(len(xs) * len(ys) * len(zs) * p.width * p.height / 1000000)
if grid_mp > opts.img_max_size_mp:
return Processed(p, [], p.seed, info=f'Error: Resulting grid would be too large ({grid_mp} MPixels) (max configured size is {opts.img_max_size_mp} MPixels)')
assert grid_mp < opts.img_max_size_mp, f'Error: Resulting grid would be too large ({grid_mp} MPixels) (max configured size is {opts.img_max_size_mp} MPixels)'

def fix_axis_seeds(axis_opt, axis_list):
if axis_opt.label in ['Seed', 'Var. seed']:
Expand Down

0 comments on commit a47c182

Please sign in to comment.