Commit cadf38c7 authored by Neil Gershenfeld's avatar Neil Gershenfeld

wip

parent 300b7f40
Pipeline #4357 passed with stage
in 1 second
......@@ -5,11 +5,9 @@
#
# usage:
# pcb.py | frep.py [dpi [filename]]
# with:
# https://gitlab.cba.mit.edu/pub/libraries/blob/master/python/pcb.py
#
# Neil Gershenfeld 10/8/18
# (c) Massachusetts Institute of Technology 2018
# Neil Gershenfeld 9/30/19
# (c) Massachusetts Institute of Technology 2019
#
# This work may be reproduced, modified, distributed,
# performed, and displayed for any purpose, but must
......@@ -35,10 +33,6 @@ frep = json.load(sys.stdin)
#
# check arguments
#
if (frep['zmin'] != frep['zmax']):
print('> 2D not (yet) supported')
sys.exit()
if (frep['type'] != 'RGB'):
print('types other than RGB not (yet) supported')
sys.exit()
......@@ -61,7 +55,7 @@ elif (len(sys.argv) == 3):
# evaluate
#
print('evaluating ...')
print('evaluating')
xmin = frep['xmin']
xmax = frep['xmax']
ymin = frep['ymin']
......@@ -72,8 +66,19 @@ x = arange(xmin,xmax,delta)
y = flip(arange(ymin,ymax,delta),0)
X = outer(ones(y.size),x)
Y = outer(y,ones(x.size))
Z = frep['zmin']
f = eval(frep['function'])
if (len(frep['layers']) == 1):
Z = frep['layers'][0]
print " z =",Z
f = eval(frep['function']).astype(uint32)
else:
f = zeros((y.size,x.size),dtype=uint32)
zmin = min(frep['layers'])
zmax = max(frep['layers'])
for Z in frep['layers']:
print " z =",Z
i = int(255*(Z-zmin)/(zmax-zmin)) | (255 << 8) | (255 << 16)
flayer = i & (eval(frep['function'])).astype(uint32)
f = f + flayer
#
# construct image
......
python/pcb.png

193 KB | W: | H:

python/pcb.png

23.7 KB | W: | H:

python/pcb.png
python/pcb.png
python/pcb.png
python/pcb.png
  • 2-up
  • Swipe
  • Onion skin
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment