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 @@ ...@@ -5,11 +5,9 @@
# #
# usage: # usage:
# pcb.py | frep.py [dpi [filename]] # pcb.py | frep.py [dpi [filename]]
# with:
# https://gitlab.cba.mit.edu/pub/libraries/blob/master/python/pcb.py
# #
# Neil Gershenfeld 10/8/18 # Neil Gershenfeld 9/30/19
# (c) Massachusetts Institute of Technology 2018 # (c) Massachusetts Institute of Technology 2019
# #
# This work may be reproduced, modified, distributed, # This work may be reproduced, modified, distributed,
# performed, and displayed for any purpose, but must # performed, and displayed for any purpose, but must
...@@ -35,10 +33,6 @@ frep = json.load(sys.stdin) ...@@ -35,10 +33,6 @@ frep = json.load(sys.stdin)
# #
# check arguments # check arguments
# #
if (frep['zmin'] != frep['zmax']):
print('> 2D not (yet) supported')
sys.exit()
if (frep['type'] != 'RGB'): if (frep['type'] != 'RGB'):
print('types other than RGB not (yet) supported') print('types other than RGB not (yet) supported')
sys.exit() sys.exit()
...@@ -61,7 +55,7 @@ elif (len(sys.argv) == 3): ...@@ -61,7 +55,7 @@ elif (len(sys.argv) == 3):
# evaluate # evaluate
# #
print('evaluating ...') print('evaluating')
xmin = frep['xmin'] xmin = frep['xmin']
xmax = frep['xmax'] xmax = frep['xmax']
ymin = frep['ymin'] ymin = frep['ymin']
...@@ -72,8 +66,19 @@ x = arange(xmin,xmax,delta) ...@@ -72,8 +66,19 @@ x = arange(xmin,xmax,delta)
y = flip(arange(ymin,ymax,delta),0) y = flip(arange(ymin,ymax,delta),0)
X = outer(ones(y.size),x) X = outer(ones(y.size),x)
Y = outer(y,ones(x.size)) Y = outer(y,ones(x.size))
Z = frep['zmin'] if (len(frep['layers']) == 1):
f = eval(frep['function']) 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 # 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