diff --git a/Readme.md b/Readme.md index 8df6415..960f037 100644 --- a/Readme.md +++ b/Readme.md @@ -52,7 +52,8 @@ Servo Test Motor QBL 4208-41-04-006 ******* Path shaping test ***************** cd /home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/cfg -gpasciiCommander --host SAROP11-CPPM-MOT6871 -i +gpasciiCommander --host SAR-CPPM-EXPMX1 -i + !mx-stage() #1..3$ &1 @@ -83,7 +84,7 @@ Optimize/Test Parameters with Parker Stage ------------------------------------------ cd /home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/cfg -gpasciiCommander --host SAROP11-CPPM-MOT6871 -i +gpasciiCommander --host SAR-CPPM-EXPMX1 -i !mx-stage() #1..3$ &1 diff --git a/cfg/torqueCtrl.cfg b/cfg/torqueCtrl.cfg index 7d1b017..a7ae7ff 100644 --- a/cfg/torqueCtrl.cfg +++ b/cfg/torqueCtrl.cfg @@ -26,16 +26,6 @@ //Mot 3: Stage X Parker MX80L D11 25mm one pole cycle = 13mm = 2048 phase_step //Enc 3: Stage X Parker MX80L D11 inc_enc 20nm one pole cycle = 13mm = 650000 enc_step (20nm/enc_step) -//Mot 4: Test Servo: Trinamic QBL 4208 motor 8 poles 1 rev = 4*2048=8192 phase_step -//Enc 4: Test Servo: Incremental encoder mounted with motor 1 1 rev = 2000 enc count (500 inc_ quadrature encoder) -//Enc 5: Test Servo: Trinamic QBL 4208 hall sensor 1 rev = 24 enc count (hall sensor encoder) - -//Mot 6: Test Stepper: Vextra PK244M 200 poles 1 rev = 100*2048 phase_step (2 stepper motor) -//Enc 6: Test Stepper: inc_enc 1 rev = 1600 enc_step - -//Mot 7: Test Stepper: Vextra PK244M 200 poles 1 rev = 100*2048 phase_step (2 stepper motor) -//Enc 7: Test Stepper: ssi_enc multiturn 1 rev = 4096 enc_step - //rot stage //--------- //use 360'000 for 360 deg as motor unit @@ -68,7 +58,7 @@ Motor[1].pPhaseEnc=Acc84B[0].Chan[0].SerialEncDataA.a //Stage X Parker MX80L (top stage, mounted on Y stage) -//-------------------- +//---------------------------------------------------- //Motor[3].pPhaseEnc -> PowerBrick[0].Chan[1].PhaseCapt.a // 1 el_step = 13mm = 2048 phase_step = 166400000 PhaseCapt =256*650000 (256=scaling of encTable) // -> PhasePosSf=(2048*el_cycle)/(256*enc_step) = 8*el_cycle/enc_step =2048*1/(256*650000)=8*1/650000=1./81250=1.23077e-05 @@ -80,59 +70,8 @@ Motor[1].pPhaseEnc=Acc84B[0].Chan[0].SerialEncDataA.a //PhaseFreq=20000,PhasePerServo=1 -> Kvfb=220*4 Ki/=4,Kvff*=4,Kaff*=4*4 !motor(mot=3,dirCur=0,contCur=800,peakCur=2400,timeAtPeak=1,IiGain=1,IpfGain=0,IpbGain=2,JogSpeed=10.,numPhase=3,invDir=True,servo=None,PhasePosSf=1./81250,PhaseFindingDac=100,PhaseFindingTime=50,SlipGain=0,AdvGain=0,PwmSf=10000,FatalFeLimit=2000,WarnFeLimit=100,InPosBand=2) - -//Test Servo: Trinamic QBL 4208 motor -//----------------------------------- -//use 360 for 360 deg as motor unit -//Motor[4].pPhaseEnc -> PowerBrick[0].Chan[3].PhaseCapt.a -// 1 rev = 8192 phase_step = 512000 PhaseCapt =256*2000 (256=scaling of encTable, 2000=enc_step/rev) -// -> PhasePosSf=8192/512000 = 0.016 = (2048*el_cycle)/(256*enc_step) = 8*el_cycle/enc_step -!encoder_sim(enc=4,tbl=12,mot=12,posSf=360./8192) -!encoder_inc(enc=4,tbl=4,mot=4,posSf=360./2000) // incremental encoder -!encoder_inc(enc=5,tbl=13,mot=13,encctrl=15,posSf=360./24) //Hall sensor encoder -//!motor_servo(mot=4,ctrl='ServoCtrl',Kp=40,Kvfb=715.17053,Kvff=715.17053,Kaff=63279.855,Ki=5.9003407e-5,MaxInt=1500,MaxPosErr=1333.356) //tweaked parameters from IDE -!motor_servo(mot=4,ctrl='ServoCtrl',Kp=30.8,Kvfb=461.,Kvff=461,Kaff=3522,Ki=0.0e-5,MaxInt=1500,MaxPosErr=1333.356) //tweaked parameters from IDE -!motor(mot=4,dirCur=0,contCur=1790,peakCur=5400,timeAtPeak=.5,JogSpeed=8.,numPhase=3,servo=None,PhasePosSf=0.016,SlipGain=0,PhaseFindingTime=50.0,PhaseFindingDac=90.0) - -//Further tweaks to optimize positioning -//Motor[4].Servo.BreakPosErr=4 -//Motor[4].Servo.Kbreak=5 -//Motor[4].Servo.OutDbOn=.2 -//Motor[4].Servo.OutDbOff=.3 -//Motor[4].Servo.OutDbOn=0 -//Motor[4].Servo.OutDbOff=.3 - -//#4j:360 -> moves 1 rev - - -//Test Stepper: Vextra PK244M inc_enc -//----------------------------------- -//use 360 for 360 deg as motor unit -// Motor[6].pPhaseEnc -> PowerBrick[1].Chan[1].PhaseCapt.a - -//3.6deg=2048 phase_step -> 360 deg= 204800 phase_step -// 1 rev = 409600 = PhaseCapt =256*1600 (256=scaling of encTable, 1600=enc_step/rev) -// -> PhasePosSf=204800/409600 = 0.5 = (2048*el_cycle)/(256*enc_step) = 32*el_cycle/enc_step - -!encoder_sim(enc=6,tbl=14,mot=14,posSf=360./204800) -!encoder_inc(enc=6,tbl=6,mot=6,posSf=360./1600) -!motor_servo(mot=6,ctrl='ServoCtrl',Kp=40,Kvfb=715.17053,Kvff=715.17053,Kaff=63279.855,Ki=5.9003407e-5,MaxInt=1500,MaxPosErr=1333.356) -!motor(mot=6,dirCur=0,contCur=800,peakCur=1000,timeAtPeak=1,numPhase=2,invDir=False,servo=None,PhasePosSf=0.5,SlipGain=0,PhaseFindingTime=50.0,PhaseFindingDac=400.0) -Motor[6].JogSpeed=0.32 -Motor[6].FatalFeLimit=90 -//!!!!! THIS WORKS (but needs slow speed to never get out of sync! if it gets out of sync it runs in the wrong direction until following error) -//Motor[6].PhaseFindingTime=50.0;Motor[6].PhaseFindingDac=400.0 //Four Guess Phasing Search -//#6$ -//Motor[6].PhaseFindingTime=260.0;Motor[6].PhaseFindingDac=400.0 //stepper-motor phasing-search -//#6$ -//#6j:360 -> moves 1 rev -//the phasing is very critical with stepper motors - -//Test Stepper: Vextra PK244M abs_enc -//----------------------------------- -//use 360 for 360 deg as motor unit -> JogSpeed=2048./204800*360 -!encoder_sim(enc=7,tbl=7,mot=7,posSf=360./204800) -!encoder_ssi(enc=7,tbl=15,mot=15,numBits=25,posSf=360./4096) -!motor(mot=7,dirCur=100,contCur=400,peakCur=600,timeAtPeak=1,numPhase=2,invDir=False,servoSf=204800/360.,JogSpeed=3.6) -//#7j:360 -> moves 1 rev +//Interferometer 1 Stage Y Parker MX80L (bottom stage) +//---------------------------------------------------- +!encoder_inc(enc=4,tbl=4,mot=4)# ,posSf=13000./650000) +!encoder_inc(enc=5,tbl=5,mot=5)# ,posSf=13000./650000) diff --git a/logbook.md b/logbook.md index 1fb5bfe..347a709 100644 --- a/logbook.md +++ b/logbook.md @@ -592,10 +592,14 @@ Grid path at speed: -> - - - +Interferometer +-------------- +gpasciiCommander --host SAR-CPPM-EXPMX1 -i +$$$*** +!common() +!encoder_inc(enc=8,tbl=8,mot=8) +!encoder_inc(enc=1,tbl=1,mot=1) +!encoder_inc(enc=2,tbl=2,mot=2) diff --git a/python/drawing.svg b/python/drawing.svg new file mode 100644 index 0000000..48eaa35 --- /dev/null +++ b/python/drawing.svg @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/python/shapepath.py b/python/shapepath.py index 370a7de..22a208b 100755 --- a/python/shapepath.py +++ b/python/shapepath.py @@ -68,25 +68,26 @@ class ShapePath: else: fn='/tmp/shapepath' #fn='/home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/python/data/'+time.strftime('%y-%m-%d-%H_%M_%S') - #cfg={"points": [[100,523],[635,632],[756,213]],"sequencer":['sort_points()','gen_prog(file="'+fn+'.prg",host="SAROP11-CPPM-MOT6871")','plot_gather("'+fn+'.npz")']} - #cfg={"sequencer":['gen_rand_points(n=107, scale=1000)','sort_points()','gen_prog(file="'+fn+'.prg",host="SAROP11-CPPM-MOT6871")','plot_gather("'+fn+'.npz")']} - #cfg={"sequencer":['gen_grid_points(w=10,h=10,pitch=100,rnd=.2)','sort_points()','gen_prog(file="'+fn+'.prg",host="SAROP11-CPPM-MOT6871")','plot_gather("'+fn+'.npz")']} + #cfg={"points": [[100,523],[635,632],[756,213]],"sequencer":['sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1")','plot_gather("'+fn+'.npz")']} + #cfg={"sequencer":['gen_rand_points(n=107, scale=1000)','sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1")','plot_gather("'+fn+'.npz")']} + #cfg={"sequencer":['gen_grid_points(w=10,h=10,pitch=100,rnd=.2)','sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1")','plot_gather("'+fn+'.npz")']} #cfg={"sequencer":['gen_grid_points(w=10,h=10,pitch=100,rnd=0.2)','sort_points()','gen_prog(file="'+fn+'.prg")','plot_gather("'+fn+'.npz")']} #cfg = {"sequencer": ['gen_rand_points(n=107, scale=1000)', 'sort_points()','plot_gather("'+fn+'.npz")']} - #cfg={"sequencer":['gen_grid_points(w=20,h=20,pitch=50,rnd=.2)','sort_points()','gen_prog(file="'+fn+'.prg",host="SAROP11-CPPM-MOT6871")','plot_gather("'+fn+'.npz")']} + #cfg={"sequencer":['gen_grid_points(w=20,h=20,pitch=50,rnd=.2)','sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1")','plot_gather("'+fn+'.npz")']} #cfg={"sequencer":['gen_grid_points(w=20,h=20,pitch=50,rnd=.2)','sort_points()','gen_prog(file="'+fn+'.prg")','plot_gather("'+fn+'.npz")']} - #cfg={"sequencer":['gen_rand_points(n=400, scale=1000)','sort_points()','gen_prog(file="'+fn+'.prg",host="SAROP11-CPPM-MOT6871")','plot_gather("'+fn+'.npz")']} - #cfg = {"sequencer": ['gen_grid_points(w=20,h=20,pitch=50,rnd=.2)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAROP11-CPPM-MOT6871",mode=0)', 'plot_gather("'+fn+'.npz")']} - #cfg = {"sequencer": ['gen_grid_points(w=5,h=5,pitch=50,rnd=.2)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAROP11-CPPM-MOT6871",mode=1)', 'plot_gather("'+fn+'.npz")']} - #cfg = {"sequencer": ['gen_grid_points(w=2,h=2,pitch=100,rnd=0)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAROP11-CPPM-MOT6871",mode=0)', 'plot_gather("'+fn+'.npz")']} - #cfg = {"sequencer": ['gen_grid_points(w=5,h=5,pitch=100,rnd=0.2)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAROP11-CPPM-MOT6871",mode=0)', 'plot_gather("'+fn+'.npz")']} - #cfg = {"points": [[0, 0],[100, 0],[200, 0],[300, 0],[400, 0],[400, 100],[300, 100],[200, 100],[100, 100],[0, 100],[10, 200],[100, 200],[200, 200],[300, 200],[400, 200],[410, 300],[300, 300],[200, 300],[100, 300],[0, 300],[0, 400],[100, 400],[200, 400],[300, 400],[400, 400]],"sequencer": ['gen_prog(file="'+fn+'.prg",host="SAROP11-CPPM-MOT6871",mode=0)', 'plot_gather("'+fn+'.npz")']} - #cfg = {"sequencer": ['gen_grid_points(w=2,h=2,pitch=10000,rnd=0)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAROP11-CPPM-MOT6871",mode=-1)', 'plot_gather("'+fn+'.npz")']} - #cfg = {"sequencer": ['gen_grid_points(w=2,h=2,pitch=10000,rnd=0)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAROP11-CPPM-MOT6871",mode=1,pt2pt_time=1000)', 'plot_gather("'+fn+'.npz")']} - cfg = {"sequencer": ['gen_grid_points(w=20,h=20,pitch=50,rnd=0.2)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAROP11-CPPM-MOT6871",mode=1,pt2pt_time=10,acq_per=10)', 'plot_gather("'+fn+'.npz")']} - #cfg = {"sequencer": ['gen_rand_points(n=400, scale=1000)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAROP11-CPPM-MOT6871",mode=1,pt2pt_time=10)', 'plot_gather("'+fn+'.npz")']} - #cfg = {"sequencer": ['gen_grid_points(w=5,h=5,pitch=100,rnd=0.2)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAROP11-CPPM-MOT6871",mode=2,pt2pt_time=10)', 'plot_gather("'+fn+'.npz")']} - #cfg = {"sequencer":['gen_rand_points(n=400, scale=1000)','sort_points()','gen_prog(file="'+fn+'.prg",host="SAROP11-CPPM-MOT6871",mode=1,pt2pt_time=10,acq_per=1)','plot_gather("'+fn+'.npz")']} + #cfg={"sequencer":['gen_rand_points(n=400, scale=1000)','sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1")','plot_gather("'+fn+'.npz")']} + #cfg = {"sequencer": ['gen_grid_points(w=20,h=20,pitch=50,rnd=.2)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=0)', 'plot_gather("'+fn+'.npz")']} + #cfg = {"sequencer": ['gen_grid_points(w=5,h=5,pitch=50,rnd=.2)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=1)', 'plot_gather("'+fn+'.npz")']} + #cfg = {"sequencer": ['gen_grid_points(w=2,h=2,pitch=100,rnd=0)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=0)', 'plot_gather("'+fn+'.npz")']} + #cfg = {"sequencer": ['gen_grid_points(w=5,h=5,pitch=100,rnd=0.2)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=0)', 'plot_gather("'+fn+'.npz")']} + #cfg = {"points": [[0, 0],[100, 0],[200, 0],[300, 0],[400, 0],[400, 100],[300, 100],[200, 100],[100, 100],[0, 100],[10, 200],[100, 200],[200, 200],[300, 200],[400, 200],[410, 300],[300, 300],[200, 300],[100, 300],[0, 300],[0, 400],[100, 400],[200, 400],[300, 400],[400, 400]],"sequencer": ['gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=0)', 'plot_gather("'+fn+'.npz")']} + #cfg = {"sequencer": ['gen_grid_points(w=2,h=2,pitch=10000,rnd=0)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=-1)', 'plot_gather("'+fn+'.npz")']} + #cfg = {"sequencer": ['gen_grid_points(w=2,h=2,pitch=10000,rnd=0)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=1,pt2pt_time=1000)', 'plot_gather("'+fn+'.npz")']} + cfg = {"sequencer": ['gen_grid_points(w=20,h=20,pitch=50,rnd=0.2)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=1,pt2pt_time=10,acq_per=10)', 'plot_gather("'+fn+'.npz")']} + #cfg = {"sequencer": ['gen_rand_points(n=400, scale=1000)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=1,pt2pt_time=10)', 'plot_gather("'+fn+'.npz")']} + #cfg = {"sequencer": ['gen_grid_points(w=5,h=5,pitch=100,rnd=0.2)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=2,pt2pt_time=10)', 'plot_gather("'+fn+'.npz")']} + #cfg = {"sequencer":['gen_rand_points(n=400, scale=1000)','sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=1,pt2pt_time=10,acq_per=1)','plot_gather("'+fn+'.npz")']} + cfg = {"sequencer": ['gen_swissfel_points(scale=300)','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=1,pt2pt_time=100,acq_per=10)', 'plot_gather("'+fn+'.npz")']} self.cfg=dotdict(cfg) self.args=args @@ -109,6 +110,25 @@ class ShapePath: if not dryrun: eval('self.' + cmd) + def gen_swissfel_points(self,scale=10): + #string from inkscape path of the drawing + d="m 15.801613,951.54022 -1.655274,-0.17578 -1.809082,-0.52002 0,-1.52344 1.765137,0.76172 1.699219,0.25635 1.955566,-0.49805 0.688477,-1.4209 -0.498047,-1.25976 -1.618652,-0.68115 -0.900879,-0.17578 -1.426392,-0.42298 -0.968628,-0.60974 -0.739746,-1.95557 0.254516,-1.29638 0.76355,-0.98877 1.217652,-0.62622 1.602173,-0.20874 1.567383,0.13916 1.6333,0.41748 0,1.44287 -1.589355,-0.60059 -1.442871,-0.19775 -1.071167,0.11719 -0.796509,0.35156 -0.651856,1.33301 0.432129,1.09863 1.655274,0.59326 0.893555,0.18311 1.437377,0.43579 1.001587,0.67749 0.593262,0.92651 0.197754,1.19751 -0.267334,1.3971 -0.802002,1.01257 -1.311035,0.61523 2.995605,-0.004 2.995606,-0.004 -0.536499,-2.05078 -0.536499,-2.05078 -0.536499,-2.05079 -0.536499,-2.05078 1.347656,0 0.421142,1.60034 0.421143,1.60034 0.421143,1.60035 0.421142,1.60034 0.419312,-1.60034 0.419311,-1.60035 0.419312,-1.60034 0.419311,-1.60034 1.589356,0 0.421142,1.60034 0.421143,1.60034 0.421143,1.60035 0.421142,1.60034 0.419312,-1.60034 0.419311,-1.60035 0.419312,-1.60034 0.419311,-1.60034 1.347657,0 -0.536499,2.05078 -0.5365,2.05079 -0.536499,2.05078 -0.536499,2.05078 -1.589355,0 -0.441284,-1.68091 -0.441285,-1.68091 -0.441284,-1.6809 -0.441284,-1.68091 -0.443115,1.68091 -0.443116,1.6809 -0.443115,1.68091 -0.443115,1.68091 2.330933,-8e-5 2.330933,-8e-5 2.330932,-8e-5 2.330933,-8e-5 0,-2.05078 0,-2.05078 0,-2.05079 0,-2.05078 0.673828,-1.48681 0.673828,0 0,-0.85327 0,-0.85327 -0.673828,0 -0.673828,0 0,0.85327 0,0.85327 0.673828,1.48681 0.673828,0 0,2.05078 0,2.05079 0,2.05078 0,2.05078 2.545166,0.1062 2.545166,0.1062 -1.376953,-0.13183 -1.501465,-0.38086 0,-1.3916 1.472168,0.58593 1.435547,0.19043 1.464844,-0.32226 0.512695,-0.92285 -0.373535,-0.84229 -1.038789,-0.41935 -1.048614,-0.25448 -1.078491,-0.33325 -0.730591,-0.47241 -0.55664,-1.50147 0.205078,-1.02539 0.615234,-0.76172 0.99243,-0.47241 1.336672,-0.15747 1.40625,0.10986 1.21582,0.32959 0,1.27442 -1.186523,-0.43946 -1.274414,-0.14648 -1.508789,0.30762 -0.498047,0.92285 0.358886,0.73975 0.763094,0.30189 0.76857,0.22893 0.785513,0.20842 0.813927,0.24037 0.809326,0.49988 0.455932,0.66833 0.151978,0.89173 -0.227051,1.02355 -0.681152,0.78553 -1.071167,0.49988 3.205262,0.0833 3.205261,0.0833 -1.376953,-0.13183 -1.501465,-0.38086 0,-1.3916 1.472168,0.58593 1.435547,0.19043 1.464843,-0.32226 0.512696,-0.92285 -0.373536,-0.84229 -1.038789,-0.41935 -1.048613,-0.25448 -1.078491,-0.33325 -0.730591,-0.47241 -0.556641,-1.50147 0.205078,-1.02539 0.615235,-0.76172 0.99243,-0.47241 1.336672,-0.15747 1.40625,0.10986 1.21582,0.32959 0,1.27442 -1.186524,-0.43946 -1.274414,-0.14648 -1.508789,0.30762 -0.498047,0.92285 0.358887,0.73975 0.805073,0.3095 0.76935,0.22988 0.764915,0.20509 0.791765,0.23514 0.809327,0.49988 0.455932,0.66833 0.151978,0.89173 -0.227051,1.02355 -0.681152,0.78553 -1.071167,0.49988 2.095642,-0.0229 2.095642,-0.0229 0,-1.36688 0,-1.36688 0,-1.36689 0,-1.36688 0,-1.36688 0,-1.36688 0,-1.36689 0,-1.36688 1.571045,0 1.571045,0 1.571045,0 1.571045,0 0,1.24512 -1.201172,0 -1.201172,0 -1.201172,0 -1.201172,0 0,0.80566 0,0.80567 0,0.80566 0,0.80566 1.083984,0 1.083985,0 1.083984,0 1.083985,0 0,1.24512 -1.083985,0 -1.083984,0 -1.083985,0 -1.083984,0 0,1.30554 0,1.30555 0,1.30554 0,1.30554 3.581543,0 3.581543,0 0,-1.36688 0,-1.36688 0,-1.36689 0,-1.36688 0,-1.36688 0,-1.36688 0,-1.36689 0,-1.36688 1.728516,0 1.728516,0 1.728515,0 1.728516,0 0,1.24512 -1.358643,0 -1.358642,0 -1.358643,0 -1.358643,0 0,0.80932 0,0.80933 0,0.80933 0,0.80932 1.30188,0 1.30188,0 1.30188,0 1.30188,0 0,1.24512 -1.30188,0 -1.30188,0 -1.30188,0 -1.30188,0 0,0.9906 0,0.9906 0,0.9906 0,0.9906 1.391602,0 1.391601,0 1.391602,0 1.391602,0 0,1.24512 -3.587581,3.8e-4 -1.964972,0 3.702844,0 4.295998,0 0,-1.36733 0,-1.36688 0,-1.36689 0,-1.36688 0,-1.36688 0,-1.36689 0,-1.36688 0,-1.36688 1.479492,0 0,1.21124 0,1.21124 0,1.21125 0,1.21124 0,1.21124 0,1.21124 0,1.21125 0,1.21124 1.331177,0 1.331177,0 1.331176,0 1.331177,0 0,1.24512 -1.70105,0 -1.701049,0 -1.70105,0" + d=d.split() + pts=np.ndarray((len(d)-1,2),dtype=np.float) + for i in xrange(pts.shape[0]): + pts[i,:]=map(float,d[i+1].split(',')) + + pts[0,:]=(5,0) + pts=pts.cumsum(0) + pts[:,1]=-pts[:,1] + pts*=scale + self.points=pts + + verb=self.args.verbose + if verb&2: + self.plot_points(pts) + plt.show() + def gen_rand_points(self,n=107,scale=1000): np.random.seed(0) #data=np.random.randint(0,1000,(30,2)) @@ -298,6 +318,7 @@ class ShapePath: hl=ax.plot(pts[:,0],pts[:,1],'y--') cid = fig.canvas.mpl_connect('button_press_event', self.onclick) fig.obj=self + plt.axis('equal') self.ax=ax self.hl=hl