This commit is contained in:
2024-11-25 09:58:55 +01:00
parent ae7882651e
commit 527fcec7f5
3 changed files with 307 additions and 241 deletions

View File

@@ -19,6 +19,51 @@
sodipodi:docname="hit_return.svg"> sodipodi:docname="hit_return.svg">
<defs <defs
id="defs2"> id="defs2">
<marker
inkscape:stockid="DotM"
orient="auto"
refY="0"
refX="0"
id="marker16918"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path16916"
d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z"
style="fill:#0000f0;fill-opacity:1;fill-rule:evenodd;stroke:#0000f0;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(0.4,0,0,0.4,2.96,0.4)" />
</marker>
<marker
inkscape:stockid="DotM"
orient="auto"
refY="0"
refX="0"
id="marker16553"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path16551"
d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z"
style="fill:#0000f0;fill-opacity:1;fill-rule:evenodd;stroke:#0000f0;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(0.4,0,0,0.4,2.96,0.4)" />
</marker>
<marker
inkscape:stockid="DotM"
orient="auto"
refY="0"
refX="0"
id="marker16188"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path16186"
d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z"
style="fill:#0000f0;fill-opacity:1;fill-rule:evenodd;stroke:#0000f0;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(0.4,0,0,0.4,2.96,0.4)" />
</marker>
<marker <marker
inkscape:stockid="DotM" inkscape:stockid="DotM"
orient="auto" orient="auto"
@@ -335,36 +380,6 @@
transform="scale(0.6)" transform="scale(0.6)"
inkscape:connector-curvature="0" /> inkscape:connector-curvature="0" />
</marker> </marker>
<marker
inkscape:stockid="DotM"
orient="auto"
refY="0"
refX="0"
id="marker26094-3"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path26092-6"
d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z"
style="fill:#0000f0;fill-opacity:1;fill-rule:evenodd;stroke:#0000f0;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(0.4,0,0,0.4,2.96,0.4)" />
</marker>
<marker
inkscape:stockid="DotM"
orient="auto"
refY="0"
refX="0"
id="marker24477-7"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path24475-5"
d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z"
style="fill:#0000f0;fill-opacity:1;fill-rule:evenodd;stroke:#0000f0;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(0.4,0,0,0.4,2.96,0.4)" />
</marker>
<marker <marker
inkscape:stockid="DotM" inkscape:stockid="DotM"
orient="auto" orient="auto"
@@ -2638,9 +2653,9 @@
borderopacity="1.0" borderopacity="1.0"
inkscape:pageopacity="0.0" inkscape:pageopacity="0.0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:zoom="1.2825602" inkscape:zoom="0.89115389"
inkscape:cx="793.35599" inkscape:cx="764.09414"
inkscape:cy="514.79606" inkscape:cy="555.17256"
inkscape:document-units="px" inkscape:document-units="px"
inkscape:current-layer="g4477" inkscape:current-layer="g4477"
showgrid="true" showgrid="true"
@@ -2874,32 +2889,12 @@
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccccc" /> sodipodi:nodetypes="cccccccccc" />
<path <path
style="fill:none;stroke:#0000f0;stroke-width:0.13229166;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#marker26094-3);marker-mid:url(#marker24477-7);marker-end:url(#marker26094-3)" style="fill:none;stroke:#0000f0;stroke-width:0.13229166;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#marker16188);marker-mid:url(#marker16553);marker-end:url(#marker16918)"
d="m 16.447285,200.23657 v 15.875 h 2.645834 V 202.8824 h 2.645833 v 13.22917 h 2.645833 v -15.875 h -5.291666" d="m 16.447285,200.23657 v 15.875 h 2.645834 V 202.8824 h 2.645833 v 13.22917 h 2.645833 v -15.875 h -5.291666"
id="path140022" id="path140022"
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccc" /> sodipodi:nodetypes="ccccccccc" />
</g> </g>
<use
x="0"
y="0"
xlink:href="#use140004"
id="use140006"
width="100%"
height="100%"
transform="translate(199.99999,349.99998)"
inkscape:export-xdpi="600"
inkscape:export-ydpi="600" />
<use
x="0"
y="0"
xlink:href="#use140006"
id="use140008"
width="100%"
height="100%"
transform="translate(-199.99999,-4.5884843e-6)"
inkscape:export-xdpi="600"
inkscape:export-ydpi="600" />
<use <use
x="0" x="0"
y="0" y="0"
@@ -2920,16 +2915,6 @@
transform="translate(-200,-4.5884843e-6)" transform="translate(-200,-4.5884843e-6)"
inkscape:export-xdpi="600" inkscape:export-xdpi="600"
inkscape:export-ydpi="600" /> inkscape:export-ydpi="600" />
<use
x="0"
y="0"
xlink:href="#use140004"
id="use155046"
width="100%"
height="100%"
transform="translate(400,349.99998)"
inkscape:export-xdpi="600"
inkscape:export-ydpi="600" />
<path <path
style="fill:none;stroke:#00c800;stroke-width:4.99999952px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" style="fill:none;stroke:#00c800;stroke-width:4.99999952px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
d="m 188.0827,-347.70107 c 50.00001,-39.99988 100,-34.99994 140,-9.99988" d="m 188.0827,-347.70107 c 50.00001,-39.99988 100,-34.99994 140,-9.99988"
@@ -2938,13 +2923,6 @@
sodipodi:nodetypes="cc" sodipodi:nodetypes="cc"
inkscape:export-xdpi="600" inkscape:export-xdpi="600"
inkscape:export-ydpi="600" /> inkscape:export-ydpi="600" />
<path
style="fill:none;stroke:#00c800;stroke-width:4.99999952px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
d="M 588.08269,-347.70107 128.0827,-7.7008472"
id="path193463"
inkscape:connector-curvature="0"
inkscape:export-xdpi="600"
inkscape:export-ydpi="600" />
<text <text
xml:space="preserve" xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:39.99999619px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:4.99999952" style="font-style:normal;font-weight:normal;font-size:39.99999619px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:4.99999952"
@@ -3078,15 +3056,15 @@
<text <text
xml:space="preserve" xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:39.99999619px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:4.99999952" style="font-style:normal;font-weight:normal;font-size:39.99999619px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:4.99999952"
x="349.98798" x="649.59955"
y="-186.48172" y="-143.84038"
id="text193546" id="text193546"
inkscape:export-xdpi="600" inkscape:export-xdpi="600"
inkscape:export-ydpi="600"><tspan inkscape:export-ydpi="600"><tspan
sodipodi:role="line" sodipodi:role="line"
id="tspan193544" id="tspan193544"
x="349.98798" x="649.59955"
y="-186.48172" y="-143.84038"
style="font-size:26.66666412px;fill:#008c00;fill-opacity:1;stroke-width:4.99999952">8</tspan></text> style="font-size:26.66666412px;fill:#008c00;fill-opacity:1;stroke-width:4.99999952">8</tspan></text>
<g <g
style="display:inline" style="display:inline"
@@ -3283,28 +3261,6 @@
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" /> sodipodi:nodetypes="cccc" />
</g> </g>
<use
x="0"
y="0"
xlink:href="#use140004-3"
id="use140006-0"
width="100%"
height="100%"
transform="translate(100.593,350.00005)"
inkscape:export-xdpi="600"
inkscape:export-ydpi="600"
style="display:inline;fill:#6e2265;fill-opacity:0.15174267" />
<use
style="display:inline"
x="0"
y="0"
xlink:href="#use140006-0"
id="use140008-4"
width="100%"
height="100%"
transform="translate(-100.59303,-6.6428745e-5)"
inkscape:export-xdpi="600"
inkscape:export-ydpi="600" />
<use <use
style="display:inline" style="display:inline"
x="0" x="0"
@@ -3327,25 +3283,6 @@
transform="translate(-99.999992,-6.4287452e-6)" transform="translate(-99.999992,-6.4287452e-6)"
inkscape:export-xdpi="600" inkscape:export-xdpi="600"
inkscape:export-ydpi="600" /> inkscape:export-ydpi="600" />
<use
style="display:inline"
x="0"
y="0"
xlink:href="#use140004-3"
id="use155046-8"
width="100%"
height="100%"
transform="translate(400,349.99995)"
inkscape:export-xdpi="600"
inkscape:export-ydpi="600" />
<path
style="display:inline;fill:none;stroke:#00c800;stroke-width:4.99999952px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
d="M 1538.6757,-347.70095 978.0827,-7.7008272"
id="path193463-9"
inkscape:connector-curvature="0"
inkscape:export-xdpi="600"
inkscape:export-ydpi="600"
sodipodi:nodetypes="cc" />
<text <text
xml:space="preserve" xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:39.99999619px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:4.99999952" style="font-style:normal;font-weight:normal;font-size:39.99999619px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:4.99999952"
@@ -3435,15 +3372,15 @@
<text <text
xml:space="preserve" xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:39.99999619px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:4.99999952" style="font-style:normal;font-weight:normal;font-size:39.99999619px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:4.99999952"
x="1249.9879" x="1546.233"
y="-186.4817" y="-101.19901"
id="text193546-4" id="text193546-4"
inkscape:export-xdpi="600" inkscape:export-xdpi="600"
inkscape:export-ydpi="600"><tspan inkscape:export-ydpi="600"><tspan
sodipodi:role="line" sodipodi:role="line"
id="tspan193544-6" id="tspan193544-6"
x="1249.9879" x="1546.233"
y="-186.4817" y="-101.19901"
style="font-size:26.66666412px;fill:#008c00;fill-opacity:1;stroke-width:4.99999952">8</tspan></text> style="font-size:26.66666412px;fill:#008c00;fill-opacity:1;stroke-width:4.99999952">8</tspan></text>
<use <use
style="display:inline" style="display:inline"
@@ -3472,33 +3409,6 @@
width="100%" width="100%"
height="100%" height="100%"
transform="translate(99.999998,-6.4287452e-6)" /> transform="translate(99.999998,-6.4287452e-6)" />
<use
style="display:inline"
x="0"
y="0"
xlink:href="#use140006-0"
id="use280309"
width="100%"
height="100%"
transform="translate(99.999998,-6.4287452e-6)" />
<use
style="display:inline"
x="0"
y="0"
xlink:href="#use280309"
id="use280311"
width="100%"
height="100%"
transform="translate(99.999998,-6.4287452e-6)" />
<use
style="display:inline"
x="0"
y="0"
xlink:href="#use155046-8"
id="use280313"
width="100%"
height="100%"
transform="translate(100.593,7.3571255e-5)" />
<use <use
x="0" x="0"
y="0" y="0"
@@ -3507,22 +3417,56 @@
width="100%" width="100%"
height="100%" height="100%"
transform="translate(200,1.11e-4)" /> transform="translate(200,1.11e-4)" />
<g
id="g16931"
transform="matrix(-1,0,0,1,816.16538,0)">
<use <use
x="0" inkscape:export-ydpi="600"
inkscape:export-xdpi="600"
transform="translate(199.99999,349.99998)"
height="100%"
width="100%"
id="use140006"
xlink:href="#use140004"
y="0" y="0"
xlink:href="#use283629" x="0" />
<use
inkscape:export-ydpi="600"
inkscape:export-xdpi="600"
transform="translate(-199.99999,-4.5884843e-6)"
height="100%"
width="100%"
id="use140008"
xlink:href="#use140006"
y="0"
x="0" />
<use
inkscape:export-ydpi="600"
inkscape:export-xdpi="600"
transform="translate(400,349.99998)"
height="100%"
width="100%"
id="use155046"
xlink:href="#use140004"
y="0"
x="0" />
<use
transform="translate(-200,350)"
height="100%"
width="100%"
id="use283631" id="use283631"
width="100%" xlink:href="#use283629"
height="100%"
transform="translate(-200,350)" />
<use
x="0"
y="0" y="0"
xlink:href="#use283631" x="0" />
id="use283633" <use
width="100%" transform="translate(200)"
height="100%" height="100%"
transform="translate(200)" /> width="100%"
id="use283633"
xlink:href="#use283631"
y="0"
x="0" />
</g>
<use <use
x="0" x="0"
y="0" y="0"
@@ -3555,46 +3499,126 @@
width="100%" width="100%"
height="100%" height="100%"
transform="translate(100)" /> transform="translate(100)" />
<g
id="g18003"
transform="matrix(-1,0,0,1,2516.7582,0)">
<use <use
x="0" style="display:inline;fill:#6e2265;fill-opacity:0.15174267"
inkscape:export-ydpi="600"
inkscape:export-xdpi="600"
transform="translate(100.593,350.00005)"
height="100%"
width="100%"
id="use140006-0"
xlink:href="#use140004-3"
y="0" y="0"
xlink:href="#use283688" x="0" />
<use
inkscape:export-ydpi="600"
inkscape:export-xdpi="600"
transform="translate(-100.59303,-6.6428745e-5)"
height="100%"
width="100%"
id="use140008-4"
xlink:href="#use140006-0"
y="0"
x="0"
style="display:inline" />
<use
inkscape:export-ydpi="600"
inkscape:export-xdpi="600"
transform="translate(400,349.99995)"
height="100%"
width="100%"
id="use155046-8"
xlink:href="#use140004-3"
y="0"
x="0"
style="display:inline" />
<use
transform="translate(99.999998,-6.4287452e-6)"
height="100%"
width="100%"
id="use280309"
xlink:href="#use140006-0"
y="0"
x="0"
style="display:inline" />
<use
transform="translate(99.999998,-6.4287452e-6)"
height="100%"
width="100%"
id="use280311"
xlink:href="#use280309"
y="0"
x="0"
style="display:inline" />
<use
transform="translate(100.593,7.3571255e-5)"
height="100%"
width="100%"
id="use280313"
xlink:href="#use155046-8"
y="0"
x="0"
style="display:inline" />
<use
transform="translate(-400,350)"
height="100%"
width="100%"
id="use283690" id="use283690"
width="100%" xlink:href="#use283688"
height="100%"
transform="translate(-400,350)" />
<use
x="0"
y="0" y="0"
xlink:href="#use283690" x="0" />
<use
transform="translate(100)"
height="100%"
width="100%"
id="use283692" id="use283692"
width="100%" xlink:href="#use283690"
height="100%"
transform="translate(100)" />
<use
x="0"
y="0" y="0"
xlink:href="#use283692" x="0" />
<use
transform="translate(100)"
height="100%"
width="100%"
id="use283694" id="use283694"
width="100%" xlink:href="#use283692"
height="100%"
transform="translate(100)" />
<use
x="0"
y="0" y="0"
xlink:href="#use283694" x="0" />
<use
transform="translate(100)"
height="100%"
width="100%"
id="use283696" id="use283696"
width="100%" xlink:href="#use283694"
height="100%"
transform="translate(100)" />
<use
x="0"
y="0" y="0"
xlink:href="#use283696" x="0" />
id="use283698" <use
width="100%" transform="translate(100)"
height="100%" height="100%"
transform="translate(100)" /> width="100%"
id="use283698"
xlink:href="#use283696"
y="0"
x="0" />
</g>
<path
style="fill:none;stroke:#00c800;stroke-width:4.99999952px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
d="M 588.08269,-347.70107 688.0827,-7.700959"
id="path193463"
inkscape:connector-curvature="0"
inkscape:export-xdpi="600"
inkscape:export-ydpi="600"
sodipodi:nodetypes="cc" />
<path
style="display:inline;fill:none;stroke:#00c800;stroke-width:4.99999952px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
d="m 1538.6757,-347.70095 c 50.9795,292.297233 25.7644,318.145847 -0.593,339.999991"
id="path193463-9"
inkscape:connector-curvature="0"
inkscape:export-xdpi="600"
inkscape:export-ydpi="600"
sodipodi:nodetypes="cc" />
</g> </g>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 133 KiB

After

Width:  |  Height:  |  Size: 134 KiB

View File

@@ -30,16 +30,23 @@ class HitReturnEval:
h3=ax.plot(pts[:,0],pts[:,1],'g-') h3=ax.plot(pts[:,0],pts[:,1],'g-')
h2=ax.plot(pts[:,0],pts[:,1],'y-') h2=ax.plot(pts[:,0],pts[:,1],'y-')
h1=ax.plot(pts[:,0],pts[:,1],'r.') h1=ax.plot(pts[:,0],pts[:,1],'r.')
ha=ax.arrow(4, 2, 0.5, 0.5, head_width=0.05, head_length=0.1, fc='k', ec='k')
#cid = fig.canvas.mpl_connect('button_press_event', self.onclick) #cid = fig.canvas.mpl_connect('button_press_event', self.onclick)
#fig.obj=self #fig.obj=self
plt.axis('equal') plt.axis('equal')
plt.ion() plt.ion()
fig.show() fig.show()
self._plt=(fig,ax,h1[0],h2[0]) self._plt=[fig,ax,h1[0],h2[0],ha]
def updatePlt(self,pts): def updatePlt(self,pts,vx,vy):
fig, ax, h1, h2=self._plt fig,ax,h1,h2,ha=self._plt
x,y=pts[-1][:2]
pts=np.array(pts) pts=np.array(pts)
ha.remove()
l=(vx**2+vy**2)**.5
ha=ax.arrow(x,y,.7*vx,.7*vy, head_width=.2, head_length=0.3*l, fc='k', ec='k',zorder=5)
self._plt[-1]=ha
h1.set_xdata((pts[:,0])) h1.set_xdata((pts[:,0]))
h1.set_ydata((pts[:,1])) h1.set_ydata((pts[:,1]))
h2.set_xdata((pts[:,0])) h2.set_xdata((pts[:,0]))
@@ -58,6 +65,8 @@ class HitReturnEval:
px,py=g['pitch'] #pitch to next position in um (or 1 if scaled) px,py=g['pitch'] #pitch to next position in um (or 1 if scaled)
nx,ny=g['count'] #total count of wells nx,ny=g['count'] #total count of wells
sx,sy=kwargs['ssz'] #section size (in wells) sx,sy=kwargs['ssz'] #section size (in wells)
tx,ty=nx//sx,ny//sy #total sections
#smv=kwargs['smv'] #time(in num of shots) to move to next section (horiz/vert) #smv=kwargs['smv'] #time(in num of shots) to move to next section (horiz/vert)
#swait=kwargs['smv'] #wait after <swait> section for motion trigger. swait=0:never wait #swait=kwargs['smv'] #wait after <swait> section for motion trigger. swait=0:never wait
@@ -72,45 +81,78 @@ class HitReturnEval:
# | | | | | | | | | | | | # | | | | | | | | | | | |
# 1-2 1-2 1-2 1-2 1-2 1-2 # 1-2 1-2 1-2 1-2 1-2 1-2
r=0 #row k=-1 # key position
x0,y0,n=0,-1,0 # counter well in region cx,cy=0,0 # section counter
x0,y0,n=0,0,0 # counter well in region
dx,dy=0,1 # motion pitch dx,dy=0,1 # motion pitch
x1,y1=0,0 #counter region start vsx=vsy=1 # scaled velocity
vx,vy=0,vsy # scaled velocity
mv=list() mv=list()
while(True): while(True):
if cy%2==0: # even rows
x=sx*cx+x0;y=sy*cy+y0
else: # odd rows
x=(tx-cx)*sx-x0-1;y=sy*cy+y0
vx=-vx
x0+=dx;y0+=dy x0+=dx;y0+=dy
print(f'{x0+x1} {y0+y1} ({dx}|{dy}|{n})') print(f'X{x}:{vx} Y{y}:{vy} ({k}|{dx}|{dy}|{n})')
mv.append((x0+x1+.1*n,y0+y1+.1*n,n)) mv.append((x+.1*n,y+.1*n,n))
self.updatePlt(mv) self.updatePlt(mv,vx,vy)
if k>=0: #if keypoint not directly followed by an other keypoint, define future velocity
if k in (0,4):
vx,vy=0,vsy
elif k==2:
vx,vy=0,-vsy
elif k==5:
vx,vy=-vsx,0
elif k==6:
n+=1
elif k==7:
print('next h section')
cx+=1
x0,y0,n,dx,dy=0,0,0,0,0
elif k==8:
print('next v section')
cx=0;cy+=1
x0,y0,n,dx,dy=0,0,0,0,0
if cy>=ty:
print('finished whole grid')
break #
else:
raise ValueError('should never happened')
print(f'vx|vy after keypoint {k}: ({vx}|{vy})')
k=-1
if y0==sy-1: if y0==sy-1:
if dy==1: #(1) if dy==1: #(1)
dx,dy=1,0 dx,dy=1,0
vx,vy=vsx/2,vsy/2
else: else:
dx,dy=0,-1#(2) k,dx,dy=2,0,-1#(2)
elif y0==1 and x0<sx-1: vx,vy=vsx/2,-vsy/2
elif y0==1 and x0>0 and x0<sx-1:
if dy==-1: #(3) if dy==-1: #(3)
dx,dy=1,0 dx,dy=1,0
vx,vy=vsx/2,-vsy/2
else: else:
dx,dy=0,1 #(4) k,dx,dy=4,0,1 #(4)
vx,vy=vsx/2,vsy/2
elif y0==0: elif y0==0:
if n==1 and x0==1: #(7 or 8) if n==1 and x0==1: #(7 or 8)
if r%2==0 and x1+2*sx<=nx:#(7 even) if cx<tx-1:
x1+=sx k,dx,dy=7,-1,0
elif r%2==1 and x1>0:#(7 odd) vx,vy=0,0
x1-=sx else: #(8)
elif y1+2*sy<=ny:#(8) k,dx,dy=8,sx-1,sy
y1+=sy;r+=1 vx,vy=0,0
else:
break #finished whole grid
print('next regionA')
x0,y0,n=0,0,0
dx,dy=0,0
elif x0==1: #(6) elif x0==1: #(6)
dx,dy=-1,0;n+=1 k,dx,dy=6,-1,0
vx,vy=-vsx,0
elif x0==0: #(0) elif x0==0: #(0)
dx,dy=0,1 k,dx,dy=0,0,1
else: #(5) vx,vy=0,vsy
dx,dy=-1,0 elif x0==sx-1: #(5)
k,dx,dy=5,-1,0
vx,vy=-vsx/2,-vsy/2
def plot_trajectory(self): def plot_trajectory(self):
pts = self.pts # X,Y array pts = self.pts # X,Y array

View File

@@ -1040,27 +1040,27 @@ enable plc 2
{t}=1 // motion pvt time scaling {t}=1 // motion pvt time scaling
pvt{pt2pt_time} abs pvt{pt2pt_time} abs
while(1){{ while(1){{
{x0}+={dx};{y0}+={dy}
//send 1"A:move(%d) X%g:%g Y%g:%g",{n},{ox}+{x0}+{x1}*{px},{dx},{oy}+{y0}+{y1}*{py},{dy} //send 1"A:move(%d) X%g:%g Y%g:%g",{n},{ox}+{x0}+{x1}*{px},{dx},{oy}+{y0}+{y1}*{py},{dy}
X({ox}+({x0}+{x1})*{px}):({vx}) Y({oy}+({y0}+{y1})*{py}):({vy}) X({ox}+({x0}+{x1})*{px}):({vx}) Y({oy}+({y0}+{y1})*{py}):({vy})
{x0}+={dx};{y0}+={dy}
if ({t}!=1){{ if ({t}!=1){{
pvt{pt2pt_time} abs;{t}=1 pvt{pt2pt_time} abs;{t}=1
}} }}
if ({y0}=={sy}-1){{ if ({y0}=={sy}-1){{
if ({dy}==1){{ // (1) if ({dy}==1){{ // (1)
{dx}=1;{dy}=0 {dx}=1;{dy}=0
{vx}={vsx};{vy}=0 {vx}={vsx}/2;{vy}={vsy}/2
}}else{{ }}else{{
{dx}=0;{dy}=-1// (2) {dx}=0;{dy}=-1// (2)
{vx}=0;{vy}=-{vsy} {vx}={vsx}/2;{vy}=-{vsy}/2
}} }}
}}else if ({y0}==1 && {x0}<{sx}-1){{ }}else if ({y0}==1 && {x0}<{sx}-1){{
if ({dy}==-1){{ // (3) if ({dy}==-1){{ // (3)
{dx}=1;{dy}=0 {dx}=1;{dy}=0
{vx}={vsx};{vy}=0 {vx}={vsx}/2;{vy}=-{vsy}/2
}}else{{ }}else{{
{dx}=0;{dy}=1 // (4) {dx}=0;{dy}=1 // (4)
{vx}=0;{vy}={vsy} {vx}={vsx}/2;{vy}={vsy}/2
}} }}
}}else if ({y0}==0){{ }}else if ({y0}==0){{
if ({n}==1 && {x0}==1){{ // (7 or 8) if ({n}==1 && {x0}==1){{ // (7 or 8)
@@ -1071,7 +1071,7 @@ enable plc 2
}} }}
else if ({r}%2==1 && {x1}>0){{ //(7 odd) else if ({r}%2==1 && {x1}>0){{ //(7 odd)
{x1}-={sx} {x1}-={sx}
{vx}=-{vsx};{vy}=0 {vx}=0;{vy}=0
pvt{pt2pt_time*tmx} abs;{t}={tmx} pvt{pt2pt_time*tmx} abs;{t}={tmx}
}} }}
else if ({y1}+2*{sy}<={ny}){{ //(8) else if ({y1}+2*{sy}<={ny}){{ //(8)
@@ -1093,7 +1093,7 @@ enable plc 2
{vx}=0;{vy}={vsy} {vx}=0;{vy}={vsy}
}}else{{ // (5) }}else{{ // (5)
{dx}=-1;{dy}=0 {dx}=-1;{dy}=0
{vx}=-{vsx};{vy}=0 {vx}=-{vsx}/2;{vy}=-{vsy}/2
}} }}
}} }}
}} }}
@@ -1299,8 +1299,8 @@ if __name__=='__main__':
elif mode==6: elif mode==6:
grid={'pos':(-1000, -1200), 'pitch':(120, 120), 'count':(16, 20)} grid={'pos':(-1000, -1200), 'pitch':(120, 120), 'count':(16, 20)}
# section size (in wells) # section size (in wells)
ssz=(4, 5) #ssz=(4, 5)
#ssz=(6, 10) ssz=(6, 10)
#ssz=(2, 5) #ssz=(2, 5)
#sdelay=ssz[0]*ssz[1] # wait after <swait> section for motion trigger. swait=0:never wait #sdelay=ssz[0]*ssz[1] # wait after <swait> section for motion trigger. swait=0:never wait
sp.setup_motion(fnPrg=fn+'.prg',scale=1.,cnt=1,dwell=100,mode=6,grid=grid,ssz=ssz) sp.setup_motion(fnPrg=fn+'.prg',scale=1.,cnt=1,dwell=100,mode=6,grid=grid,ssz=ssz)